diff --git a/config.json b/config.json index d762bfe..fc7552f 100644 --- a/config.json +++ b/config.json @@ -450,6 +450,14 @@ "prerequisites": [], "difficulty": 5 }, + { + "slug": "etl", + "name": "ETL", + "uuid": "2a5b0deb-bfee-4c43-9988-0d9f389d82fe", + "practices": [], + "prerequisites": [], + "difficulty": 5 + }, { "slug": "robot-simulator", "name": "Robot Simulator", diff --git a/exercises/practice/etl/.docs/instructions.md b/exercises/practice/etl/.docs/instructions.md new file mode 100644 index 0000000..802863b --- /dev/null +++ b/exercises/practice/etl/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +Your task is to change the data format of letters and their point values in the game. + +Currently, letters are stored in groups based on their score, in a one-to-many mapping. + +- 1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T", +- 2 points: "D", "G", +- 3 points: "B", "C", "M", "P", +- 4 points: "F", "H", "V", "W", "Y", +- 5 points: "K", +- 8 points: "J", "X", +- 10 points: "Q", "Z", + +This needs to be changed to store each individual letter with its score in a one-to-one mapping. + +- "a" is worth 1 point. +- "b" is worth 3 points. +- "c" is worth 3 points. +- "d" is worth 2 points. +- etc. + +As part of this change, the team has also decided to change the letters to be lower-case rather than upper-case. + +~~~~exercism/note +If you want to look at how the data was previously structured and how it needs to change, take a look at the examples in the test suite. +~~~~ diff --git a/exercises/practice/etl/.docs/introduction.md b/exercises/practice/etl/.docs/introduction.md new file mode 100644 index 0000000..5be6514 --- /dev/null +++ b/exercises/practice/etl/.docs/introduction.md @@ -0,0 +1,16 @@ +# Introduction + +You work for a company that makes an online multiplayer game called Lexiconia. + +To play the game, each player is given 13 letters, which they must rearrange to create words. +Different letters have different point values, since it's easier to create words with some letters than others. + +The game was originally launched in English, but it is very popular, and now the company wants to expand to other languages as well. + +Different languages need to support different point values for letters. +The point values are determined by how often letters are used, compared to other letters in that language. + +For example, the letter 'C' is quite common in English, and is only worth 3 points. +But in Norwegian it's a very rare letter, and is worth 10 points. + +To make it easier to add new languages, your team needs to change the way letters and their point values are stored in the game. diff --git a/exercises/practice/etl/.meta/config.json b/exercises/practice/etl/.meta/config.json new file mode 100644 index 0000000..bbadd65 --- /dev/null +++ b/exercises/practice/etl/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "erikschierboom" + ], + "files": { + "solution": [ + "etl.ua" + ], + "test": [ + "tests.ua" + ], + "example": [ + ".meta/example.ua" + ] + }, + "blurb": "Change the data format for scoring a game to more easily add other languages.", + "source": "Based on an exercise by the JumpstartLab team for students at The Turing School of Software and Design.", + "source_url": "https://turing.edu" +} diff --git a/exercises/practice/etl/.meta/example.ua b/exercises/practice/etl/.meta/example.ua new file mode 100644 index 0000000..f5a3b6f --- /dev/null +++ b/exercises/practice/etl/.meta/example.ua @@ -0,0 +1 @@ +Transform ← ⍜(°map)(⊃(⊏|⊏⊙⋅)⍏.≡(◇⊃(⊢|⋕↘1))/◇⊂⍚(⍚(⊂¯⌵:)↯⧻,)) diff --git a/exercises/practice/etl/.meta/tests.toml b/exercises/practice/etl/.meta/tests.toml new file mode 100644 index 0000000..e937107 --- /dev/null +++ b/exercises/practice/etl/.meta/tests.toml @@ -0,0 +1,22 @@ +# 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. + +[78a7a9f9-4490-4a47-8ee9-5a38bb47d28f] +description = "single letter" + +[60dbd000-451d-44c7-bdbb-97c73ac1f497] +description = "single score with multiple letters" + +[f5c5de0c-301f-4fdd-a0e5-df97d4214f54] +description = "multiple scores with multiple letters" + +[5db8ea89-ecb4-4dcd-902f-2b418cc87b9d] +description = "multiple scores with differing numbers of letters" diff --git a/exercises/practice/etl/etl.ua b/exercises/practice/etl/etl.ua new file mode 100644 index 0000000..9ef3db4 --- /dev/null +++ b/exercises/practice/etl/etl.ua @@ -0,0 +1,3 @@ +# Transform letter scores from the old to the new format +# NewMapping ? OldMapping +Transform ← |1 ⊙(⍤ "Please implement Transform" 0) diff --git a/exercises/practice/etl/tests.ua b/exercises/practice/etl/tests.ua new file mode 100644 index 0000000..99607d7 --- /dev/null +++ b/exercises/practice/etl/tests.ua @@ -0,0 +1,21 @@ +~ "etl.ua" ~ Transform + +# single letter +Input ← map {"1"} {"A"} +Expected ← map "a" 1 +⍤⤙≍ Expected Transform Input + +# single score with multiple letters +Input ← map {"1"} {"AEIOU"} +Expected ← map "aeiou" [1 1 1 1 1] +⍤⤙≍ Expected Transform Input + +# multiple scores with multiple letters +Input ← map {"1" "2"} {"AE" "DG"} +Expected ← map "adeg" [1 2 1 2] +⍤⤙≍ Expected Transform Input + +# multiple scores with differing numbers of letters +Input ← map {"1" "2" "3" "4" "5" "8" "10"} {"AEIOULNRST" "DG" "BCMP" "FHVWY" "K" "JX" "QZ"} +Expected ← map "abcdefghijklmnopqrstuvwxyz" [1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10] +⍤⤙≍ Expected Transform Input