From ed83e5026c8216299fe914e0290bdfc56b2c6115 Mon Sep 17 00:00:00 2001 From: glaxxie <86179463+glaxxie@users.noreply.github.com> Date: Sun, 14 Jan 2024 16:42:04 -0600 Subject: [PATCH 1/3] sync exercise docs --- .../practice/accumulate/.meta/config.json | 2 +- .../practice/acronym/.docs/instructions.md | 10 ++-- .../affine-cipher/.docs/instructions.md | 4 +- .../all-your-base/.docs/instructions.md | 8 +-- .../practice/allergies/.docs/instructions.md | 2 +- exercises/practice/anagram/.meta/tests.toml | 5 ++ .../armstrong-numbers/.docs/instructions.md | 4 +- .../binary-search-tree/.meta/config.json | 3 +- .../binary-search/.docs/instructions.md | 2 +- .../practice/book-store/.docs/instructions.md | 2 +- .../circular-buffer/.docs/instructions.md | 48 +++++++++++------ exercises/practice/clock/.meta/config.json | 7 +-- .../practice/custom-set/.meta/tests.toml | 3 ++ .../practice/darts/.docs/instructions.md | 8 +++ .../practice/dnd-character/.meta/tests.toml | 5 ++ .../error-handling/.docs/instructions.md | 2 +- exercises/practice/grains/.meta/tests.toml | 12 +++-- .../practice/hello-world/.meta/config.json | 2 +- .../practice/isbn-verifier/.meta/tests.toml | 3 ++ .../practice/isogram/.docs/instructions.md | 2 +- exercises/practice/isogram/.meta/tests.toml | 3 ++ exercises/practice/knapsack/.meta/tests.toml | 5 ++ exercises/practice/leap/.docs/instructions.md | 21 +------- exercises/practice/leap/.docs/introduction.md | 16 ++++++ exercises/practice/leap/.meta/config.json | 2 +- .../practice/list-ops/.docs/instructions.md | 16 +++--- exercises/practice/meetup/.meta/config.json | 6 ++- .../perfect-numbers/.docs/instructions.md | 53 ++++++++++++------- .../phone-number/.docs/instructions.md | 10 ++-- exercises/practice/poker/.meta/tests.toml | 16 ++++++ .../protein-translation/.docs/instructions.md | 20 +++---- .../pythagorean-triplet/.meta/config.json | 2 +- .../queen-attack/.docs/instructions.md | 20 +++---- .../rotational-cipher/.docs/instructions.md | 4 +- .../rotational-cipher/.meta/tests.toml | 3 ++ .../practice/series/.docs/instructions.md | 4 +- exercises/practice/series/.meta/tests.toml | 3 ++ .../practice/spiral-matrix/.meta/config.json | 2 +- exercises/practice/strain/.meta/config.json | 6 ++- .../practice/transpose/.meta/config.json | 2 +- .../practice/yacht/.docs/instructions.md | 32 +++++------ .../practice/zipper/.docs/instructions.md | 32 +++++------ 42 files changed, 252 insertions(+), 160 deletions(-) create mode 100644 exercises/practice/leap/.docs/introduction.md diff --git a/exercises/practice/accumulate/.meta/config.json b/exercises/practice/accumulate/.meta/config.json index 2436565d..ffd2d436 100644 --- a/exercises/practice/accumulate/.meta/config.json +++ b/exercises/practice/accumulate/.meta/config.json @@ -19,5 +19,5 @@ }, "blurb": "Implement the `accumulate` operation, which, given a collection and an operation to perform on each element of the collection, returns a new collection containing the result of applying that operation to each element of the input collection.", "source": "Conversation with James Edward Gray II", - "source_url": "https://twitter.com/jeg2" + "source_url": "http://graysoftinc.com/" } diff --git a/exercises/practice/acronym/.docs/instructions.md b/exercises/practice/acronym/.docs/instructions.md index c62fc3e8..133bd2cb 100644 --- a/exercises/practice/acronym/.docs/instructions.md +++ b/exercises/practice/acronym/.docs/instructions.md @@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace) For example: -|Input|Output| -|-|-| -|As Soon As Possible|ASAP| -|Liquid-crystal display|LCD| -|Thank George It's Friday!|TGIF| +| Input | Output | +| ------------------------- | ------ | +| As Soon As Possible | ASAP | +| Liquid-crystal display | LCD | +| Thank George It's Friday! | TGIF | diff --git a/exercises/practice/affine-cipher/.docs/instructions.md b/exercises/practice/affine-cipher/.docs/instructions.md index 2ad6d152..26ce1534 100644 --- a/exercises/practice/affine-cipher/.docs/instructions.md +++ b/exercises/practice/affine-cipher/.docs/instructions.md @@ -6,7 +6,7 @@ The affine cipher is a type of monoalphabetic substitution cipher. Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value. Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys. -[//]: # ( monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic ) +[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic " ## Encryption @@ -23,7 +23,7 @@ Where: For the Roman alphabet `m` is `26`. - `a` and `b` are integers which make the encryption key -Values `a` and `m` must be *coprime* (or, *relatively prime*) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]). +Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]). In case `a` is not coprime to `m`, your program should indicate that this is an error. Otherwise it should encrypt or decrypt with the provided key. diff --git a/exercises/practice/all-your-base/.docs/instructions.md b/exercises/practice/all-your-base/.docs/instructions.md index d5a2cde6..4602b5cf 100644 --- a/exercises/practice/all-your-base/.docs/instructions.md +++ b/exercises/practice/all-your-base/.docs/instructions.md @@ -14,20 +14,20 @@ Given a number in base **a**, represented as a sequence of digits, convert it to In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**. -The number 42, *in base 10*, means: +The number 42, _in base 10_, means: `(4 * 10^1) + (2 * 10^0)` -The number 101010, *in base 2*, means: +The number 101010, _in base 2_, means: `(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)` -The number 1120, *in base 3*, means: +The number 1120, _in base 3_, means: `(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)` I think you got the idea! -*Yes. Those three numbers above are exactly the same. Congratulations!* +_Yes. Those three numbers above are exactly the same. Congratulations!_ [positional-notation]: https://en.wikipedia.org/wiki/Positional_notation diff --git a/exercises/practice/allergies/.docs/instructions.md b/exercises/practice/allergies/.docs/instructions.md index a1394920..daf8cfde 100644 --- a/exercises/practice/allergies/.docs/instructions.md +++ b/exercises/practice/allergies/.docs/instructions.md @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say: - Whether Tom is allergic to any one of those allergens listed above. - All the allergens Tom is allergic to. -Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). +Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). Your program should ignore those components of the score. For example, if the allergy score is 257, your program should only report the eggs (1) allergy. diff --git a/exercises/practice/anagram/.meta/tests.toml b/exercises/practice/anagram/.meta/tests.toml index 8a3708bb..4f43811d 100644 --- a/exercises/practice/anagram/.meta/tests.toml +++ b/exercises/practice/anagram/.meta/tests.toml @@ -46,6 +46,11 @@ description = "detects anagrams using case-insensitive possible matches" [7cc195ad-e3c7-44ee-9fd2-d3c344806a2c] description = "does not detect an anagram if the original word is repeated" +include = false + +[630abb71-a94e-4715-8395-179ec1df9f91] +description = "does not detect an anagram if the original word is repeated" +reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c" [9878a1c9-d6ea-4235-ae51-3ea2befd6842] description = "anagrams must use all letters exactly once" diff --git a/exercises/practice/armstrong-numbers/.docs/instructions.md b/exercises/practice/armstrong-numbers/.docs/instructions.md index 744cfbe7..5e56bbe4 100644 --- a/exercises/practice/armstrong-numbers/.docs/instructions.md +++ b/exercises/practice/armstrong-numbers/.docs/instructions.md @@ -5,9 +5,9 @@ An [Armstrong number][armstrong-number] is a number that is the sum of its own d For example: - 9 is an Armstrong number, because `9 = 9^1 = 9` -- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` +- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1` - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` -- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` +- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` Write some code to determine whether a number is an Armstrong number. diff --git a/exercises/practice/binary-search-tree/.meta/config.json b/exercises/practice/binary-search-tree/.meta/config.json index 68c0364f..2ff7123c 100644 --- a/exercises/practice/binary-search-tree/.meta/config.json +++ b/exercises/practice/binary-search-tree/.meta/config.json @@ -14,6 +14,5 @@ ] }, "blurb": "Insert and search for numbers in a binary tree.", - "source": "Josh Cheek", - "source_url": "https://twitter.com/josh_cheek" + "source": "Josh Cheek" } diff --git a/exercises/practice/binary-search/.docs/instructions.md b/exercises/practice/binary-search/.docs/instructions.md index aa1946cf..12f4358e 100644 --- a/exercises/practice/binary-search/.docs/instructions.md +++ b/exercises/practice/binary-search/.docs/instructions.md @@ -11,7 +11,7 @@ Binary search only works when a list has been sorted. The algorithm looks like this: -- Find the middle element of a *sorted* list and compare it with the item we're looking for. +- Find the middle element of a _sorted_ list and compare it with the item we're looking for. - If the middle element is our item, then we're done! - If the middle element is greater than our item, we can eliminate that element and all the elements **after** it. - If the middle element is less than our item, we can eliminate that element and all the elements **before** it. diff --git a/exercises/practice/book-store/.docs/instructions.md b/exercises/practice/book-store/.docs/instructions.md index 4ef76ab9..54403f17 100644 --- a/exercises/practice/book-store/.docs/instructions.md +++ b/exercises/practice/book-store/.docs/instructions.md @@ -1,6 +1,6 @@ # Instructions -To try and encourage more sales of different books from a popular 5 books series, a bookshop has decided to offer discounts on multiple book purchases. +To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts on multiple book purchases. One copy of any of the five books costs $8. diff --git a/exercises/practice/circular-buffer/.docs/instructions.md b/exercises/practice/circular-buffer/.docs/instructions.md index 3487a0f6..2ba1fda2 100644 --- a/exercises/practice/circular-buffer/.docs/instructions.md +++ b/exercises/practice/circular-buffer/.docs/instructions.md @@ -4,39 +4,55 @@ A circular buffer, cyclic buffer or ring buffer is a data structure that uses a A circular buffer first starts empty and of some predefined length. For example, this is a 7-element buffer: - - [ ][ ][ ][ ][ ][ ][ ] + +```text +[ ][ ][ ][ ][ ][ ][ ] +``` Assume that a 1 is written into the middle of the buffer (exact starting location does not matter in a circular buffer): - - [ ][ ][ ][1][ ][ ][ ] + +```text +[ ][ ][ ][1][ ][ ][ ] +``` Then assume that two more elements are added — 2 & 3 — which get appended after the 1: - - [ ][ ][ ][1][2][3][ ] + +```text +[ ][ ][ ][1][2][3][ ] +``` If two elements are then removed from the buffer, the oldest values inside the buffer are removed. The two elements removed, in this case, are 1 & 2, leaving the buffer with just a 3: - - [ ][ ][ ][ ][ ][3][ ] + +```text +[ ][ ][ ][ ][ ][3][ ] +``` If the buffer has 7 elements then it is completely full: - - [5][6][7][8][9][3][4] + +```text +[5][6][7][8][9][3][4] +``` When the buffer is full an error will be raised, alerting the client that further writes are blocked until a slot becomes free. When the buffer is full, the client can opt to overwrite the oldest data with a forced write. In this case, two more elements — A & B — are added and they overwrite the 3 & 4: - - [5][6][7][8][9][A][B] + +```text +[5][6][7][8][9][A][B] +``` 3 & 4 have been replaced by A & B making 5 now the oldest data in the buffer. Finally, if two elements are removed then what would be returned is 5 & 6 yielding the buffer: - - [ ][ ][7][8][9][A][B] + +```text +[ ][ ][7][8][9][A][B] +``` Because there is space available, if the client again uses overwrite to store C & D then the space where 5 & 6 were stored previously will be used not the location of 7 & 8. 7 is still the oldest element and the buffer is once again full. - - [C][D][7][8][9][A][B] + +```text +[C][D][7][8][9][A][B] +``` diff --git a/exercises/practice/clock/.meta/config.json b/exercises/practice/clock/.meta/config.json index 3fbc5137..b5f3399b 100644 --- a/exercises/practice/clock/.meta/config.json +++ b/exercises/practice/clock/.meta/config.json @@ -1,5 +1,7 @@ { - "authors": ["glaxxie"], + "authors": [ + "glaxxie" + ], "files": { "solution": [ "Clock.ps1" @@ -12,6 +14,5 @@ ] }, "blurb": "Implement a clock that handles times without dates.", - "source": "Pairing session with Erin Drummond", - "source_url": "https://twitter.com/ebdrummond" + "source": "Pairing session with Erin Drummond" } diff --git a/exercises/practice/custom-set/.meta/tests.toml b/exercises/practice/custom-set/.meta/tests.toml index 4578354d..8c450e0b 100644 --- a/exercises/practice/custom-set/.meta/tests.toml +++ b/exercises/practice/custom-set/.meta/tests.toml @@ -75,6 +75,9 @@ description = "Sets with the same elements are equal -> sets with different elem [06059caf-9bf4-425e-aaff-88966cb3ea14] description = "Sets with the same elements are equal -> set is not equal to larger set with same elements" +[d4a1142f-09aa-4df9-8b83-4437dcf7ec24] +description = "Sets with the same elements are equal -> set is equal to a set constructed from an array with duplicates" + [8a677c3c-a658-4d39-bb88-5b5b1a9659f4] description = "Unique elements can be added to a set -> add to empty set" diff --git a/exercises/practice/darts/.docs/instructions.md b/exercises/practice/darts/.docs/instructions.md index 70f0e53d..5e57a860 100644 --- a/exercises/practice/darts/.docs/instructions.md +++ b/exercises/practice/darts/.docs/instructions.md @@ -6,6 +6,8 @@ Write a function that returns the earned points in a single toss of a Darts game In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands: +![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg) + - If the dart lands outside the target, player earns no points (0 points). - If the dart lands in the outer circle of the target, player earns 1 point. - If the dart lands in the middle circle of the target, player earns 5 points. @@ -16,8 +18,14 @@ Of course, they are all centered at the same point — that is, the circles are Write a function that given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), returns the correct amount earned by a dart landing at that point. +## Credit + +The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape]. + [darts]: https://en.wikipedia.org/wiki/Darts [darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg [concentric]: https://mathworld.wolfram.com/ConcentricCircles.html [cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html [real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html +[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire +[inkscape]: https://en.wikipedia.org/wiki/Inkscape diff --git a/exercises/practice/dnd-character/.meta/tests.toml b/exercises/practice/dnd-character/.meta/tests.toml index 2b04dd33..719043b2 100644 --- a/exercises/practice/dnd-character/.meta/tests.toml +++ b/exercises/practice/dnd-character/.meta/tests.toml @@ -65,3 +65,8 @@ description = "random character is valid" [2ca77b9b-c099-46c3-a02c-0d0f68ffa0fe] description = "each ability is only calculated once" +include = false + +[dca2b2ec-f729-4551-84b9-078876bb4808] +description = "each ability is only calculated once" +reimplements = "2ca77b9b-c099-46c3-a02c-0d0f68ffa0fe" diff --git a/exercises/practice/error-handling/.docs/instructions.md b/exercises/practice/error-handling/.docs/instructions.md index a9806392..25dd4d29 100644 --- a/exercises/practice/error-handling/.docs/instructions.md +++ b/exercises/practice/error-handling/.docs/instructions.md @@ -5,4 +5,4 @@ Implement various kinds of error handling and resource management. An important point of programming is how to handle errors and close resources even if errors occur. This exercise requires you to handle various errors. -Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required. \ No newline at end of file +Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required. diff --git a/exercises/practice/grains/.meta/tests.toml b/exercises/practice/grains/.meta/tests.toml index 1e5d4376..6ea68bc0 100644 --- a/exercises/practice/grains/.meta/tests.toml +++ b/exercises/practice/grains/.meta/tests.toml @@ -27,11 +27,17 @@ description = "returns the number of grains on the square -> grains on square 16 [acd81b46-c2ad-4951-b848-80d15ed5a04f] description = "returns the number of grains on the square -> grains on square 32" +[c73b470a-5efb-4d53-9ac6-c5f6487f227b] +description = "returns the number of grains on the square -> grains on square 64" + [1d47d832-3e85-4974-9466-5bd35af484e3] -description = "returns the number of grains on the square -> square 0 raises an exception" +description = "returns the number of grains on the square -> square 0 is invalid" [61974483-eeb2-465e-be54-ca5dde366453] -description = "returns the number of grains on the square -> negative square raises an exception" +description = "returns the number of grains on the square -> negative square is invalid" [a95e4374-f32c-45a7-a10d-ffec475c012f] -description = "returns the number of grains on the square -> square greater than 64 raises an exception" +description = "returns the number of grains on the square -> square greater than 64 is invalid" + +[6eb07385-3659-4b45-a6be-9dc474222750] +description = "returns the total number of grains on the board" diff --git a/exercises/practice/hello-world/.meta/config.json b/exercises/practice/hello-world/.meta/config.json index 7f9b729c..b50d55b0 100644 --- a/exercises/practice/hello-world/.meta/config.json +++ b/exercises/practice/hello-world/.meta/config.json @@ -20,7 +20,7 @@ ".meta/HelloWorld.example.ps1" ] }, - "blurb": "The classical introductory exercise. Just say \"Hello, World!\".", + "blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".", "source": "This is an exercise to introduce users to using Exercism", "source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program" } diff --git a/exercises/practice/isbn-verifier/.meta/tests.toml b/exercises/practice/isbn-verifier/.meta/tests.toml index eaeb7d16..6d5a8459 100644 --- a/exercises/practice/isbn-verifier/.meta/tests.toml +++ b/exercises/practice/isbn-verifier/.meta/tests.toml @@ -9,6 +9,9 @@ # As user-added comments (using the # character) will be removed when this file # is regenerated, comments can be added via a `comment` key. +[0caa3eac-d2e3-4c29-8df8-b188bc8c9292] +description = "valid isbn" + [19f76b53-7c24-45f8-87b8-4604d0ccd248] description = "invalid isbn check digit" diff --git a/exercises/practice/isogram/.docs/instructions.md b/exercises/practice/isogram/.docs/instructions.md index 5e488447..2e8df851 100644 --- a/exercises/practice/isogram/.docs/instructions.md +++ b/exercises/practice/isogram/.docs/instructions.md @@ -11,4 +11,4 @@ Examples of isograms: - downstream - six-year-old -The word *isograms*, however, is not an isogram, because the s repeats. +The word _isograms_, however, is not an isogram, because the s repeats. diff --git a/exercises/practice/isogram/.meta/tests.toml b/exercises/practice/isogram/.meta/tests.toml index 56249453..ba04c664 100644 --- a/exercises/practice/isogram/.meta/tests.toml +++ b/exercises/practice/isogram/.meta/tests.toml @@ -47,3 +47,6 @@ description = "duplicated character in the middle" [310ac53d-8932-47bc-bbb4-b2b94f25a83e] description = "same first and last characters" + +[0d0b8644-0a1e-4a31-a432-2b3ee270d847] +description = "word with duplicated character and with two hyphens" diff --git a/exercises/practice/knapsack/.meta/tests.toml b/exercises/practice/knapsack/.meta/tests.toml index febc7b26..8e013ef1 100644 --- a/exercises/practice/knapsack/.meta/tests.toml +++ b/exercises/practice/knapsack/.meta/tests.toml @@ -11,6 +11,11 @@ [a4d7d2f0-ad8a-460c-86f3-88ba709d41a7] description = "no items" +include = false + +[3993a824-c20e-493d-b3c9-ee8a7753ee59] +description = "no items" +reimplements = "a4d7d2f0-ad8a-460c-86f3-88ba709d41a7" [1d39e98c-6249-4a8b-912f-87cb12e506b0] description = "one item, too heavy" diff --git a/exercises/practice/leap/.docs/instructions.md b/exercises/practice/leap/.docs/instructions.md index a83826b2..b14f8565 100644 --- a/exercises/practice/leap/.docs/instructions.md +++ b/exercises/practice/leap/.docs/instructions.md @@ -1,22 +1,3 @@ # Instructions -Given a year, report if it is a leap year. - -The tricky thing here is that a leap year in the Gregorian calendar occurs: - -```text -on every year that is evenly divisible by 4 - except every year that is evenly divisible by 100 - unless the year is also evenly divisible by 400 -``` - -For example, 1997 is not a leap year, but 1996 is. -1900 is not a leap year, but 2000 is. - -## Notes - -Though our exercise adopts some very simple rules, there is more to learn! - -For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video]. - -[video]: https://www.youtube.com/watch?v=xX96xng7sAE +Your task is to determine whether a given year is a leap year. diff --git a/exercises/practice/leap/.docs/introduction.md b/exercises/practice/leap/.docs/introduction.md new file mode 100644 index 00000000..1cb8b14c --- /dev/null +++ b/exercises/practice/leap/.docs/introduction.md @@ -0,0 +1,16 @@ +# Introduction + +A leap year (in the Gregorian calendar) occurs: + +- In every year that is evenly divisible by 4 +- Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. + +Some examples: + +- 1997 was not a leap year as it's not divisible by 4. +- 1900 was not a leap year as it's not divisible by 400 +- 2000 was a leap year! + +~~~~exercism/note +For a delightful, four minute explanation of the whole phenomenon of leap years, check out [this youtube video](https://www.youtube.com/watch?v=xX96xng7sAE). +~~~~ diff --git a/exercises/practice/leap/.meta/config.json b/exercises/practice/leap/.meta/config.json index 4816bec5..285016a2 100644 --- a/exercises/practice/leap/.meta/config.json +++ b/exercises/practice/leap/.meta/config.json @@ -18,7 +18,7 @@ ".meta/LeapYear.example.ps1" ] }, - "blurb": "Given a year, report if it is a leap year.", + "blurb": "Determine whether a given year is a leap year.", "source": "CodeRanch Cattle Drive, Assignment 3", "source_url": "https://coderanch.com/t/718816/Leap" } diff --git a/exercises/practice/list-ops/.docs/instructions.md b/exercises/practice/list-ops/.docs/instructions.md index ccfc2f8b..ebc5dffe 100644 --- a/exercises/practice/list-ops/.docs/instructions.md +++ b/exercises/practice/list-ops/.docs/instructions.md @@ -7,13 +7,13 @@ Implement a series of basic list operations, without using existing functions. The precise number and names of the operations to be implemented will be track dependent to avoid conflicts with existing names, but the general operations you will implement include: -- `append` (*given two lists, add all items in the second list to the end of the first list*); -- `concatenate` (*given a series of lists, combine all items in all lists into one flattened list*); -- `filter` (*given a predicate and a list, return the list of all items for which `predicate(item)` is True*); -- `length` (*given a list, return the total number of items within it*); -- `map` (*given a function and a list, return the list of the results of applying `function(item)` on all items*); -- `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left*); -- `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right*); -- `reverse` (*given a list, return a list with all the original items, but in reversed order*). +- `append` (_given two lists, add all items in the second list to the end of the first list_); +- `concatenate` (_given a series of lists, combine all items in all lists into one flattened list_); +- `filter` (_given a predicate and a list, return the list of all items for which `predicate(item)` is True_); +- `length` (_given a list, return the total number of items within it_); +- `map` (_given a function and a list, return the list of the results of applying `function(item)` on all items_); +- `foldl` (_given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left_); +- `foldr` (_given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right_); +- `reverse` (_given a list, return a list with all the original items, but in reversed order_). Note, the ordering in which arguments are passed to the fold functions (`foldl`, `foldr`) is significant. diff --git a/exercises/practice/meetup/.meta/config.json b/exercises/practice/meetup/.meta/config.json index e2655c40..3cb4e8ee 100644 --- a/exercises/practice/meetup/.meta/config.json +++ b/exercises/practice/meetup/.meta/config.json @@ -1,5 +1,7 @@ { - "authors": ["glaxxie"], + "authors": [ + "glaxxie" + ], "files": { "solution": [ "Meetup.ps1" @@ -13,5 +15,5 @@ }, "blurb": "Calculate the date of meetups.", "source": "Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month", - "source_url": "https://twitter.com/copiousfreetime" + "source_url": "http://www.copiousfreetime.org/" } diff --git a/exercises/practice/perfect-numbers/.docs/instructions.md b/exercises/practice/perfect-numbers/.docs/instructions.md index 0dae8867..b2bc82ca 100644 --- a/exercises/practice/perfect-numbers/.docs/instructions.md +++ b/exercises/practice/perfect-numbers/.docs/instructions.md @@ -1,24 +1,39 @@ # Instructions -Determine if a number is perfect, abundant, or deficient based on -Nicomachus' (60 - 120 CE) classification scheme for positive integers. - -The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum][aliquot-sum]. -The aliquot sum is defined as the sum of the factors of a number not including the number itself. -For example, the aliquot sum of 15 is (1 + 3 + 5) = 9 - -- **Perfect**: aliquot sum = number - - 6 is a perfect number because (1 + 2 + 3) = 6 - - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 -- **Abundant**: aliquot sum > number - - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16 - - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36 -- **Deficient**: aliquot sum < number - - 8 is a deficient number because (1 + 2 + 4) = 7 - - Prime numbers are deficient - -Implement a way to determine whether a given number is **perfect**. -Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. +Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers. + +The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of [perfect](#perfect), [abundant](#abundant), or [deficient](#deficient) based on their [aliquot sum][aliquot-sum]. +The _aliquot sum_ is defined as the sum of the factors of a number not including the number itself. +For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`. + +## Perfect + +A number is perfect when it equals its aliquot sum. +For example: + +- `6` is a perfect number because `1 + 2 + 3 = 6` +- `28` is a perfect number because `1 + 2 + 4 + 7 + 14 = 28` + +## Abundant + +A number is abundant when it is less than its aliquot sum. +For example: + +- `12` is an abundant number because `1 + 2 + 3 + 4 + 6 = 16` +- `24` is an abundant number because `1 + 2 + 3 + 4 + 6 + 8 + 12 = 36` + +## Deficient + +A number is deficient when it is greater than its aliquot sum. +For example: + +- `8` is a deficient number because `1 + 2 + 4 = 7` +- Prime numbers are deficient + +## Task + +Implement a way to determine whether a given number is [perfect](#perfect). +Depending on your language track, you may also need to implement a way to determine whether a given number is [abundant](#abundant) or [deficient](#deficient). [nicomachus]: https://en.wikipedia.org/wiki/Nicomachus [aliquot-sum]: https://en.wikipedia.org/wiki/Aliquot_sum diff --git a/exercises/practice/phone-number/.docs/instructions.md b/exercises/practice/phone-number/.docs/instructions.md index 6d3275cd..62ba48e9 100644 --- a/exercises/practice/phone-number/.docs/instructions.md +++ b/exercises/practice/phone-number/.docs/instructions.md @@ -5,18 +5,20 @@ Clean up user-entered phone numbers so that they can be sent SMS messages. The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`. -NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. -The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. +NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number. +The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_. The format is usually represented as ```text -(NXX)-NXX-XXXX +NXX NXX-XXXX ``` where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. -Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. +Sometimes they also have the country code (represented as `1` or `+1`) prefixed. + +Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present. For example, the inputs diff --git a/exercises/practice/poker/.meta/tests.toml b/exercises/practice/poker/.meta/tests.toml index 76ac892d..2e654ef6 100644 --- a/exercises/practice/poker/.meta/tests.toml +++ b/exercises/practice/poker/.meta/tests.toml @@ -21,12 +21,18 @@ description = "a tie has multiple winners" [61ed83a9-cfaa-40a5-942a-51f52f0a8725] description = "multiple hands with the same high cards, tie compares next highest ranked, down to last card" +[da01becd-f5b0-4342-b7f3-1318191d0580] +description = "winning high card hand also has the lowest card" + [f7175a89-34ff-44de-b3d7-f6fd97d1fca4] description = "one pair beats high card" [e114fd41-a301-4111-a9e7-5a7f72a76561] description = "highest pair wins" +[b3acd3a7-f9fa-4647-85ab-e0a9e07d1365] +description = "both hands have the same pair, high card wins" + [935bb4dc-a622-4400-97fa-86e7d06b1f76] description = "two pairs beats one pair" @@ -53,6 +59,11 @@ description = "both hands have three of a kind, tie goes to highest ranked tripl [eb856cc2-481c-4b0d-9835-4d75d07a5d9d] description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards" +include = false + +[26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1] +description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards" +reimplements = "eb856cc2-481c-4b0d-9835-4d75d07a5d9d" [a858c5d9-2f28-48e7-9980-b7fa04060a60] description = "a straight beats three of a kind" @@ -77,6 +88,11 @@ description = "flush beats a straight" [4d90261d-251c-49bd-a468-896bf10133de] description = "both hands have a flush, tie goes to high card, down to the last one if necessary" +include = false + +[e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff] +description = "both hands have a flush, tie goes to high card, down to the last one if necessary" +reimplements = "4d90261d-251c-49bd-a468-896bf10133de" [3a19361d-8974-455c-82e5-f7152f5dba7c] description = "full house beats a flush" diff --git a/exercises/practice/protein-translation/.docs/instructions.md b/exercises/practice/protein-translation/.docs/instructions.md index d9b9054c..7dc34d2e 100644 --- a/exercises/practice/protein-translation/.docs/instructions.md +++ b/exercises/practice/protein-translation/.docs/instructions.md @@ -29,16 +29,16 @@ Note the stop codon `"UAA"` terminates the translation and the final methionine Below are the codons and resulting Amino Acids needed for the exercise. -Codon | Protein -:--- | :--- -AUG | Methionine -UUU, UUC | Phenylalanine -UUA, UUG | Leucine -UCU, UCC, UCA, UCG | Serine -UAU, UAC | Tyrosine -UGU, UGC | Cysteine -UGG | Tryptophan -UAA, UAG, UGA | STOP +| Codon | Protein | +| :----------------- | :------------ | +| AUG | Methionine | +| UUU, UUC | Phenylalanine | +| UUA, UUG | Leucine | +| UCU, UCC, UCA, UCG | Serine | +| UAU, UAC | Tyrosine | +| UGU, UGC | Cysteine | +| UGG | Tryptophan | +| UAA, UAG, UGA | STOP | Learn more about [protein translation on Wikipedia][protein-translation]. diff --git a/exercises/practice/pythagorean-triplet/.meta/config.json b/exercises/practice/pythagorean-triplet/.meta/config.json index c6e754bb..78fa451a 100644 --- a/exercises/practice/pythagorean-triplet/.meta/config.json +++ b/exercises/practice/pythagorean-triplet/.meta/config.json @@ -13,7 +13,7 @@ ".meta/PythagoreanTriplet.example.ps1" ] }, - "blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.", + "blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the triplet.", "source": "Problem 9 at Project Euler", "source_url": "https://projecteuler.net/problem=9" } diff --git a/exercises/practice/queen-attack/.docs/instructions.md b/exercises/practice/queen-attack/.docs/instructions.md index ad7ea954..97f22a0a 100644 --- a/exercises/practice/queen-attack/.docs/instructions.md +++ b/exercises/practice/queen-attack/.docs/instructions.md @@ -8,18 +8,14 @@ A chessboard can be represented by an 8 by 8 array. So if you are told the white queen is at `c5` (zero-indexed at column 2, row 3) and the black queen at `f2` (zero-indexed at column 5, row 6), then you know that the set-up is like so: -```text - a b c d e f g h -8 _ _ _ _ _ _ _ _ 8 -7 _ _ _ _ _ _ _ _ 7 -6 _ _ _ _ _ _ _ _ 6 -5 _ _ W _ _ _ _ _ 5 -4 _ _ _ _ _ _ _ _ 4 -3 _ _ _ _ _ _ _ _ 3 -2 _ _ _ _ _ B _ _ 2 -1 _ _ _ _ _ _ _ _ 1 - a b c d e f g h -``` +![A chess board with two queens. Arrows emanating from the queen at c5 indicate possible directions of capture along file, rank and diagonal.](https://assets.exercism.org/images/exercises/queen-attack/queen-capture.svg) You are also able to answer whether the queens can attack each other. In this case, that answer would be yes, they can, because both pieces share a diagonal. + +## Credit + +The chessboard image was made by [habere-et-dispertire][habere-et-dispertire] using LaTeX and the [chessboard package][chessboard-package] by Ulrike Fischer. + +[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire +[chessboard-package]: https://github.com/u-fischer/chessboard diff --git a/exercises/practice/rotational-cipher/.docs/instructions.md b/exercises/practice/rotational-cipher/.docs/instructions.md index 4dee51b3..4bf64ca1 100644 --- a/exercises/practice/rotational-cipher/.docs/instructions.md +++ b/exercises/practice/rotational-cipher/.docs/instructions.md @@ -22,8 +22,8 @@ Ciphertext is written out in the same formatting as the input including spaces a ## Examples -- ROT5 `omg` gives `trl` -- ROT0 `c` gives `c` +- ROT5 `omg` gives `trl` +- ROT0 `c` gives `c` - ROT26 `Cool` gives `Cool` - ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` - ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.` diff --git a/exercises/practice/rotational-cipher/.meta/tests.toml b/exercises/practice/rotational-cipher/.meta/tests.toml index ce6d1105..53441ed2 100644 --- a/exercises/practice/rotational-cipher/.meta/tests.toml +++ b/exercises/practice/rotational-cipher/.meta/tests.toml @@ -24,6 +24,9 @@ description = "rotate m by 13" [19f9eb78-e2ad-4da4-8fe3-9291d47c1709] description = "rotate n by 13 with wrap around alphabet" +[a116aef4-225b-4da9-884f-e8023ca6408a] +description = "rotate capital letters" + [71b541bb-819c-4dc6-a9c3-132ef9bb737b] description = "rotate spaces" diff --git a/exercises/practice/series/.docs/instructions.md b/exercises/practice/series/.docs/instructions.md index e32cc38c..fd97a670 100644 --- a/exercises/practice/series/.docs/instructions.md +++ b/exercises/practice/series/.docs/instructions.md @@ -15,5 +15,5 @@ And the following 4-digit series: And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get. -Note that these series are only required to occupy *adjacent positions* in the input; -the digits need not be *numerically consecutive*. +Note that these series are only required to occupy _adjacent positions_ in the input; +the digits need not be _numerically consecutive_. diff --git a/exercises/practice/series/.meta/tests.toml b/exercises/practice/series/.meta/tests.toml index 064cd214..9696f51f 100644 --- a/exercises/practice/series/.meta/tests.toml +++ b/exercises/practice/series/.meta/tests.toml @@ -24,6 +24,9 @@ description = "slices of two overlap" [8e17148d-ba0a-4007-a07f-d7f87015d84c] description = "slices can include duplicates" +[bd5b085e-f612-4f81-97a8-6314258278b0] +description = "slices of a long series" + [6d235d85-46cf-4fae-9955-14b6efef27cd] description = "slice length is too large" diff --git a/exercises/practice/spiral-matrix/.meta/config.json b/exercises/practice/spiral-matrix/.meta/config.json index cacfb221..3a1c3061 100644 --- a/exercises/practice/spiral-matrix/.meta/config.json +++ b/exercises/practice/spiral-matrix/.meta/config.json @@ -15,5 +15,5 @@ }, "blurb": "Given the size, return a square matrix of numbers in spiral order.", "source": "Reddit r/dailyprogrammer challenge #320 [Easy] Spiral Ascension.", - "source_url": "https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/" + "source_url": "https://web.archive.org/web/20230607064729/https://old.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/" } diff --git a/exercises/practice/strain/.meta/config.json b/exercises/practice/strain/.meta/config.json index cbdd166d..633ef21d 100644 --- a/exercises/practice/strain/.meta/config.json +++ b/exercises/practice/strain/.meta/config.json @@ -1,5 +1,7 @@ { - "authors": ["glaxxie"], + "authors": [ + "glaxxie" + ], "files": { "solution": [ "Strain.ps1" @@ -13,5 +15,5 @@ }, "blurb": "Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.", "source": "Conversation with James Edward Gray II", - "source_url": "https://twitter.com/jeg2" + "source_url": "http://graysoftinc.com/" } diff --git a/exercises/practice/transpose/.meta/config.json b/exercises/practice/transpose/.meta/config.json index 232730b2..86384239 100644 --- a/exercises/practice/transpose/.meta/config.json +++ b/exercises/practice/transpose/.meta/config.json @@ -15,5 +15,5 @@ }, "blurb": "Take input text and output it transposed.", "source": "Reddit r/dailyprogrammer challenge #270 [Easy].", - "source_url": "https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text" + "source_url": "https://web.archive.org/web/20230630051421/https://old.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text/" } diff --git a/exercises/practice/yacht/.docs/instructions.md b/exercises/practice/yacht/.docs/instructions.md index 163ba379..54fdb452 100644 --- a/exercises/practice/yacht/.docs/instructions.md +++ b/exercises/practice/yacht/.docs/instructions.md @@ -6,24 +6,24 @@ The score of a throw of the dice depends on category chosen. ## Scores in Yacht -| Category | Score | Description | Example | -| -------- | ----- | ----------- | ------- | -| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 | -| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 | -| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 | -| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 | -| Fives | 5 × number of fives| Any combination | 5 1 5 2 5 scores 15 | -| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 | -| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 | -| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 | -| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 | -| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 | -| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 | -| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 | +| Category | Score | Description | Example | +| --------------- | ---------------------- | ---------------------------------------- | ------------------- | +| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 | +| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 | +| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 | +| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 | +| Fives | 5 × number of fives | Any combination | 5 1 5 2 5 scores 15 | +| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 | +| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 | +| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 | +| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 | +| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 | +| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 | +| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 | If the dice do not satisfy the requirements of a category, the score is zero. -If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero points are scored. -A *Yacht* scores zero if entered in the *Full House* category. +If, for example, _Four Of A Kind_ is entered in the _Yacht_ category, zero points are scored. +A _Yacht_ scores zero if entered in the _Full House_ category. ## Task diff --git a/exercises/practice/zipper/.docs/instructions.md b/exercises/practice/zipper/.docs/instructions.md index aa523a08..5445db00 100644 --- a/exercises/practice/zipper/.docs/instructions.md +++ b/exercises/practice/zipper/.docs/instructions.md @@ -5,21 +5,23 @@ Creating a zipper for a binary tree. [Zippers][zipper] are a purely functional way of navigating within a data structure and manipulating it. They essentially contain a data structure and a pointer into that data structure (called the focus). -For example given a binary tree (a node contains a value and a its children nodes) a zipper might support these operations: +For example given a rose tree (where each node contains a value and a list of child nodes) a zipper might support these operations: -- `FromTree` (get a zipper out of a binary tree, the focus is on the root node) -- `ToTree` (get the binary tree out of the zipper) -- `Value` (get the value of the focus node) -- `GoLeft` (move the focus to the left child node, returns a new zipper) -- `GoRight` (move the focus to the right child node, returns a new zipper) -- `GoUp` (move the focus to the parent, returns a new zipper) -- `SetValue` (set the value of the focus node, returns a new zipper) -- `SetLeft` (insert a new subtree before the focus node, it - becomes the `Left` of the focus node, returns a new zipper) -- `SetRight` (insert a new subtree after the focus node, it becomes - the `Right` of the focus node, returns a new zipper) -- `Delete` (removes the focus node and all subtrees, focus moves to the - `Right` node if possible otherwise to the `Left` node if possible, - otherwise to the parent node, returns a new zipper) (*This operation is optional) +- `from_tree` (get a zipper out of a rose tree, the focus is on the root node) +- `to_tree` (get the rose tree out of the zipper) +- `value` (get the value of the focus node) +- `prev` (move the focus to the previous child of the same parent, + returns a new zipper) +- `next` (move the focus to the next child of the same parent, returns a + new zipper) +- `up` (move the focus to the parent, returns a new zipper) +- `set_value` (set the value of the focus node, returns a new zipper) +- `insert_before` (insert a new subtree before the focus node, it + becomes the `prev` of the focus node, returns a new zipper) +- `insert_after` (insert a new subtree after the focus node, it becomes + the `next` of the focus node, returns a new zipper) +- `delete` (removes the focus node and all subtrees, focus moves to the + `next` node if possible otherwise to the `prev` node if possible, + otherwise to the parent node, returns a new zipper) [zipper]: https://en.wikipedia.org/wiki/Zipper_%28data_structure%29 From 13cd46fa82850429f7f89cd416392c179cd00d11 Mon Sep 17 00:00:00 2001 From: glaxxie <86179463+glaxxie@users.noreply.github.com> Date: Sun, 14 Jan 2024 17:02:11 -0600 Subject: [PATCH 2/3] Revert "sync exercise docs" This reverts commit ed83e5026c8216299fe914e0290bdfc56b2c6115. --- .../practice/accumulate/.meta/config.json | 2 +- .../practice/acronym/.docs/instructions.md | 10 ++-- .../affine-cipher/.docs/instructions.md | 4 +- .../all-your-base/.docs/instructions.md | 8 +-- .../practice/allergies/.docs/instructions.md | 2 +- exercises/practice/anagram/.meta/tests.toml | 5 -- .../armstrong-numbers/.docs/instructions.md | 4 +- .../binary-search-tree/.meta/config.json | 3 +- .../binary-search/.docs/instructions.md | 2 +- .../practice/book-store/.docs/instructions.md | 2 +- .../circular-buffer/.docs/instructions.md | 48 ++++++----------- exercises/practice/clock/.meta/config.json | 7 ++- .../practice/custom-set/.meta/tests.toml | 3 -- .../practice/darts/.docs/instructions.md | 8 --- .../practice/dnd-character/.meta/tests.toml | 5 -- .../error-handling/.docs/instructions.md | 2 +- exercises/practice/grains/.meta/tests.toml | 12 ++--- .../practice/hello-world/.meta/config.json | 2 +- .../practice/isbn-verifier/.meta/tests.toml | 3 -- .../practice/isogram/.docs/instructions.md | 2 +- exercises/practice/isogram/.meta/tests.toml | 3 -- exercises/practice/knapsack/.meta/tests.toml | 5 -- exercises/practice/leap/.docs/instructions.md | 21 +++++++- exercises/practice/leap/.docs/introduction.md | 16 ------ exercises/practice/leap/.meta/config.json | 2 +- .../practice/list-ops/.docs/instructions.md | 16 +++--- exercises/practice/meetup/.meta/config.json | 6 +-- .../perfect-numbers/.docs/instructions.md | 53 +++++++------------ .../phone-number/.docs/instructions.md | 10 ++-- exercises/practice/poker/.meta/tests.toml | 16 ------ .../protein-translation/.docs/instructions.md | 20 +++---- .../pythagorean-triplet/.meta/config.json | 2 +- .../queen-attack/.docs/instructions.md | 20 ++++--- .../rotational-cipher/.docs/instructions.md | 4 +- .../rotational-cipher/.meta/tests.toml | 3 -- .../practice/series/.docs/instructions.md | 4 +- exercises/practice/series/.meta/tests.toml | 3 -- .../practice/spiral-matrix/.meta/config.json | 2 +- exercises/practice/strain/.meta/config.json | 6 +-- .../practice/transpose/.meta/config.json | 2 +- .../practice/yacht/.docs/instructions.md | 32 +++++------ .../practice/zipper/.docs/instructions.md | 32 ++++++----- 42 files changed, 160 insertions(+), 252 deletions(-) delete mode 100644 exercises/practice/leap/.docs/introduction.md diff --git a/exercises/practice/accumulate/.meta/config.json b/exercises/practice/accumulate/.meta/config.json index ffd2d436..2436565d 100644 --- a/exercises/practice/accumulate/.meta/config.json +++ b/exercises/practice/accumulate/.meta/config.json @@ -19,5 +19,5 @@ }, "blurb": "Implement the `accumulate` operation, which, given a collection and an operation to perform on each element of the collection, returns a new collection containing the result of applying that operation to each element of the input collection.", "source": "Conversation with James Edward Gray II", - "source_url": "http://graysoftinc.com/" + "source_url": "https://twitter.com/jeg2" } diff --git a/exercises/practice/acronym/.docs/instructions.md b/exercises/practice/acronym/.docs/instructions.md index 133bd2cb..c62fc3e8 100644 --- a/exercises/practice/acronym/.docs/instructions.md +++ b/exercises/practice/acronym/.docs/instructions.md @@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace) For example: -| Input | Output | -| ------------------------- | ------ | -| As Soon As Possible | ASAP | -| Liquid-crystal display | LCD | -| Thank George It's Friday! | TGIF | +|Input|Output| +|-|-| +|As Soon As Possible|ASAP| +|Liquid-crystal display|LCD| +|Thank George It's Friday!|TGIF| diff --git a/exercises/practice/affine-cipher/.docs/instructions.md b/exercises/practice/affine-cipher/.docs/instructions.md index 26ce1534..2ad6d152 100644 --- a/exercises/practice/affine-cipher/.docs/instructions.md +++ b/exercises/practice/affine-cipher/.docs/instructions.md @@ -6,7 +6,7 @@ The affine cipher is a type of monoalphabetic substitution cipher. Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value. Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys. -[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic " +[//]: # ( monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic ) ## Encryption @@ -23,7 +23,7 @@ Where: For the Roman alphabet `m` is `26`. - `a` and `b` are integers which make the encryption key -Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]). +Values `a` and `m` must be *coprime* (or, *relatively prime*) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]). In case `a` is not coprime to `m`, your program should indicate that this is an error. Otherwise it should encrypt or decrypt with the provided key. diff --git a/exercises/practice/all-your-base/.docs/instructions.md b/exercises/practice/all-your-base/.docs/instructions.md index 4602b5cf..d5a2cde6 100644 --- a/exercises/practice/all-your-base/.docs/instructions.md +++ b/exercises/practice/all-your-base/.docs/instructions.md @@ -14,20 +14,20 @@ Given a number in base **a**, represented as a sequence of digits, convert it to In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**. -The number 42, _in base 10_, means: +The number 42, *in base 10*, means: `(4 * 10^1) + (2 * 10^0)` -The number 101010, _in base 2_, means: +The number 101010, *in base 2*, means: `(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)` -The number 1120, _in base 3_, means: +The number 1120, *in base 3*, means: `(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)` I think you got the idea! -_Yes. Those three numbers above are exactly the same. Congratulations!_ +*Yes. Those three numbers above are exactly the same. Congratulations!* [positional-notation]: https://en.wikipedia.org/wiki/Positional_notation diff --git a/exercises/practice/allergies/.docs/instructions.md b/exercises/practice/allergies/.docs/instructions.md index daf8cfde..a1394920 100644 --- a/exercises/practice/allergies/.docs/instructions.md +++ b/exercises/practice/allergies/.docs/instructions.md @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say: - Whether Tom is allergic to any one of those allergens listed above. - All the allergens Tom is allergic to. -Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). +Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). Your program should ignore those components of the score. For example, if the allergy score is 257, your program should only report the eggs (1) allergy. diff --git a/exercises/practice/anagram/.meta/tests.toml b/exercises/practice/anagram/.meta/tests.toml index 4f43811d..8a3708bb 100644 --- a/exercises/practice/anagram/.meta/tests.toml +++ b/exercises/practice/anagram/.meta/tests.toml @@ -46,11 +46,6 @@ description = "detects anagrams using case-insensitive possible matches" [7cc195ad-e3c7-44ee-9fd2-d3c344806a2c] description = "does not detect an anagram if the original word is repeated" -include = false - -[630abb71-a94e-4715-8395-179ec1df9f91] -description = "does not detect an anagram if the original word is repeated" -reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c" [9878a1c9-d6ea-4235-ae51-3ea2befd6842] description = "anagrams must use all letters exactly once" diff --git a/exercises/practice/armstrong-numbers/.docs/instructions.md b/exercises/practice/armstrong-numbers/.docs/instructions.md index 5e56bbe4..744cfbe7 100644 --- a/exercises/practice/armstrong-numbers/.docs/instructions.md +++ b/exercises/practice/armstrong-numbers/.docs/instructions.md @@ -5,9 +5,9 @@ An [Armstrong number][armstrong-number] is a number that is the sum of its own d For example: - 9 is an Armstrong number, because `9 = 9^1 = 9` -- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1` +- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` -- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` +- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` Write some code to determine whether a number is an Armstrong number. diff --git a/exercises/practice/binary-search-tree/.meta/config.json b/exercises/practice/binary-search-tree/.meta/config.json index 2ff7123c..68c0364f 100644 --- a/exercises/practice/binary-search-tree/.meta/config.json +++ b/exercises/practice/binary-search-tree/.meta/config.json @@ -14,5 +14,6 @@ ] }, "blurb": "Insert and search for numbers in a binary tree.", - "source": "Josh Cheek" + "source": "Josh Cheek", + "source_url": "https://twitter.com/josh_cheek" } diff --git a/exercises/practice/binary-search/.docs/instructions.md b/exercises/practice/binary-search/.docs/instructions.md index 12f4358e..aa1946cf 100644 --- a/exercises/practice/binary-search/.docs/instructions.md +++ b/exercises/practice/binary-search/.docs/instructions.md @@ -11,7 +11,7 @@ Binary search only works when a list has been sorted. The algorithm looks like this: -- Find the middle element of a _sorted_ list and compare it with the item we're looking for. +- Find the middle element of a *sorted* list and compare it with the item we're looking for. - If the middle element is our item, then we're done! - If the middle element is greater than our item, we can eliminate that element and all the elements **after** it. - If the middle element is less than our item, we can eliminate that element and all the elements **before** it. diff --git a/exercises/practice/book-store/.docs/instructions.md b/exercises/practice/book-store/.docs/instructions.md index 54403f17..4ef76ab9 100644 --- a/exercises/practice/book-store/.docs/instructions.md +++ b/exercises/practice/book-store/.docs/instructions.md @@ -1,6 +1,6 @@ # Instructions -To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts on multiple book purchases. +To try and encourage more sales of different books from a popular 5 books series, a bookshop has decided to offer discounts on multiple book purchases. One copy of any of the five books costs $8. diff --git a/exercises/practice/circular-buffer/.docs/instructions.md b/exercises/practice/circular-buffer/.docs/instructions.md index 2ba1fda2..3487a0f6 100644 --- a/exercises/practice/circular-buffer/.docs/instructions.md +++ b/exercises/practice/circular-buffer/.docs/instructions.md @@ -4,55 +4,39 @@ A circular buffer, cyclic buffer or ring buffer is a data structure that uses a A circular buffer first starts empty and of some predefined length. For example, this is a 7-element buffer: - -```text -[ ][ ][ ][ ][ ][ ][ ] -``` + + [ ][ ][ ][ ][ ][ ][ ] Assume that a 1 is written into the middle of the buffer (exact starting location does not matter in a circular buffer): - -```text -[ ][ ][ ][1][ ][ ][ ] -``` + + [ ][ ][ ][1][ ][ ][ ] Then assume that two more elements are added — 2 & 3 — which get appended after the 1: - -```text -[ ][ ][ ][1][2][3][ ] -``` + + [ ][ ][ ][1][2][3][ ] If two elements are then removed from the buffer, the oldest values inside the buffer are removed. The two elements removed, in this case, are 1 & 2, leaving the buffer with just a 3: - -```text -[ ][ ][ ][ ][ ][3][ ] -``` + + [ ][ ][ ][ ][ ][3][ ] If the buffer has 7 elements then it is completely full: - -```text -[5][6][7][8][9][3][4] -``` + + [5][6][7][8][9][3][4] When the buffer is full an error will be raised, alerting the client that further writes are blocked until a slot becomes free. When the buffer is full, the client can opt to overwrite the oldest data with a forced write. In this case, two more elements — A & B — are added and they overwrite the 3 & 4: - -```text -[5][6][7][8][9][A][B] -``` + + [5][6][7][8][9][A][B] 3 & 4 have been replaced by A & B making 5 now the oldest data in the buffer. Finally, if two elements are removed then what would be returned is 5 & 6 yielding the buffer: - -```text -[ ][ ][7][8][9][A][B] -``` + + [ ][ ][7][8][9][A][B] Because there is space available, if the client again uses overwrite to store C & D then the space where 5 & 6 were stored previously will be used not the location of 7 & 8. 7 is still the oldest element and the buffer is once again full. - -```text -[C][D][7][8][9][A][B] -``` + + [C][D][7][8][9][A][B] diff --git a/exercises/practice/clock/.meta/config.json b/exercises/practice/clock/.meta/config.json index b5f3399b..3fbc5137 100644 --- a/exercises/practice/clock/.meta/config.json +++ b/exercises/practice/clock/.meta/config.json @@ -1,7 +1,5 @@ { - "authors": [ - "glaxxie" - ], + "authors": ["glaxxie"], "files": { "solution": [ "Clock.ps1" @@ -14,5 +12,6 @@ ] }, "blurb": "Implement a clock that handles times without dates.", - "source": "Pairing session with Erin Drummond" + "source": "Pairing session with Erin Drummond", + "source_url": "https://twitter.com/ebdrummond" } diff --git a/exercises/practice/custom-set/.meta/tests.toml b/exercises/practice/custom-set/.meta/tests.toml index 8c450e0b..4578354d 100644 --- a/exercises/practice/custom-set/.meta/tests.toml +++ b/exercises/practice/custom-set/.meta/tests.toml @@ -75,9 +75,6 @@ description = "Sets with the same elements are equal -> sets with different elem [06059caf-9bf4-425e-aaff-88966cb3ea14] description = "Sets with the same elements are equal -> set is not equal to larger set with same elements" -[d4a1142f-09aa-4df9-8b83-4437dcf7ec24] -description = "Sets with the same elements are equal -> set is equal to a set constructed from an array with duplicates" - [8a677c3c-a658-4d39-bb88-5b5b1a9659f4] description = "Unique elements can be added to a set -> add to empty set" diff --git a/exercises/practice/darts/.docs/instructions.md b/exercises/practice/darts/.docs/instructions.md index 5e57a860..70f0e53d 100644 --- a/exercises/practice/darts/.docs/instructions.md +++ b/exercises/practice/darts/.docs/instructions.md @@ -6,8 +6,6 @@ Write a function that returns the earned points in a single toss of a Darts game In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands: -![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg) - - If the dart lands outside the target, player earns no points (0 points). - If the dart lands in the outer circle of the target, player earns 1 point. - If the dart lands in the middle circle of the target, player earns 5 points. @@ -18,14 +16,8 @@ Of course, they are all centered at the same point — that is, the circles are Write a function that given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), returns the correct amount earned by a dart landing at that point. -## Credit - -The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape]. - [darts]: https://en.wikipedia.org/wiki/Darts [darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg [concentric]: https://mathworld.wolfram.com/ConcentricCircles.html [cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html [real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html -[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire -[inkscape]: https://en.wikipedia.org/wiki/Inkscape diff --git a/exercises/practice/dnd-character/.meta/tests.toml b/exercises/practice/dnd-character/.meta/tests.toml index 719043b2..2b04dd33 100644 --- a/exercises/practice/dnd-character/.meta/tests.toml +++ b/exercises/practice/dnd-character/.meta/tests.toml @@ -65,8 +65,3 @@ description = "random character is valid" [2ca77b9b-c099-46c3-a02c-0d0f68ffa0fe] description = "each ability is only calculated once" -include = false - -[dca2b2ec-f729-4551-84b9-078876bb4808] -description = "each ability is only calculated once" -reimplements = "2ca77b9b-c099-46c3-a02c-0d0f68ffa0fe" diff --git a/exercises/practice/error-handling/.docs/instructions.md b/exercises/practice/error-handling/.docs/instructions.md index 25dd4d29..a9806392 100644 --- a/exercises/practice/error-handling/.docs/instructions.md +++ b/exercises/practice/error-handling/.docs/instructions.md @@ -5,4 +5,4 @@ Implement various kinds of error handling and resource management. An important point of programming is how to handle errors and close resources even if errors occur. This exercise requires you to handle various errors. -Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required. +Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required. \ No newline at end of file diff --git a/exercises/practice/grains/.meta/tests.toml b/exercises/practice/grains/.meta/tests.toml index 6ea68bc0..1e5d4376 100644 --- a/exercises/practice/grains/.meta/tests.toml +++ b/exercises/practice/grains/.meta/tests.toml @@ -27,17 +27,11 @@ description = "returns the number of grains on the square -> grains on square 16 [acd81b46-c2ad-4951-b848-80d15ed5a04f] description = "returns the number of grains on the square -> grains on square 32" -[c73b470a-5efb-4d53-9ac6-c5f6487f227b] -description = "returns the number of grains on the square -> grains on square 64" - [1d47d832-3e85-4974-9466-5bd35af484e3] -description = "returns the number of grains on the square -> square 0 is invalid" +description = "returns the number of grains on the square -> square 0 raises an exception" [61974483-eeb2-465e-be54-ca5dde366453] -description = "returns the number of grains on the square -> negative square is invalid" +description = "returns the number of grains on the square -> negative square raises an exception" [a95e4374-f32c-45a7-a10d-ffec475c012f] -description = "returns the number of grains on the square -> square greater than 64 is invalid" - -[6eb07385-3659-4b45-a6be-9dc474222750] -description = "returns the total number of grains on the board" +description = "returns the number of grains on the square -> square greater than 64 raises an exception" diff --git a/exercises/practice/hello-world/.meta/config.json b/exercises/practice/hello-world/.meta/config.json index b50d55b0..7f9b729c 100644 --- a/exercises/practice/hello-world/.meta/config.json +++ b/exercises/practice/hello-world/.meta/config.json @@ -20,7 +20,7 @@ ".meta/HelloWorld.example.ps1" ] }, - "blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".", + "blurb": "The classical introductory exercise. Just say \"Hello, World!\".", "source": "This is an exercise to introduce users to using Exercism", "source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program" } diff --git a/exercises/practice/isbn-verifier/.meta/tests.toml b/exercises/practice/isbn-verifier/.meta/tests.toml index 6d5a8459..eaeb7d16 100644 --- a/exercises/practice/isbn-verifier/.meta/tests.toml +++ b/exercises/practice/isbn-verifier/.meta/tests.toml @@ -9,9 +9,6 @@ # As user-added comments (using the # character) will be removed when this file # is regenerated, comments can be added via a `comment` key. -[0caa3eac-d2e3-4c29-8df8-b188bc8c9292] -description = "valid isbn" - [19f76b53-7c24-45f8-87b8-4604d0ccd248] description = "invalid isbn check digit" diff --git a/exercises/practice/isogram/.docs/instructions.md b/exercises/practice/isogram/.docs/instructions.md index 2e8df851..5e488447 100644 --- a/exercises/practice/isogram/.docs/instructions.md +++ b/exercises/practice/isogram/.docs/instructions.md @@ -11,4 +11,4 @@ Examples of isograms: - downstream - six-year-old -The word _isograms_, however, is not an isogram, because the s repeats. +The word *isograms*, however, is not an isogram, because the s repeats. diff --git a/exercises/practice/isogram/.meta/tests.toml b/exercises/practice/isogram/.meta/tests.toml index ba04c664..56249453 100644 --- a/exercises/practice/isogram/.meta/tests.toml +++ b/exercises/practice/isogram/.meta/tests.toml @@ -47,6 +47,3 @@ description = "duplicated character in the middle" [310ac53d-8932-47bc-bbb4-b2b94f25a83e] description = "same first and last characters" - -[0d0b8644-0a1e-4a31-a432-2b3ee270d847] -description = "word with duplicated character and with two hyphens" diff --git a/exercises/practice/knapsack/.meta/tests.toml b/exercises/practice/knapsack/.meta/tests.toml index 8e013ef1..febc7b26 100644 --- a/exercises/practice/knapsack/.meta/tests.toml +++ b/exercises/practice/knapsack/.meta/tests.toml @@ -11,11 +11,6 @@ [a4d7d2f0-ad8a-460c-86f3-88ba709d41a7] description = "no items" -include = false - -[3993a824-c20e-493d-b3c9-ee8a7753ee59] -description = "no items" -reimplements = "a4d7d2f0-ad8a-460c-86f3-88ba709d41a7" [1d39e98c-6249-4a8b-912f-87cb12e506b0] description = "one item, too heavy" diff --git a/exercises/practice/leap/.docs/instructions.md b/exercises/practice/leap/.docs/instructions.md index b14f8565..a83826b2 100644 --- a/exercises/practice/leap/.docs/instructions.md +++ b/exercises/practice/leap/.docs/instructions.md @@ -1,3 +1,22 @@ # Instructions -Your task is to determine whether a given year is a leap year. +Given a year, report if it is a leap year. + +The tricky thing here is that a leap year in the Gregorian calendar occurs: + +```text +on every year that is evenly divisible by 4 + except every year that is evenly divisible by 100 + unless the year is also evenly divisible by 400 +``` + +For example, 1997 is not a leap year, but 1996 is. +1900 is not a leap year, but 2000 is. + +## Notes + +Though our exercise adopts some very simple rules, there is more to learn! + +For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video]. + +[video]: https://www.youtube.com/watch?v=xX96xng7sAE diff --git a/exercises/practice/leap/.docs/introduction.md b/exercises/practice/leap/.docs/introduction.md deleted file mode 100644 index 1cb8b14c..00000000 --- a/exercises/practice/leap/.docs/introduction.md +++ /dev/null @@ -1,16 +0,0 @@ -# Introduction - -A leap year (in the Gregorian calendar) occurs: - -- In every year that is evenly divisible by 4 -- Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. - -Some examples: - -- 1997 was not a leap year as it's not divisible by 4. -- 1900 was not a leap year as it's not divisible by 400 -- 2000 was a leap year! - -~~~~exercism/note -For a delightful, four minute explanation of the whole phenomenon of leap years, check out [this youtube video](https://www.youtube.com/watch?v=xX96xng7sAE). -~~~~ diff --git a/exercises/practice/leap/.meta/config.json b/exercises/practice/leap/.meta/config.json index 285016a2..4816bec5 100644 --- a/exercises/practice/leap/.meta/config.json +++ b/exercises/practice/leap/.meta/config.json @@ -18,7 +18,7 @@ ".meta/LeapYear.example.ps1" ] }, - "blurb": "Determine whether a given year is a leap year.", + "blurb": "Given a year, report if it is a leap year.", "source": "CodeRanch Cattle Drive, Assignment 3", "source_url": "https://coderanch.com/t/718816/Leap" } diff --git a/exercises/practice/list-ops/.docs/instructions.md b/exercises/practice/list-ops/.docs/instructions.md index ebc5dffe..ccfc2f8b 100644 --- a/exercises/practice/list-ops/.docs/instructions.md +++ b/exercises/practice/list-ops/.docs/instructions.md @@ -7,13 +7,13 @@ Implement a series of basic list operations, without using existing functions. The precise number and names of the operations to be implemented will be track dependent to avoid conflicts with existing names, but the general operations you will implement include: -- `append` (_given two lists, add all items in the second list to the end of the first list_); -- `concatenate` (_given a series of lists, combine all items in all lists into one flattened list_); -- `filter` (_given a predicate and a list, return the list of all items for which `predicate(item)` is True_); -- `length` (_given a list, return the total number of items within it_); -- `map` (_given a function and a list, return the list of the results of applying `function(item)` on all items_); -- `foldl` (_given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left_); -- `foldr` (_given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right_); -- `reverse` (_given a list, return a list with all the original items, but in reversed order_). +- `append` (*given two lists, add all items in the second list to the end of the first list*); +- `concatenate` (*given a series of lists, combine all items in all lists into one flattened list*); +- `filter` (*given a predicate and a list, return the list of all items for which `predicate(item)` is True*); +- `length` (*given a list, return the total number of items within it*); +- `map` (*given a function and a list, return the list of the results of applying `function(item)` on all items*); +- `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left*); +- `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right*); +- `reverse` (*given a list, return a list with all the original items, but in reversed order*). Note, the ordering in which arguments are passed to the fold functions (`foldl`, `foldr`) is significant. diff --git a/exercises/practice/meetup/.meta/config.json b/exercises/practice/meetup/.meta/config.json index 3cb4e8ee..e2655c40 100644 --- a/exercises/practice/meetup/.meta/config.json +++ b/exercises/practice/meetup/.meta/config.json @@ -1,7 +1,5 @@ { - "authors": [ - "glaxxie" - ], + "authors": ["glaxxie"], "files": { "solution": [ "Meetup.ps1" @@ -15,5 +13,5 @@ }, "blurb": "Calculate the date of meetups.", "source": "Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month", - "source_url": "http://www.copiousfreetime.org/" + "source_url": "https://twitter.com/copiousfreetime" } diff --git a/exercises/practice/perfect-numbers/.docs/instructions.md b/exercises/practice/perfect-numbers/.docs/instructions.md index b2bc82ca..0dae8867 100644 --- a/exercises/practice/perfect-numbers/.docs/instructions.md +++ b/exercises/practice/perfect-numbers/.docs/instructions.md @@ -1,39 +1,24 @@ # Instructions -Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers. - -The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of [perfect](#perfect), [abundant](#abundant), or [deficient](#deficient) based on their [aliquot sum][aliquot-sum]. -The _aliquot sum_ is defined as the sum of the factors of a number not including the number itself. -For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`. - -## Perfect - -A number is perfect when it equals its aliquot sum. -For example: - -- `6` is a perfect number because `1 + 2 + 3 = 6` -- `28` is a perfect number because `1 + 2 + 4 + 7 + 14 = 28` - -## Abundant - -A number is abundant when it is less than its aliquot sum. -For example: - -- `12` is an abundant number because `1 + 2 + 3 + 4 + 6 = 16` -- `24` is an abundant number because `1 + 2 + 3 + 4 + 6 + 8 + 12 = 36` - -## Deficient - -A number is deficient when it is greater than its aliquot sum. -For example: - -- `8` is a deficient number because `1 + 2 + 4 = 7` -- Prime numbers are deficient - -## Task - -Implement a way to determine whether a given number is [perfect](#perfect). -Depending on your language track, you may also need to implement a way to determine whether a given number is [abundant](#abundant) or [deficient](#deficient). +Determine if a number is perfect, abundant, or deficient based on +Nicomachus' (60 - 120 CE) classification scheme for positive integers. + +The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum][aliquot-sum]. +The aliquot sum is defined as the sum of the factors of a number not including the number itself. +For example, the aliquot sum of 15 is (1 + 3 + 5) = 9 + +- **Perfect**: aliquot sum = number + - 6 is a perfect number because (1 + 2 + 3) = 6 + - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 +- **Abundant**: aliquot sum > number + - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16 + - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36 +- **Deficient**: aliquot sum < number + - 8 is a deficient number because (1 + 2 + 4) = 7 + - Prime numbers are deficient + +Implement a way to determine whether a given number is **perfect**. +Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. [nicomachus]: https://en.wikipedia.org/wiki/Nicomachus [aliquot-sum]: https://en.wikipedia.org/wiki/Aliquot_sum diff --git a/exercises/practice/phone-number/.docs/instructions.md b/exercises/practice/phone-number/.docs/instructions.md index 62ba48e9..6d3275cd 100644 --- a/exercises/practice/phone-number/.docs/instructions.md +++ b/exercises/practice/phone-number/.docs/instructions.md @@ -5,20 +5,18 @@ Clean up user-entered phone numbers so that they can be sent SMS messages. The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`. -NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number. -The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_. +NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. +The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. The format is usually represented as ```text -NXX NXX-XXXX +(NXX)-NXX-XXXX ``` where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. -Sometimes they also have the country code (represented as `1` or `+1`) prefixed. - -Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present. +Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. For example, the inputs diff --git a/exercises/practice/poker/.meta/tests.toml b/exercises/practice/poker/.meta/tests.toml index 2e654ef6..76ac892d 100644 --- a/exercises/practice/poker/.meta/tests.toml +++ b/exercises/practice/poker/.meta/tests.toml @@ -21,18 +21,12 @@ description = "a tie has multiple winners" [61ed83a9-cfaa-40a5-942a-51f52f0a8725] description = "multiple hands with the same high cards, tie compares next highest ranked, down to last card" -[da01becd-f5b0-4342-b7f3-1318191d0580] -description = "winning high card hand also has the lowest card" - [f7175a89-34ff-44de-b3d7-f6fd97d1fca4] description = "one pair beats high card" [e114fd41-a301-4111-a9e7-5a7f72a76561] description = "highest pair wins" -[b3acd3a7-f9fa-4647-85ab-e0a9e07d1365] -description = "both hands have the same pair, high card wins" - [935bb4dc-a622-4400-97fa-86e7d06b1f76] description = "two pairs beats one pair" @@ -59,11 +53,6 @@ description = "both hands have three of a kind, tie goes to highest ranked tripl [eb856cc2-481c-4b0d-9835-4d75d07a5d9d] description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards" -include = false - -[26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1] -description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards" -reimplements = "eb856cc2-481c-4b0d-9835-4d75d07a5d9d" [a858c5d9-2f28-48e7-9980-b7fa04060a60] description = "a straight beats three of a kind" @@ -88,11 +77,6 @@ description = "flush beats a straight" [4d90261d-251c-49bd-a468-896bf10133de] description = "both hands have a flush, tie goes to high card, down to the last one if necessary" -include = false - -[e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff] -description = "both hands have a flush, tie goes to high card, down to the last one if necessary" -reimplements = "4d90261d-251c-49bd-a468-896bf10133de" [3a19361d-8974-455c-82e5-f7152f5dba7c] description = "full house beats a flush" diff --git a/exercises/practice/protein-translation/.docs/instructions.md b/exercises/practice/protein-translation/.docs/instructions.md index 7dc34d2e..d9b9054c 100644 --- a/exercises/practice/protein-translation/.docs/instructions.md +++ b/exercises/practice/protein-translation/.docs/instructions.md @@ -29,16 +29,16 @@ Note the stop codon `"UAA"` terminates the translation and the final methionine Below are the codons and resulting Amino Acids needed for the exercise. -| Codon | Protein | -| :----------------- | :------------ | -| AUG | Methionine | -| UUU, UUC | Phenylalanine | -| UUA, UUG | Leucine | -| UCU, UCC, UCA, UCG | Serine | -| UAU, UAC | Tyrosine | -| UGU, UGC | Cysteine | -| UGG | Tryptophan | -| UAA, UAG, UGA | STOP | +Codon | Protein +:--- | :--- +AUG | Methionine +UUU, UUC | Phenylalanine +UUA, UUG | Leucine +UCU, UCC, UCA, UCG | Serine +UAU, UAC | Tyrosine +UGU, UGC | Cysteine +UGG | Tryptophan +UAA, UAG, UGA | STOP Learn more about [protein translation on Wikipedia][protein-translation]. diff --git a/exercises/practice/pythagorean-triplet/.meta/config.json b/exercises/practice/pythagorean-triplet/.meta/config.json index 78fa451a..c6e754bb 100644 --- a/exercises/practice/pythagorean-triplet/.meta/config.json +++ b/exercises/practice/pythagorean-triplet/.meta/config.json @@ -13,7 +13,7 @@ ".meta/PythagoreanTriplet.example.ps1" ] }, - "blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the triplet.", + "blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.", "source": "Problem 9 at Project Euler", "source_url": "https://projecteuler.net/problem=9" } diff --git a/exercises/practice/queen-attack/.docs/instructions.md b/exercises/practice/queen-attack/.docs/instructions.md index 97f22a0a..ad7ea954 100644 --- a/exercises/practice/queen-attack/.docs/instructions.md +++ b/exercises/practice/queen-attack/.docs/instructions.md @@ -8,14 +8,18 @@ A chessboard can be represented by an 8 by 8 array. So if you are told the white queen is at `c5` (zero-indexed at column 2, row 3) and the black queen at `f2` (zero-indexed at column 5, row 6), then you know that the set-up is like so: -![A chess board with two queens. Arrows emanating from the queen at c5 indicate possible directions of capture along file, rank and diagonal.](https://assets.exercism.org/images/exercises/queen-attack/queen-capture.svg) +```text + a b c d e f g h +8 _ _ _ _ _ _ _ _ 8 +7 _ _ _ _ _ _ _ _ 7 +6 _ _ _ _ _ _ _ _ 6 +5 _ _ W _ _ _ _ _ 5 +4 _ _ _ _ _ _ _ _ 4 +3 _ _ _ _ _ _ _ _ 3 +2 _ _ _ _ _ B _ _ 2 +1 _ _ _ _ _ _ _ _ 1 + a b c d e f g h +``` You are also able to answer whether the queens can attack each other. In this case, that answer would be yes, they can, because both pieces share a diagonal. - -## Credit - -The chessboard image was made by [habere-et-dispertire][habere-et-dispertire] using LaTeX and the [chessboard package][chessboard-package] by Ulrike Fischer. - -[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire -[chessboard-package]: https://github.com/u-fischer/chessboard diff --git a/exercises/practice/rotational-cipher/.docs/instructions.md b/exercises/practice/rotational-cipher/.docs/instructions.md index 4bf64ca1..4dee51b3 100644 --- a/exercises/practice/rotational-cipher/.docs/instructions.md +++ b/exercises/practice/rotational-cipher/.docs/instructions.md @@ -22,8 +22,8 @@ Ciphertext is written out in the same formatting as the input including spaces a ## Examples -- ROT5 `omg` gives `trl` -- ROT0 `c` gives `c` +- ROT5 `omg` gives `trl` +- ROT0 `c` gives `c` - ROT26 `Cool` gives `Cool` - ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` - ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.` diff --git a/exercises/practice/rotational-cipher/.meta/tests.toml b/exercises/practice/rotational-cipher/.meta/tests.toml index 53441ed2..ce6d1105 100644 --- a/exercises/practice/rotational-cipher/.meta/tests.toml +++ b/exercises/practice/rotational-cipher/.meta/tests.toml @@ -24,9 +24,6 @@ description = "rotate m by 13" [19f9eb78-e2ad-4da4-8fe3-9291d47c1709] description = "rotate n by 13 with wrap around alphabet" -[a116aef4-225b-4da9-884f-e8023ca6408a] -description = "rotate capital letters" - [71b541bb-819c-4dc6-a9c3-132ef9bb737b] description = "rotate spaces" diff --git a/exercises/practice/series/.docs/instructions.md b/exercises/practice/series/.docs/instructions.md index fd97a670..e32cc38c 100644 --- a/exercises/practice/series/.docs/instructions.md +++ b/exercises/practice/series/.docs/instructions.md @@ -15,5 +15,5 @@ And the following 4-digit series: And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get. -Note that these series are only required to occupy _adjacent positions_ in the input; -the digits need not be _numerically consecutive_. +Note that these series are only required to occupy *adjacent positions* in the input; +the digits need not be *numerically consecutive*. diff --git a/exercises/practice/series/.meta/tests.toml b/exercises/practice/series/.meta/tests.toml index 9696f51f..064cd214 100644 --- a/exercises/practice/series/.meta/tests.toml +++ b/exercises/practice/series/.meta/tests.toml @@ -24,9 +24,6 @@ description = "slices of two overlap" [8e17148d-ba0a-4007-a07f-d7f87015d84c] description = "slices can include duplicates" -[bd5b085e-f612-4f81-97a8-6314258278b0] -description = "slices of a long series" - [6d235d85-46cf-4fae-9955-14b6efef27cd] description = "slice length is too large" diff --git a/exercises/practice/spiral-matrix/.meta/config.json b/exercises/practice/spiral-matrix/.meta/config.json index 3a1c3061..cacfb221 100644 --- a/exercises/practice/spiral-matrix/.meta/config.json +++ b/exercises/practice/spiral-matrix/.meta/config.json @@ -15,5 +15,5 @@ }, "blurb": "Given the size, return a square matrix of numbers in spiral order.", "source": "Reddit r/dailyprogrammer challenge #320 [Easy] Spiral Ascension.", - "source_url": "https://web.archive.org/web/20230607064729/https://old.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/" + "source_url": "https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/" } diff --git a/exercises/practice/strain/.meta/config.json b/exercises/practice/strain/.meta/config.json index 633ef21d..cbdd166d 100644 --- a/exercises/practice/strain/.meta/config.json +++ b/exercises/practice/strain/.meta/config.json @@ -1,7 +1,5 @@ { - "authors": [ - "glaxxie" - ], + "authors": ["glaxxie"], "files": { "solution": [ "Strain.ps1" @@ -15,5 +13,5 @@ }, "blurb": "Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.", "source": "Conversation with James Edward Gray II", - "source_url": "http://graysoftinc.com/" + "source_url": "https://twitter.com/jeg2" } diff --git a/exercises/practice/transpose/.meta/config.json b/exercises/practice/transpose/.meta/config.json index 86384239..232730b2 100644 --- a/exercises/practice/transpose/.meta/config.json +++ b/exercises/practice/transpose/.meta/config.json @@ -15,5 +15,5 @@ }, "blurb": "Take input text and output it transposed.", "source": "Reddit r/dailyprogrammer challenge #270 [Easy].", - "source_url": "https://web.archive.org/web/20230630051421/https://old.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text/" + "source_url": "https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text" } diff --git a/exercises/practice/yacht/.docs/instructions.md b/exercises/practice/yacht/.docs/instructions.md index 54fdb452..163ba379 100644 --- a/exercises/practice/yacht/.docs/instructions.md +++ b/exercises/practice/yacht/.docs/instructions.md @@ -6,24 +6,24 @@ The score of a throw of the dice depends on category chosen. ## Scores in Yacht -| Category | Score | Description | Example | -| --------------- | ---------------------- | ---------------------------------------- | ------------------- | -| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 | -| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 | -| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 | -| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 | -| Fives | 5 × number of fives | Any combination | 5 1 5 2 5 scores 15 | -| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 | -| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 | -| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 | -| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 | -| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 | -| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 | -| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 | +| Category | Score | Description | Example | +| -------- | ----- | ----------- | ------- | +| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 | +| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 | +| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 | +| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 | +| Fives | 5 × number of fives| Any combination | 5 1 5 2 5 scores 15 | +| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 | +| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 | +| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 | +| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 | +| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 | +| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 | +| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 | If the dice do not satisfy the requirements of a category, the score is zero. -If, for example, _Four Of A Kind_ is entered in the _Yacht_ category, zero points are scored. -A _Yacht_ scores zero if entered in the _Full House_ category. +If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero points are scored. +A *Yacht* scores zero if entered in the *Full House* category. ## Task diff --git a/exercises/practice/zipper/.docs/instructions.md b/exercises/practice/zipper/.docs/instructions.md index 5445db00..aa523a08 100644 --- a/exercises/practice/zipper/.docs/instructions.md +++ b/exercises/practice/zipper/.docs/instructions.md @@ -5,23 +5,21 @@ Creating a zipper for a binary tree. [Zippers][zipper] are a purely functional way of navigating within a data structure and manipulating it. They essentially contain a data structure and a pointer into that data structure (called the focus). -For example given a rose tree (where each node contains a value and a list of child nodes) a zipper might support these operations: +For example given a binary tree (a node contains a value and a its children nodes) a zipper might support these operations: -- `from_tree` (get a zipper out of a rose tree, the focus is on the root node) -- `to_tree` (get the rose tree out of the zipper) -- `value` (get the value of the focus node) -- `prev` (move the focus to the previous child of the same parent, - returns a new zipper) -- `next` (move the focus to the next child of the same parent, returns a - new zipper) -- `up` (move the focus to the parent, returns a new zipper) -- `set_value` (set the value of the focus node, returns a new zipper) -- `insert_before` (insert a new subtree before the focus node, it - becomes the `prev` of the focus node, returns a new zipper) -- `insert_after` (insert a new subtree after the focus node, it becomes - the `next` of the focus node, returns a new zipper) -- `delete` (removes the focus node and all subtrees, focus moves to the - `next` node if possible otherwise to the `prev` node if possible, - otherwise to the parent node, returns a new zipper) +- `FromTree` (get a zipper out of a binary tree, the focus is on the root node) +- `ToTree` (get the binary tree out of the zipper) +- `Value` (get the value of the focus node) +- `GoLeft` (move the focus to the left child node, returns a new zipper) +- `GoRight` (move the focus to the right child node, returns a new zipper) +- `GoUp` (move the focus to the parent, returns a new zipper) +- `SetValue` (set the value of the focus node, returns a new zipper) +- `SetLeft` (insert a new subtree before the focus node, it + becomes the `Left` of the focus node, returns a new zipper) +- `SetRight` (insert a new subtree after the focus node, it becomes + the `Right` of the focus node, returns a new zipper) +- `Delete` (removes the focus node and all subtrees, focus moves to the + `Right` node if possible otherwise to the `Left` node if possible, + otherwise to the parent node, returns a new zipper) (*This operation is optional) [zipper]: https://en.wikipedia.org/wiki/Zipper_%28data_structure%29 From 33875730966b8d9a9c0c5e7c33912b974a1d7e90 Mon Sep 17 00:00:00 2001 From: glaxxie <86179463+glaxxie@users.noreply.github.com> Date: Sun, 14 Jan 2024 17:10:44 -0600 Subject: [PATCH 3/3] update to make change only to docs --- .../practice/acronym/.docs/instructions.md | 10 ++-- .../affine-cipher/.docs/instructions.md | 4 +- .../all-your-base/.docs/instructions.md | 8 +-- .../practice/allergies/.docs/instructions.md | 2 +- .../armstrong-numbers/.docs/instructions.md | 4 +- .../binary-search/.docs/instructions.md | 2 +- .../practice/book-store/.docs/instructions.md | 2 +- .../circular-buffer/.docs/instructions.md | 48 +++++++++++------ .../practice/darts/.docs/instructions.md | 8 +++ .../error-handling/.docs/instructions.md | 2 +- .../practice/isogram/.docs/instructions.md | 2 +- exercises/practice/leap/.docs/instructions.md | 21 +------- exercises/practice/leap/.docs/introduction.md | 16 ++++++ .../practice/list-ops/.docs/instructions.md | 16 +++--- .../perfect-numbers/.docs/instructions.md | 53 ++++++++++++------- .../phone-number/.docs/instructions.md | 10 ++-- .../protein-translation/.docs/instructions.md | 20 +++---- .../queen-attack/.docs/instructions.md | 20 +++---- .../rotational-cipher/.docs/instructions.md | 4 +- .../practice/series/.docs/instructions.md | 4 +- .../practice/yacht/.docs/instructions.md | 32 +++++------ .../practice/zipper/.docs/instructions.md | 32 +++++------ 22 files changed, 178 insertions(+), 142 deletions(-) create mode 100644 exercises/practice/leap/.docs/introduction.md diff --git a/exercises/practice/acronym/.docs/instructions.md b/exercises/practice/acronym/.docs/instructions.md index c62fc3e8..133bd2cb 100644 --- a/exercises/practice/acronym/.docs/instructions.md +++ b/exercises/practice/acronym/.docs/instructions.md @@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace) For example: -|Input|Output| -|-|-| -|As Soon As Possible|ASAP| -|Liquid-crystal display|LCD| -|Thank George It's Friday!|TGIF| +| Input | Output | +| ------------------------- | ------ | +| As Soon As Possible | ASAP | +| Liquid-crystal display | LCD | +| Thank George It's Friday! | TGIF | diff --git a/exercises/practice/affine-cipher/.docs/instructions.md b/exercises/practice/affine-cipher/.docs/instructions.md index 2ad6d152..26ce1534 100644 --- a/exercises/practice/affine-cipher/.docs/instructions.md +++ b/exercises/practice/affine-cipher/.docs/instructions.md @@ -6,7 +6,7 @@ The affine cipher is a type of monoalphabetic substitution cipher. Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value. Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys. -[//]: # ( monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic ) +[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic " ## Encryption @@ -23,7 +23,7 @@ Where: For the Roman alphabet `m` is `26`. - `a` and `b` are integers which make the encryption key -Values `a` and `m` must be *coprime* (or, *relatively prime*) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]). +Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]). In case `a` is not coprime to `m`, your program should indicate that this is an error. Otherwise it should encrypt or decrypt with the provided key. diff --git a/exercises/practice/all-your-base/.docs/instructions.md b/exercises/practice/all-your-base/.docs/instructions.md index d5a2cde6..4602b5cf 100644 --- a/exercises/practice/all-your-base/.docs/instructions.md +++ b/exercises/practice/all-your-base/.docs/instructions.md @@ -14,20 +14,20 @@ Given a number in base **a**, represented as a sequence of digits, convert it to In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**. -The number 42, *in base 10*, means: +The number 42, _in base 10_, means: `(4 * 10^1) + (2 * 10^0)` -The number 101010, *in base 2*, means: +The number 101010, _in base 2_, means: `(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)` -The number 1120, *in base 3*, means: +The number 1120, _in base 3_, means: `(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)` I think you got the idea! -*Yes. Those three numbers above are exactly the same. Congratulations!* +_Yes. Those three numbers above are exactly the same. Congratulations!_ [positional-notation]: https://en.wikipedia.org/wiki/Positional_notation diff --git a/exercises/practice/allergies/.docs/instructions.md b/exercises/practice/allergies/.docs/instructions.md index a1394920..daf8cfde 100644 --- a/exercises/practice/allergies/.docs/instructions.md +++ b/exercises/practice/allergies/.docs/instructions.md @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say: - Whether Tom is allergic to any one of those allergens listed above. - All the allergens Tom is allergic to. -Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). +Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). Your program should ignore those components of the score. For example, if the allergy score is 257, your program should only report the eggs (1) allergy. diff --git a/exercises/practice/armstrong-numbers/.docs/instructions.md b/exercises/practice/armstrong-numbers/.docs/instructions.md index 744cfbe7..5e56bbe4 100644 --- a/exercises/practice/armstrong-numbers/.docs/instructions.md +++ b/exercises/practice/armstrong-numbers/.docs/instructions.md @@ -5,9 +5,9 @@ An [Armstrong number][armstrong-number] is a number that is the sum of its own d For example: - 9 is an Armstrong number, because `9 = 9^1 = 9` -- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` +- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1` - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` -- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` +- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` Write some code to determine whether a number is an Armstrong number. diff --git a/exercises/practice/binary-search/.docs/instructions.md b/exercises/practice/binary-search/.docs/instructions.md index aa1946cf..12f4358e 100644 --- a/exercises/practice/binary-search/.docs/instructions.md +++ b/exercises/practice/binary-search/.docs/instructions.md @@ -11,7 +11,7 @@ Binary search only works when a list has been sorted. The algorithm looks like this: -- Find the middle element of a *sorted* list and compare it with the item we're looking for. +- Find the middle element of a _sorted_ list and compare it with the item we're looking for. - If the middle element is our item, then we're done! - If the middle element is greater than our item, we can eliminate that element and all the elements **after** it. - If the middle element is less than our item, we can eliminate that element and all the elements **before** it. diff --git a/exercises/practice/book-store/.docs/instructions.md b/exercises/practice/book-store/.docs/instructions.md index 4ef76ab9..54403f17 100644 --- a/exercises/practice/book-store/.docs/instructions.md +++ b/exercises/practice/book-store/.docs/instructions.md @@ -1,6 +1,6 @@ # Instructions -To try and encourage more sales of different books from a popular 5 books series, a bookshop has decided to offer discounts on multiple book purchases. +To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts on multiple book purchases. One copy of any of the five books costs $8. diff --git a/exercises/practice/circular-buffer/.docs/instructions.md b/exercises/practice/circular-buffer/.docs/instructions.md index 3487a0f6..2ba1fda2 100644 --- a/exercises/practice/circular-buffer/.docs/instructions.md +++ b/exercises/practice/circular-buffer/.docs/instructions.md @@ -4,39 +4,55 @@ A circular buffer, cyclic buffer or ring buffer is a data structure that uses a A circular buffer first starts empty and of some predefined length. For example, this is a 7-element buffer: - - [ ][ ][ ][ ][ ][ ][ ] + +```text +[ ][ ][ ][ ][ ][ ][ ] +``` Assume that a 1 is written into the middle of the buffer (exact starting location does not matter in a circular buffer): - - [ ][ ][ ][1][ ][ ][ ] + +```text +[ ][ ][ ][1][ ][ ][ ] +``` Then assume that two more elements are added — 2 & 3 — which get appended after the 1: - - [ ][ ][ ][1][2][3][ ] + +```text +[ ][ ][ ][1][2][3][ ] +``` If two elements are then removed from the buffer, the oldest values inside the buffer are removed. The two elements removed, in this case, are 1 & 2, leaving the buffer with just a 3: - - [ ][ ][ ][ ][ ][3][ ] + +```text +[ ][ ][ ][ ][ ][3][ ] +``` If the buffer has 7 elements then it is completely full: - - [5][6][7][8][9][3][4] + +```text +[5][6][7][8][9][3][4] +``` When the buffer is full an error will be raised, alerting the client that further writes are blocked until a slot becomes free. When the buffer is full, the client can opt to overwrite the oldest data with a forced write. In this case, two more elements — A & B — are added and they overwrite the 3 & 4: - - [5][6][7][8][9][A][B] + +```text +[5][6][7][8][9][A][B] +``` 3 & 4 have been replaced by A & B making 5 now the oldest data in the buffer. Finally, if two elements are removed then what would be returned is 5 & 6 yielding the buffer: - - [ ][ ][7][8][9][A][B] + +```text +[ ][ ][7][8][9][A][B] +``` Because there is space available, if the client again uses overwrite to store C & D then the space where 5 & 6 were stored previously will be used not the location of 7 & 8. 7 is still the oldest element and the buffer is once again full. - - [C][D][7][8][9][A][B] + +```text +[C][D][7][8][9][A][B] +``` diff --git a/exercises/practice/darts/.docs/instructions.md b/exercises/practice/darts/.docs/instructions.md index 70f0e53d..5e57a860 100644 --- a/exercises/practice/darts/.docs/instructions.md +++ b/exercises/practice/darts/.docs/instructions.md @@ -6,6 +6,8 @@ Write a function that returns the earned points in a single toss of a Darts game In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands: +![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg) + - If the dart lands outside the target, player earns no points (0 points). - If the dart lands in the outer circle of the target, player earns 1 point. - If the dart lands in the middle circle of the target, player earns 5 points. @@ -16,8 +18,14 @@ Of course, they are all centered at the same point — that is, the circles are Write a function that given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), returns the correct amount earned by a dart landing at that point. +## Credit + +The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape]. + [darts]: https://en.wikipedia.org/wiki/Darts [darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg [concentric]: https://mathworld.wolfram.com/ConcentricCircles.html [cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html [real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html +[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire +[inkscape]: https://en.wikipedia.org/wiki/Inkscape diff --git a/exercises/practice/error-handling/.docs/instructions.md b/exercises/practice/error-handling/.docs/instructions.md index a9806392..25dd4d29 100644 --- a/exercises/practice/error-handling/.docs/instructions.md +++ b/exercises/practice/error-handling/.docs/instructions.md @@ -5,4 +5,4 @@ Implement various kinds of error handling and resource management. An important point of programming is how to handle errors and close resources even if errors occur. This exercise requires you to handle various errors. -Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required. \ No newline at end of file +Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required. diff --git a/exercises/practice/isogram/.docs/instructions.md b/exercises/practice/isogram/.docs/instructions.md index 5e488447..2e8df851 100644 --- a/exercises/practice/isogram/.docs/instructions.md +++ b/exercises/practice/isogram/.docs/instructions.md @@ -11,4 +11,4 @@ Examples of isograms: - downstream - six-year-old -The word *isograms*, however, is not an isogram, because the s repeats. +The word _isograms_, however, is not an isogram, because the s repeats. diff --git a/exercises/practice/leap/.docs/instructions.md b/exercises/practice/leap/.docs/instructions.md index a83826b2..b14f8565 100644 --- a/exercises/practice/leap/.docs/instructions.md +++ b/exercises/practice/leap/.docs/instructions.md @@ -1,22 +1,3 @@ # Instructions -Given a year, report if it is a leap year. - -The tricky thing here is that a leap year in the Gregorian calendar occurs: - -```text -on every year that is evenly divisible by 4 - except every year that is evenly divisible by 100 - unless the year is also evenly divisible by 400 -``` - -For example, 1997 is not a leap year, but 1996 is. -1900 is not a leap year, but 2000 is. - -## Notes - -Though our exercise adopts some very simple rules, there is more to learn! - -For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video]. - -[video]: https://www.youtube.com/watch?v=xX96xng7sAE +Your task is to determine whether a given year is a leap year. diff --git a/exercises/practice/leap/.docs/introduction.md b/exercises/practice/leap/.docs/introduction.md new file mode 100644 index 00000000..1cb8b14c --- /dev/null +++ b/exercises/practice/leap/.docs/introduction.md @@ -0,0 +1,16 @@ +# Introduction + +A leap year (in the Gregorian calendar) occurs: + +- In every year that is evenly divisible by 4 +- Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. + +Some examples: + +- 1997 was not a leap year as it's not divisible by 4. +- 1900 was not a leap year as it's not divisible by 400 +- 2000 was a leap year! + +~~~~exercism/note +For a delightful, four minute explanation of the whole phenomenon of leap years, check out [this youtube video](https://www.youtube.com/watch?v=xX96xng7sAE). +~~~~ diff --git a/exercises/practice/list-ops/.docs/instructions.md b/exercises/practice/list-ops/.docs/instructions.md index ccfc2f8b..ebc5dffe 100644 --- a/exercises/practice/list-ops/.docs/instructions.md +++ b/exercises/practice/list-ops/.docs/instructions.md @@ -7,13 +7,13 @@ Implement a series of basic list operations, without using existing functions. The precise number and names of the operations to be implemented will be track dependent to avoid conflicts with existing names, but the general operations you will implement include: -- `append` (*given two lists, add all items in the second list to the end of the first list*); -- `concatenate` (*given a series of lists, combine all items in all lists into one flattened list*); -- `filter` (*given a predicate and a list, return the list of all items for which `predicate(item)` is True*); -- `length` (*given a list, return the total number of items within it*); -- `map` (*given a function and a list, return the list of the results of applying `function(item)` on all items*); -- `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left*); -- `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right*); -- `reverse` (*given a list, return a list with all the original items, but in reversed order*). +- `append` (_given two lists, add all items in the second list to the end of the first list_); +- `concatenate` (_given a series of lists, combine all items in all lists into one flattened list_); +- `filter` (_given a predicate and a list, return the list of all items for which `predicate(item)` is True_); +- `length` (_given a list, return the total number of items within it_); +- `map` (_given a function and a list, return the list of the results of applying `function(item)` on all items_); +- `foldl` (_given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left_); +- `foldr` (_given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right_); +- `reverse` (_given a list, return a list with all the original items, but in reversed order_). Note, the ordering in which arguments are passed to the fold functions (`foldl`, `foldr`) is significant. diff --git a/exercises/practice/perfect-numbers/.docs/instructions.md b/exercises/practice/perfect-numbers/.docs/instructions.md index 0dae8867..b2bc82ca 100644 --- a/exercises/practice/perfect-numbers/.docs/instructions.md +++ b/exercises/practice/perfect-numbers/.docs/instructions.md @@ -1,24 +1,39 @@ # Instructions -Determine if a number is perfect, abundant, or deficient based on -Nicomachus' (60 - 120 CE) classification scheme for positive integers. - -The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum][aliquot-sum]. -The aliquot sum is defined as the sum of the factors of a number not including the number itself. -For example, the aliquot sum of 15 is (1 + 3 + 5) = 9 - -- **Perfect**: aliquot sum = number - - 6 is a perfect number because (1 + 2 + 3) = 6 - - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 -- **Abundant**: aliquot sum > number - - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16 - - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36 -- **Deficient**: aliquot sum < number - - 8 is a deficient number because (1 + 2 + 4) = 7 - - Prime numbers are deficient - -Implement a way to determine whether a given number is **perfect**. -Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. +Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers. + +The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of [perfect](#perfect), [abundant](#abundant), or [deficient](#deficient) based on their [aliquot sum][aliquot-sum]. +The _aliquot sum_ is defined as the sum of the factors of a number not including the number itself. +For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`. + +## Perfect + +A number is perfect when it equals its aliquot sum. +For example: + +- `6` is a perfect number because `1 + 2 + 3 = 6` +- `28` is a perfect number because `1 + 2 + 4 + 7 + 14 = 28` + +## Abundant + +A number is abundant when it is less than its aliquot sum. +For example: + +- `12` is an abundant number because `1 + 2 + 3 + 4 + 6 = 16` +- `24` is an abundant number because `1 + 2 + 3 + 4 + 6 + 8 + 12 = 36` + +## Deficient + +A number is deficient when it is greater than its aliquot sum. +For example: + +- `8` is a deficient number because `1 + 2 + 4 = 7` +- Prime numbers are deficient + +## Task + +Implement a way to determine whether a given number is [perfect](#perfect). +Depending on your language track, you may also need to implement a way to determine whether a given number is [abundant](#abundant) or [deficient](#deficient). [nicomachus]: https://en.wikipedia.org/wiki/Nicomachus [aliquot-sum]: https://en.wikipedia.org/wiki/Aliquot_sum diff --git a/exercises/practice/phone-number/.docs/instructions.md b/exercises/practice/phone-number/.docs/instructions.md index 6d3275cd..62ba48e9 100644 --- a/exercises/practice/phone-number/.docs/instructions.md +++ b/exercises/practice/phone-number/.docs/instructions.md @@ -5,18 +5,20 @@ Clean up user-entered phone numbers so that they can be sent SMS messages. The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`. -NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. -The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. +NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number. +The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_. The format is usually represented as ```text -(NXX)-NXX-XXXX +NXX NXX-XXXX ``` where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. -Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. +Sometimes they also have the country code (represented as `1` or `+1`) prefixed. + +Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present. For example, the inputs diff --git a/exercises/practice/protein-translation/.docs/instructions.md b/exercises/practice/protein-translation/.docs/instructions.md index d9b9054c..7dc34d2e 100644 --- a/exercises/practice/protein-translation/.docs/instructions.md +++ b/exercises/practice/protein-translation/.docs/instructions.md @@ -29,16 +29,16 @@ Note the stop codon `"UAA"` terminates the translation and the final methionine Below are the codons and resulting Amino Acids needed for the exercise. -Codon | Protein -:--- | :--- -AUG | Methionine -UUU, UUC | Phenylalanine -UUA, UUG | Leucine -UCU, UCC, UCA, UCG | Serine -UAU, UAC | Tyrosine -UGU, UGC | Cysteine -UGG | Tryptophan -UAA, UAG, UGA | STOP +| Codon | Protein | +| :----------------- | :------------ | +| AUG | Methionine | +| UUU, UUC | Phenylalanine | +| UUA, UUG | Leucine | +| UCU, UCC, UCA, UCG | Serine | +| UAU, UAC | Tyrosine | +| UGU, UGC | Cysteine | +| UGG | Tryptophan | +| UAA, UAG, UGA | STOP | Learn more about [protein translation on Wikipedia][protein-translation]. diff --git a/exercises/practice/queen-attack/.docs/instructions.md b/exercises/practice/queen-attack/.docs/instructions.md index ad7ea954..97f22a0a 100644 --- a/exercises/practice/queen-attack/.docs/instructions.md +++ b/exercises/practice/queen-attack/.docs/instructions.md @@ -8,18 +8,14 @@ A chessboard can be represented by an 8 by 8 array. So if you are told the white queen is at `c5` (zero-indexed at column 2, row 3) and the black queen at `f2` (zero-indexed at column 5, row 6), then you know that the set-up is like so: -```text - a b c d e f g h -8 _ _ _ _ _ _ _ _ 8 -7 _ _ _ _ _ _ _ _ 7 -6 _ _ _ _ _ _ _ _ 6 -5 _ _ W _ _ _ _ _ 5 -4 _ _ _ _ _ _ _ _ 4 -3 _ _ _ _ _ _ _ _ 3 -2 _ _ _ _ _ B _ _ 2 -1 _ _ _ _ _ _ _ _ 1 - a b c d e f g h -``` +![A chess board with two queens. Arrows emanating from the queen at c5 indicate possible directions of capture along file, rank and diagonal.](https://assets.exercism.org/images/exercises/queen-attack/queen-capture.svg) You are also able to answer whether the queens can attack each other. In this case, that answer would be yes, they can, because both pieces share a diagonal. + +## Credit + +The chessboard image was made by [habere-et-dispertire][habere-et-dispertire] using LaTeX and the [chessboard package][chessboard-package] by Ulrike Fischer. + +[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire +[chessboard-package]: https://github.com/u-fischer/chessboard diff --git a/exercises/practice/rotational-cipher/.docs/instructions.md b/exercises/practice/rotational-cipher/.docs/instructions.md index 4dee51b3..4bf64ca1 100644 --- a/exercises/practice/rotational-cipher/.docs/instructions.md +++ b/exercises/practice/rotational-cipher/.docs/instructions.md @@ -22,8 +22,8 @@ Ciphertext is written out in the same formatting as the input including spaces a ## Examples -- ROT5 `omg` gives `trl` -- ROT0 `c` gives `c` +- ROT5 `omg` gives `trl` +- ROT0 `c` gives `c` - ROT26 `Cool` gives `Cool` - ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` - ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.` diff --git a/exercises/practice/series/.docs/instructions.md b/exercises/practice/series/.docs/instructions.md index e32cc38c..fd97a670 100644 --- a/exercises/practice/series/.docs/instructions.md +++ b/exercises/practice/series/.docs/instructions.md @@ -15,5 +15,5 @@ And the following 4-digit series: And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get. -Note that these series are only required to occupy *adjacent positions* in the input; -the digits need not be *numerically consecutive*. +Note that these series are only required to occupy _adjacent positions_ in the input; +the digits need not be _numerically consecutive_. diff --git a/exercises/practice/yacht/.docs/instructions.md b/exercises/practice/yacht/.docs/instructions.md index 163ba379..54fdb452 100644 --- a/exercises/practice/yacht/.docs/instructions.md +++ b/exercises/practice/yacht/.docs/instructions.md @@ -6,24 +6,24 @@ The score of a throw of the dice depends on category chosen. ## Scores in Yacht -| Category | Score | Description | Example | -| -------- | ----- | ----------- | ------- | -| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 | -| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 | -| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 | -| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 | -| Fives | 5 × number of fives| Any combination | 5 1 5 2 5 scores 15 | -| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 | -| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 | -| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 | -| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 | -| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 | -| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 | -| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 | +| Category | Score | Description | Example | +| --------------- | ---------------------- | ---------------------------------------- | ------------------- | +| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 | +| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 | +| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 | +| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 | +| Fives | 5 × number of fives | Any combination | 5 1 5 2 5 scores 15 | +| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 | +| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 | +| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 | +| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 | +| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 | +| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 | +| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 | If the dice do not satisfy the requirements of a category, the score is zero. -If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero points are scored. -A *Yacht* scores zero if entered in the *Full House* category. +If, for example, _Four Of A Kind_ is entered in the _Yacht_ category, zero points are scored. +A _Yacht_ scores zero if entered in the _Full House_ category. ## Task diff --git a/exercises/practice/zipper/.docs/instructions.md b/exercises/practice/zipper/.docs/instructions.md index aa523a08..5445db00 100644 --- a/exercises/practice/zipper/.docs/instructions.md +++ b/exercises/practice/zipper/.docs/instructions.md @@ -5,21 +5,23 @@ Creating a zipper for a binary tree. [Zippers][zipper] are a purely functional way of navigating within a data structure and manipulating it. They essentially contain a data structure and a pointer into that data structure (called the focus). -For example given a binary tree (a node contains a value and a its children nodes) a zipper might support these operations: +For example given a rose tree (where each node contains a value and a list of child nodes) a zipper might support these operations: -- `FromTree` (get a zipper out of a binary tree, the focus is on the root node) -- `ToTree` (get the binary tree out of the zipper) -- `Value` (get the value of the focus node) -- `GoLeft` (move the focus to the left child node, returns a new zipper) -- `GoRight` (move the focus to the right child node, returns a new zipper) -- `GoUp` (move the focus to the parent, returns a new zipper) -- `SetValue` (set the value of the focus node, returns a new zipper) -- `SetLeft` (insert a new subtree before the focus node, it - becomes the `Left` of the focus node, returns a new zipper) -- `SetRight` (insert a new subtree after the focus node, it becomes - the `Right` of the focus node, returns a new zipper) -- `Delete` (removes the focus node and all subtrees, focus moves to the - `Right` node if possible otherwise to the `Left` node if possible, - otherwise to the parent node, returns a new zipper) (*This operation is optional) +- `from_tree` (get a zipper out of a rose tree, the focus is on the root node) +- `to_tree` (get the rose tree out of the zipper) +- `value` (get the value of the focus node) +- `prev` (move the focus to the previous child of the same parent, + returns a new zipper) +- `next` (move the focus to the next child of the same parent, returns a + new zipper) +- `up` (move the focus to the parent, returns a new zipper) +- `set_value` (set the value of the focus node, returns a new zipper) +- `insert_before` (insert a new subtree before the focus node, it + becomes the `prev` of the focus node, returns a new zipper) +- `insert_after` (insert a new subtree after the focus node, it becomes + the `next` of the focus node, returns a new zipper) +- `delete` (removes the focus node and all subtrees, focus moves to the + `next` node if possible otherwise to the `prev` node if possible, + otherwise to the parent node, returns a new zipper) [zipper]: https://en.wikipedia.org/wiki/Zipper_%28data_structure%29