From 9cdcd66b765727b89047bd2feb0977dd9e7dd32e Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Tue, 2 Jan 2024 15:23:38 +0000 Subject: [PATCH 1/2] sync docs and metadata --- .../perfect-numbers/.docs/instructions.md | 44 +++++++++++++------ .../pythagorean-triplet/.meta/config.json | 2 +- .../queen-attack/.docs/instructions.md | 20 ++++----- .../practice/spiral-matrix/.meta/config.json | 2 +- .../practice/transpose/.meta/config.json | 2 +- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/exercises/practice/perfect-numbers/.docs/instructions.md b/exercises/practice/perfect-numbers/.docs/instructions.md index 689a73c0..b2bc82ca 100644 --- a/exercises/practice/perfect-numbers/.docs/instructions.md +++ b/exercises/practice/perfect-numbers/.docs/instructions.md @@ -2,22 +2,38 @@ 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. +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**: 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**. +## 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/pythagorean-triplet/.meta/config.json b/exercises/practice/pythagorean-triplet/.meta/config.json index 99dc1155..59538085 100644 --- a/exercises/practice/pythagorean-triplet/.meta/config.json +++ b/exercises/practice/pythagorean-triplet/.meta/config.json @@ -17,7 +17,7 @@ ".meta/example.sh" ] }, - "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/spiral-matrix/.meta/config.json b/exercises/practice/spiral-matrix/.meta/config.json index 5d137e32..8ea4d841 100644 --- a/exercises/practice/spiral-matrix/.meta/config.json +++ b/exercises/practice/spiral-matrix/.meta/config.json @@ -19,5 +19,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/transpose/.meta/config.json b/exercises/practice/transpose/.meta/config.json index 2613def0..b7ee7acc 100644 --- a/exercises/practice/transpose/.meta/config.json +++ b/exercises/practice/transpose/.meta/config.json @@ -19,5 +19,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/" } From c38671ae087bbbaa41e47903feccf17b50131ac8 Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Tue, 2 Jan 2024 15:26:58 +0000 Subject: [PATCH 2/2] sync tests for dnd-character and knapsack --- .../practice/dnd-character/.meta/tests.toml | 52 ++++++++++++------- exercises/practice/knapsack/.meta/tests.toml | 18 +++++-- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/exercises/practice/dnd-character/.meta/tests.toml b/exercises/practice/dnd-character/.meta/tests.toml index 5d9d1aa3..404256bb 100644 --- a/exercises/practice/dnd-character/.meta/tests.toml +++ b/exercises/practice/dnd-character/.meta/tests.toml @@ -1,54 +1,61 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [1e9ae1dc-35bd-43ba-aa08-e4b94c20fa37] -description = "ability modifier for score 3 is -4" +description = "ability modifier -> ability modifier for score 3 is -4" [cc9bb24e-56b8-4e9e-989d-a0d1a29ebb9c] -description = "ability modifier for score 4 is -3" +description = "ability modifier -> ability modifier for score 4 is -3" [5b519fcd-6946-41ee-91fe-34b4f9808326] -description = "ability modifier for score 5 is -3" +description = "ability modifier -> ability modifier for score 5 is -3" [dc2913bd-6d7a-402e-b1e2-6d568b1cbe21] -description = "ability modifier for score 6 is -2" +description = "ability modifier -> ability modifier for score 6 is -2" [099440f5-0d66-4b1a-8a10-8f3a03cc499f] -description = "ability modifier for score 7 is -2" +description = "ability modifier -> ability modifier for score 7 is -2" [cfda6e5c-3489-42f0-b22b-4acb47084df0] -description = "ability modifier for score 8 is -1" +description = "ability modifier -> ability modifier for score 8 is -1" [c70f0507-fa7e-4228-8463-858bfbba1754] -description = "ability modifier for score 9 is -1" +description = "ability modifier -> ability modifier for score 9 is -1" [6f4e6c88-1cd9-46a0-92b8-db4a99b372f7] -description = "ability modifier for score 10 is 0" +description = "ability modifier -> ability modifier for score 10 is 0" [e00d9e5c-63c8-413f-879d-cd9be9697097] -description = "ability modifier for score 11 is 0" +description = "ability modifier -> ability modifier for score 11 is 0" [eea06f3c-8de0-45e7-9d9d-b8cab4179715] -description = "ability modifier for score 12 is +1" +description = "ability modifier -> ability modifier for score 12 is +1" [9c51f6be-db72-4af7-92ac-b293a02c0dcd] -description = "ability modifier for score 13 is +1" +description = "ability modifier -> ability modifier for score 13 is +1" [94053a5d-53b6-4efc-b669-a8b5098f7762] -description = "ability modifier for score 14 is +2" +description = "ability modifier -> ability modifier for score 14 is +2" [8c33e7ca-3f9f-4820-8ab3-65f2c9e2f0e2] -description = "ability modifier for score 15 is +2" +description = "ability modifier -> ability modifier for score 15 is +2" [c3ec871e-1791-44d0-b3cc-77e5fb4cd33d] -description = "ability modifier for score 16 is +3" +description = "ability modifier -> ability modifier for score 16 is +3" [3d053cee-2888-4616-b9fd-602a3b1efff4] -description = "ability modifier for score 17 is +3" +description = "ability modifier -> ability modifier for score 17 is +3" [bafd997a-e852-4e56-9f65-14b60261faee] -description = "ability modifier for score 18 is +4" +description = "ability modifier -> ability modifier for score 18 is +4" [4f28f19c-2e47-4453-a46a-c0d365259c14] description = "random ability is within range" @@ -58,3 +65,10 @@ 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" +include = false +comment = "generating a character merely outputs the abilities; there is no object that can be queried multiple times" diff --git a/exercises/practice/knapsack/.meta/tests.toml b/exercises/practice/knapsack/.meta/tests.toml index 5a7805b0..8e013ef1 100644 --- a/exercises/practice/knapsack/.meta/tests.toml +++ b/exercises/practice/knapsack/.meta/tests.toml @@ -1,9 +1,21 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [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"