-
-
Notifications
You must be signed in to change notification settings - Fork 557
Add new exercise: line-up #2595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2ec2372
Add line-up exercise
mk-mxp 77f404d
Fix rules
mk-mxp cf45aea
Improvements according to reviews
mk-mxp e9a163b
Don't pad comment strings with spaces
mk-mxp 3c07231
Add all single digit cases
mk-mxp 446be4b
Re-word test ordering comment
mk-mxp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| { | ||
| "exercise": "line-up", | ||
| "comments": [ | ||
| "Names are chosen without Unicode characters to keep the exercise simple. ", | ||
| "", | ||
| "The tests are ordered starting with the most common case and coming to ", | ||
| "more special cases later on. " | ||
| ], | ||
| "cases": [ | ||
| { | ||
| "uuid": "7760d1b8-4864-4db4-953b-0fa7c047dbc0", | ||
| "description": "format smallest non-exceptional ordinal numeral 4", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Gianna", | ||
| "number": 4 | ||
| }, | ||
| "expected": "Gianna, you are the 4th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "e8b7c715-6baa-4f7b-8fb3-2fa48044ab7a", | ||
| "description": "format greatest single digit non-exceptional ordinal numeral 9", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Maarten", | ||
| "number": 9 | ||
| }, | ||
| "expected": "Maarten, you are the 9th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "8267072d-be1f-4f70-b34a-76b7557a47b9", | ||
| "description": "format exceptional ordinal numeral 1", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Mary", | ||
| "number": 1 | ||
| }, | ||
| "expected": "Mary, you are the 1st customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "4d8753cb-0364-4b29-84b8-4374a4fa2e3f", | ||
| "description": "format exceptional ordinal numeral 2", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Haruto", | ||
| "number": 2 | ||
| }, | ||
| "expected": "Haruto, you are the 2nd customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "8d44c223-3a7e-4f48-a0ca-78e67bf98aa7", | ||
| "description": "format exceptional ordinal numeral 3", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Henriette", | ||
| "number": 3 | ||
| }, | ||
| "expected": "Henriette, you are the 3rd customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "6c4f6c88-b306-4f40-bc78-97cdd583c21a", | ||
| "description": "format smallest two digit non-exceptional ordinal numeral 10", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Alvarez", | ||
| "number": 10 | ||
| }, | ||
| "expected": "Alvarez, you are the 10th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "e257a43f-d2b1-457a-97df-25f0923fc62a", | ||
| "description": "format non-exceptional ordinal numeral 11", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Jacqueline", | ||
| "number": 11 | ||
| }, | ||
| "expected": "Jacqueline, you are the 11th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "bb1db695-4d64-457f-81b8-4f5a2107e3f4", | ||
| "description": "format non-exceptional ordinal numeral 12", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Juan", | ||
| "number": 12 | ||
| }, | ||
| "expected": "Juan, you are the 12th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "60a3187c-9403-4835-97de-4f10ebfd63e2", | ||
| "description": "format non-exceptional ordinal numeral 13", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Patricia", | ||
| "number": 13 | ||
| }, | ||
| "expected": "Patricia, you are the 13th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "2bdcebc5-c029-4874-b6cc-e9bec80d603a", | ||
| "description": "format exceptional ordinal numeral 21", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Washi", | ||
| "number": 21 | ||
| }, | ||
| "expected": "Washi, you are the 21st customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "74ee2317-0295-49d2-baf0-d56bcefa14e3", | ||
| "description": "format exceptional ordinal numeral 62", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Nayra", | ||
| "number": 62 | ||
| }, | ||
| "expected": "Nayra, you are the 62nd customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "b37c332d-7f68-40e3-8503-e43cbd67a0c4", | ||
| "description": "format exceptional ordinal numeral 100", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "John", | ||
| "number": 100 | ||
| }, | ||
| "expected": "John, you are the 100th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "0375f250-ce92-4195-9555-00e28ccc4d99", | ||
| "description": "format exceptional ordinal numeral 101", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Zeinab", | ||
| "number": 101 | ||
| }, | ||
| "expected": "Zeinab, you are the 101st customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "0d8a4974-9a8a-45a4-aca7-a9fb473c9836", | ||
| "description": "format non-exceptional ordinal numeral 112", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Knud", | ||
| "number": 112 | ||
| }, | ||
| "expected": "Knud, you are the 112th customer we serve today. Thank you!" | ||
| }, | ||
| { | ||
| "uuid": "06b62efe-199e-4ce7-970d-4bf73945713f", | ||
| "description": "format exceptional ordinal numeral 123", | ||
| "property": "format", | ||
| "input": { | ||
| "name": "Yma", | ||
| "number": 123 | ||
| }, | ||
| "expected": "Yma, you are the 123rd customer we serve today. Thank you!" | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Instructions | ||
|
|
||
| Given a name and a number, your task is to produce a sentence with an [ordinal numeral][ordinal-numeral] to print onto the ticket. | ||
mk-mxp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Yaʻqūb expects to use numbers from 1 up to 999. | ||
|
|
||
| Rules: | ||
|
|
||
| - Numbers ending in 1 (except for 11) → `st` | ||
mk-mxp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Numbers ending in 2 (except for 12) → `nd` | ||
| - Numbers ending in 3 (except for 13) → `rd` | ||
| - All other numbers → `th` | ||
|
|
||
| Examples: | ||
|
|
||
| - `'Mary', 1` → `'Mary, you are the 1st customer we serve today. Thank you!'` | ||
| - `'John', 12` → `'John, you are the 12th customer we serve today. Thank you!'` | ||
| - `'Dahir', 162` → `'Dahir, you are the 162nd customer we serve today. Thank you!'` | ||
|
|
||
| [ordinal-numeral]: https://en.wikipedia.org/wiki/Ordinal_numeral | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Introduction | ||
|
|
||
| Your friend Yaʻqūb works the counter at a deli in town, slicing, weighing, and wrapping orders for a line of hungry customers that gets longer every day. | ||
| He sees that waiting customers start to loose track of who is next, so he wants to have numbered tickets for them to pick when they arrive. | ||
mk-mxp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| He is a nice person, and so he does not want to have only a number on the ticket. They shall get a proper English sentence with their name and number in it. | ||
mk-mxp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| title = "Line up" | ||
| blurb = "Help lining up customers at Yaʻqūb's Deli." | ||
| source = "Based on previous work from Exercism contributors codedge and neenjaw" | ||
mk-mxp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| source_url = "https://en.wikipedia.org/wiki/Ordinal_numeral" | ||
mk-mxp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.