From d98ef27c9aca50d6aaff9f1a6c0b5866888d54b6 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Fri, 31 Mar 2023 16:16:06 +0200 Subject: [PATCH 1/8] Rework sum-of-multiples documentation This PR is part of our project of making our Practice Exercises more consistent and human. For more context please see the following forum-thread: https://forum.exercism.org/t/new-project-making-practice-exercises-more-consistent-and-human-across-exercism/3943 The main change is to frame the exercise within the context of story. --- exercises/sum-of-multiples/description.md | 18 ---------------- exercises/sum-of-multiples/instructions.md | 25 ++++++++++++++++++++++ exercises/sum-of-multiples/introduction.md | 12 +++++++++++ 3 files changed, 37 insertions(+), 18 deletions(-) delete mode 100644 exercises/sum-of-multiples/description.md create mode 100644 exercises/sum-of-multiples/instructions.md create mode 100644 exercises/sum-of-multiples/introduction.md diff --git a/exercises/sum-of-multiples/description.md b/exercises/sum-of-multiples/description.md deleted file mode 100644 index f97111bfa3..0000000000 --- a/exercises/sum-of-multiples/description.md +++ /dev/null @@ -1,18 +0,0 @@ -# Description - -Given a list of factors and a limit, add up all the unique multiples of the factors that are less than the limit. -All inputs will be greater than or equal to zero. - -## Example - -Suppose the limit is 20 and the list of factors is [3, 5]. -We need to find the sum of all unique multiples of 3 and 5 that are less than 20. - -Multiples of 3 less than 20: 3, 6, 9, 12, 15, 18 -Multiples of 5 less than 20: 5, 10, 15 - -The unique multiples are: 3, 5, 6, 9, 10, 12, 15, 18 - -The sum of the unique multiples is: 3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 = 78 - -So, the answer is 78. diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md new file mode 100644 index 0000000000..d1294f7d2f --- /dev/null +++ b/exercises/sum-of-multiples/instructions.md @@ -0,0 +1,25 @@ +# Instructions + +Your task is to write the code that calculates the energy points that get awarded to players when they complete a level. + +The points awarded depend on two things: + +- the number of the level that the player completed +- the base value of each magical item collected by the player during that level + +The energy points are awarded according to the following rules: + +- For each magical item, take the base value and find all the multiples of that value that are less than or equal to the level number. +- Combine the sets of numbers. +- Remove any duplicates. +- Calculate the sum of all the numbers that are left. + +Let's look an example; + +- The player completed level 20 and found two magical items with base values of 3 and 5. +- To calculate the energy points earned by the player, we need to find all the unique multiples of these base values that are less than or equal to level 20. +- For the base value of 3, the multiples less than or equal to 20 are: 3, 6, 9, 12, 15, 18, and 20. +- For the base value of 5, the multiples less than or equal to 20 are: 5, 10, 15, and 20. +- To find the unique multiples, we can combine these two sets of multiples and remove any duplicates: `{3, 5, 6, 9, 10, 12, 15, 18, 20}` +- The sum of all these unique multiples is: `3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20 = 98` +- Therefore, the player earns **98** energy points for completing level 20 and finding the two magical items with base values of 3 and 5. diff --git a/exercises/sum-of-multiples/introduction.md b/exercises/sum-of-multiples/introduction.md new file mode 100644 index 0000000000..6f006dbc6c --- /dev/null +++ b/exercises/sum-of-multiples/introduction.md @@ -0,0 +1,12 @@ +# Introduction + +You work for a company that makes an online game called Enchanted Expeditions. + +The game is an adventure survival game. +Players need to travel through treacherous terrain in search of valuable resources. +As they explore, they collect materials like metals, fibers, and wood. +These can be used to craft tools, survival gear, and weapons. + +However, crafting requires a special type of magical energy that is only awarded when a player has completed a level. + +The amount of energy awarded depends on which magical items the player found while exploring that level. From c21722598621891ebf730ec16988610ef8cba2c5 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Sat, 1 Apr 2023 11:43:29 +0200 Subject: [PATCH 2/8] Simplify worked sum-of-multiples example --- exercises/sum-of-multiples/instructions.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md index d1294f7d2f..d9147458a0 100644 --- a/exercises/sum-of-multiples/instructions.md +++ b/exercises/sum-of-multiples/instructions.md @@ -16,10 +16,12 @@ The energy points are awarded according to the following rules: Let's look an example; -- The player completed level 20 and found two magical items with base values of 3 and 5. -- To calculate the energy points earned by the player, we need to find all the unique multiples of these base values that are less than or equal to level 20. -- For the base value of 3, the multiples less than or equal to 20 are: 3, 6, 9, 12, 15, 18, and 20. -- For the base value of 5, the multiples less than or equal to 20 are: 5, 10, 15, and 20. -- To find the unique multiples, we can combine these two sets of multiples and remove any duplicates: `{3, 5, 6, 9, 10, 12, 15, 18, 20}` -- The sum of all these unique multiples is: `3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20 = 98` +**The player completed level 20 and found two magical items with base values of 3 and 5.** + +To calculate the energy points earned by the player, we need to find all the unique multiples of these base values that are less than or equal to level 20. + +- Multiples of 3 up to 20: `{3, 6, 9, 12, 15, 18, 20}` +- Multiples of 5 up to 20: `{5, 10, 15, 20}` +- Combine the sets and remove duplicates: `{3, 5, 6, 9, 10, 12, 15, 18, 20}` +- Sum the unique multiples: `3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20 = 98` - Therefore, the player earns **98** energy points for completing level 20 and finding the two magical items with base values of 3 and 5. From 3ff7bbdaeb20372490993d23c5614cd792c979fb Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Sun, 2 Apr 2023 19:54:48 +0200 Subject: [PATCH 3/8] Update exercises/sum-of-multiples/instructions.md Co-authored-by: Peter Tseng --- exercises/sum-of-multiples/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md index d9147458a0..40f6e5c80b 100644 --- a/exercises/sum-of-multiples/instructions.md +++ b/exercises/sum-of-multiples/instructions.md @@ -20,7 +20,7 @@ Let's look an example; To calculate the energy points earned by the player, we need to find all the unique multiples of these base values that are less than or equal to level 20. -- Multiples of 3 up to 20: `{3, 6, 9, 12, 15, 18, 20}` +- Multiples of 3 up to 20: `{3, 6, 9, 12, 15, 18}` - Multiples of 5 up to 20: `{5, 10, 15, 20}` - Combine the sets and remove duplicates: `{3, 5, 6, 9, 10, 12, 15, 18, 20}` - Sum the unique multiples: `3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20 = 98` From 8b6e7898d49620a9dc638f2a55875eb4fe899b44 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 3 Apr 2023 08:55:26 +0200 Subject: [PATCH 4/8] Update exercises/sum-of-multiples/instructions.md Co-authored-by: Derk-Jan Karrenbeld --- exercises/sum-of-multiples/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md index 40f6e5c80b..765d827881 100644 --- a/exercises/sum-of-multiples/instructions.md +++ b/exercises/sum-of-multiples/instructions.md @@ -4,7 +4,7 @@ Your task is to write the code that calculates the energy points that get awarde The points awarded depend on two things: -- the number of the level that the player completed +- the level (as number) that the player completed - the base value of each magical item collected by the player during that level The energy points are awarded according to the following rules: From a6e07a01963c871bc021f1fef1e423a75bec0a08 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 3 Apr 2023 08:55:46 +0200 Subject: [PATCH 5/8] Update exercises/sum-of-multiples/instructions.md Co-authored-by: Derk-Jan Karrenbeld --- exercises/sum-of-multiples/instructions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md index 765d827881..3c691f8cbe 100644 --- a/exercises/sum-of-multiples/instructions.md +++ b/exercises/sum-of-multiples/instructions.md @@ -9,10 +9,10 @@ The points awarded depend on two things: The energy points are awarded according to the following rules: -- For each magical item, take the base value and find all the multiples of that value that are less than or equal to the level number. -- Combine the sets of numbers. -- Remove any duplicates. -- Calculate the sum of all the numbers that are left. +1. For each magical item, take the base value and find all the multiples of that value that are less than or equal to the level number. +2. Combine the sets of numbers. +3. Remove any duplicates. +4. Calculate the sum of all the numbers that are left. Let's look an example; From 7743045b49c5f74ca6696adffbc0970bf3b89032 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 10 Apr 2023 13:53:56 +0200 Subject: [PATCH 6/8] Update exercises/sum-of-multiples/introduction.md Co-authored-by: Jeremy Walker --- exercises/sum-of-multiples/introduction.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/exercises/sum-of-multiples/introduction.md b/exercises/sum-of-multiples/introduction.md index 6f006dbc6c..69cabeed5a 100644 --- a/exercises/sum-of-multiples/introduction.md +++ b/exercises/sum-of-multiples/introduction.md @@ -1,12 +1,6 @@ # Introduction -You work for a company that makes an online game called Enchanted Expeditions. - -The game is an adventure survival game. -Players need to travel through treacherous terrain in search of valuable resources. -As they explore, they collect materials like metals, fibers, and wood. -These can be used to craft tools, survival gear, and weapons. - -However, crafting requires a special type of magical energy that is only awarded when a player has completed a level. +You work for a company that makes an online, fantasy-survival game. +When a player finishes a level, they are awarded energy points. The amount of energy awarded depends on which magical items the player found while exploring that level. From fd627c15d43122ea063581e085097d3cc440a4e8 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 10 Apr 2023 13:56:48 +0200 Subject: [PATCH 7/8] Update exercises/sum-of-multiples/instructions.md Co-authored-by: Isaac Good --- exercises/sum-of-multiples/instructions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md index 3c691f8cbe..30ac5485c2 100644 --- a/exercises/sum-of-multiples/instructions.md +++ b/exercises/sum-of-multiples/instructions.md @@ -4,8 +4,8 @@ Your task is to write the code that calculates the energy points that get awarde The points awarded depend on two things: -- the level (as number) that the player completed -- the base value of each magical item collected by the player during that level +- The level (a number) that the player completed. +- The base value of each magical item collected by the player during that level. The energy points are awarded according to the following rules: From 846a36886d2ebddc9a5185576e7d3249dc3e7c6f Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 10 Apr 2023 13:56:56 +0200 Subject: [PATCH 8/8] Update exercises/sum-of-multiples/instructions.md Co-authored-by: Isaac Good --- exercises/sum-of-multiples/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/sum-of-multiples/instructions.md b/exercises/sum-of-multiples/instructions.md index 30ac5485c2..9c824bf1d5 100644 --- a/exercises/sum-of-multiples/instructions.md +++ b/exercises/sum-of-multiples/instructions.md @@ -14,7 +14,7 @@ The energy points are awarded according to the following rules: 3. Remove any duplicates. 4. Calculate the sum of all the numbers that are left. -Let's look an example; +Let's look an example: **The player completed level 20 and found two magical items with base values of 3 and 5.**