From 5b299b5b6271db734d835f4901986cc4aff65948 Mon Sep 17 00:00:00 2001 From: J R M Date: Fri, 30 Jan 2026 15:38:58 +0100 Subject: [PATCH 1/4] collatz --- .../collatz-conjecture/.docs/instructions.md | 3 ++ .../collatz-conjecture/.docs/introduction.md | 28 ++++++++++++++ .../collatz-conjecture/.meta/config.json | 19 ++++++++++ .../collatz-conjecture/.meta/example.nu | 17 +++++++++ .../collatz-conjecture/.meta/tests.toml | 38 +++++++++++++++++++ .../collatz-conjecture/collatz-conjecture.nu | 3 ++ .../practice/collatz-conjecture/tests.nu | 18 +++++++++ 7 files changed, 126 insertions(+) create mode 100644 exercises/practice/collatz-conjecture/.docs/instructions.md create mode 100644 exercises/practice/collatz-conjecture/.docs/introduction.md create mode 100644 exercises/practice/collatz-conjecture/.meta/config.json create mode 100644 exercises/practice/collatz-conjecture/.meta/example.nu create mode 100644 exercises/practice/collatz-conjecture/.meta/tests.toml create mode 100644 exercises/practice/collatz-conjecture/collatz-conjecture.nu create mode 100644 exercises/practice/collatz-conjecture/tests.nu diff --git a/exercises/practice/collatz-conjecture/.docs/instructions.md b/exercises/practice/collatz-conjecture/.docs/instructions.md new file mode 100644 index 0000000..af332a8 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.docs/instructions.md @@ -0,0 +1,3 @@ +# Instructions + +Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture. diff --git a/exercises/practice/collatz-conjecture/.docs/introduction.md b/exercises/practice/collatz-conjecture/.docs/introduction.md new file mode 100644 index 0000000..c35bdeb --- /dev/null +++ b/exercises/practice/collatz-conjecture/.docs/introduction.md @@ -0,0 +1,28 @@ +# Introduction + +One evening, you stumbled upon an old notebook filled with cryptic scribbles, as though someone had been obsessively chasing an idea. +On one page, a single question stood out: **Can every number find its way to 1?** +It was tied to something called the **Collatz Conjecture**, a puzzle that has baffled thinkers for decades. + +The rules were deceptively simple. +Pick any positive integer. + +- If it's even, divide it by 2. +- If it's odd, multiply it by 3 and add 1. + +Then, repeat these steps with the result, continuing indefinitely. + +Curious, you picked number 12 to test and began the journey: + +12 ➜ 6 ➜ 3 ➜ 10 ➜ 5 ➜ 16 ➜ 8 ➜ 4 ➜ 2 ➜ 1 + +Counting from the second number (6), it took 9 steps to reach 1, and each time the rules repeated, the number kept changing. +At first, the sequence seemed unpredictable — jumping up, down, and all over. +Yet, the conjecture claims that no matter the starting number, we'll always end at 1. + +It was fascinating, but also puzzling. +Why does this always seem to work? +Could there be a number where the process breaks down, looping forever or escaping into infinity? +The notebook suggested solving this could reveal something profound — and with it, fame, [fortune][collatz-prize], and a place in history awaits whoever could unlock its secrets. + +[collatz-prize]: https://mathprize.net/posts/collatz-conjecture/ diff --git a/exercises/practice/collatz-conjecture/.meta/config.json b/exercises/practice/collatz-conjecture/.meta/config.json new file mode 100644 index 0000000..1b6fb58 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "quintuple-mallard" + ], + "files": { + "solution": [ + "collatz-conjecture.nu" + ], + "test": [ + "tests.nu" + ], + "example": [ + ".meta/example.nu" + ] + }, + "blurb": "Calculate the number of steps to reach 1 using the Collatz conjecture.", + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Collatz_conjecture" +} diff --git a/exercises/practice/collatz-conjecture/.meta/example.nu b/exercises/practice/collatz-conjecture/.meta/example.nu new file mode 100644 index 0000000..f9c1887 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/example.nu @@ -0,0 +1,17 @@ +export def steps [number] { + if $number <= 0 { + error make {msg: "Only positive integers are allowed"} + } + mut number = $number + mut steps = 0 + while $number != 1 { + $steps += 1 + if ($number mod 2) == 1 { + $number *= 3 + $number += 1 + } else { + $number /= 2 + } + } + $steps +} diff --git a/exercises/practice/collatz-conjecture/.meta/tests.toml b/exercises/practice/collatz-conjecture/.meta/tests.toml new file mode 100644 index 0000000..cc34e16 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/tests.toml @@ -0,0 +1,38 @@ +# 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. + +[540a3d51-e7a6-47a5-92a3-4ad1838f0bfd] +description = "zero steps for one" + +[3d76a0a6-ea84-444a-821a-f7857c2c1859] +description = "divide if even" + +[754dea81-123c-429e-b8bc-db20b05a87b9] +description = "even and odd steps" + +[ecfd0210-6f85-44f6-8280-f65534892ff6] +description = "large number of even and odd steps" + +[7d4750e6-def9-4b86-aec7-9f7eb44f95a3] +description = "zero is an error" +include = false + +[2187673d-77d6-4543-975e-66df6c50e2da] +description = "zero is an error" +reimplements = "7d4750e6-def9-4b86-aec7-9f7eb44f95a3" + +[c6c795bf-a288-45e9-86a1-841359ad426d] +description = "negative value is an error" +include = false + +[ec11f479-56bc-47fd-a434-bcd7a31a7a2e] +description = "negative value is an error" +reimplements = "c6c795bf-a288-45e9-86a1-841359ad426d" diff --git a/exercises/practice/collatz-conjecture/collatz-conjecture.nu b/exercises/practice/collatz-conjecture/collatz-conjecture.nu new file mode 100644 index 0000000..86b2f77 --- /dev/null +++ b/exercises/practice/collatz-conjecture/collatz-conjecture.nu @@ -0,0 +1,3 @@ +export def steps [number] { + error make {msg: "Please implement steps"} +} diff --git a/exercises/practice/collatz-conjecture/tests.nu b/exercises/practice/collatz-conjecture/tests.nu new file mode 100644 index 0000000..a986b00 --- /dev/null +++ b/exercises/practice/collatz-conjecture/tests.nu @@ -0,0 +1,18 @@ +use collatz-conjecture.nu steps +use std/assert +# zero steps for one +assert equal (steps 1) 0 +# divide if even +assert equal (steps 16) 4 +# even and odd steps +assert equal (steps 12) 9 +# large number of even and odd steps +assert equal (steps 1000000) 152 +# zero is an error +assert equal (try { steps 0 } catch {|e| + $e.msg +}) "Only positive integers are allowed" +# negative value is an error +assert equal (try { steps (-15) } catch {|e| + $e.msg +}) "Only positive integers are allowed" From 2edb6e7ae0251d3d98e3e86471cb282507950980 Mon Sep 17 00:00:00 2001 From: J R M Date: Fri, 30 Jan 2026 15:39:50 +0100 Subject: [PATCH 2/4] difficulty --- config.json | 10 +++- .../simple-cipher/.docs/instructions.md | 40 ++++++++++++++++ .../practice/simple-cipher/.meta/config.json | 19 ++++++++ .../practice/simple-cipher/.meta/example.nu | 0 .../practice/simple-cipher/.meta/tests.toml | 46 +++++++++++++++++++ exercises/practice/simple-cipher/TODO | 1 + .../practice/simple-cipher/simple-cipher.nu | 13 ++++++ exercises/practice/simple-cipher/tests.nu | 0 8 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 exercises/practice/simple-cipher/.docs/instructions.md create mode 100644 exercises/practice/simple-cipher/.meta/config.json create mode 100644 exercises/practice/simple-cipher/.meta/example.nu create mode 100644 exercises/practice/simple-cipher/.meta/tests.toml create mode 100644 exercises/practice/simple-cipher/TODO create mode 100644 exercises/practice/simple-cipher/simple-cipher.nu create mode 100644 exercises/practice/simple-cipher/tests.nu diff --git a/config.json b/config.json index 7ed89e4..a550e73 100644 --- a/config.json +++ b/config.json @@ -117,6 +117,14 @@ "practices": [], "prerequisites": [], "difficulty": 6 + }, + { + "slug": "collatz-conjecture", + "name": "Collatz Conjecture", + "uuid": "dc42f98e-d0fe-4c0f-ab4d-1954cf839ea8", + "practices": [], + "prerequisites": [], + "difficulty": 2 } ] }, @@ -130,4 +138,4 @@ "typing/static", "used_for/scripts" ] -} +} \ No newline at end of file diff --git a/exercises/practice/simple-cipher/.docs/instructions.md b/exercises/practice/simple-cipher/.docs/instructions.md new file mode 100644 index 0000000..afd0b57 --- /dev/null +++ b/exercises/practice/simple-cipher/.docs/instructions.md @@ -0,0 +1,40 @@ +# Instructions + +Create an implementation of the [Vigenère cipher][wiki]. +The Vigenère cipher is a simple substitution cipher. + +## Cipher terminology + +A cipher is an algorithm used to encrypt, or encode, a string. +The unencrypted string is called the _plaintext_ and the encrypted string is called the _ciphertext_. +Converting plaintext to ciphertext is called _encoding_ while the reverse is called _decoding_. + +In a _substitution cipher_, each plaintext letter is replaced with a ciphertext letter which is computed with the help of a _key_. +(Note, it is possible for replacement letter to be the same as the original letter.) + +## Encoding details + +In this cipher, the key is a series of lowercase letters, such as `"abcd"`. +Each letter of the plaintext is _shifted_ or _rotated_ by a distance based on a corresponding letter in the key. +An `"a"` in the key means a shift of 0 (that is, no shift). +A `"b"` in the key means a shift of 1. +A `"c"` in the key means a shift of 2, and so on. + +The first letter of the plaintext uses the first letter of the key, the second letter of the plaintext uses the second letter of the key and so on. +If you run out of letters in the key before you run out of letters in the plaintext, start over from the start of the key again. + +If the key only contains one letter, such as `"dddddd"`, then all letters of the plaintext are shifted by the same amount (three in this example), which would make this the same as a rotational cipher or shift cipher (sometimes called a Caesar cipher). +For example, the plaintext `"iamapandabear"` would become `"ldpdsdqgdehdu"`. + +If the key only contains the letter `"a"` (one or more times), the shift distance is zero and the ciphertext is the same as the plaintext. + +Usually the key is more complicated than that, though! +If the key is `"abcd"` then letters of the plaintext would be shifted by a distance of 0, 1, 2, and 3. +If the plaintext is `"hello"`, we need 5 shifts so the key would wrap around, giving shift distances of 0, 1, 2, 3, and 0. +Applying those shifts to the letters of `"hello"` we get `"hfnoo"`. + +## Random keys + +If no key is provided, generate a key which consists of at least 100 random lowercase letters from the Latin alphabet. + +[wiki]: https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher diff --git a/exercises/practice/simple-cipher/.meta/config.json b/exercises/practice/simple-cipher/.meta/config.json new file mode 100644 index 0000000..bbb27b7 --- /dev/null +++ b/exercises/practice/simple-cipher/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "quintuple-mallard" + ], + "files": { + "solution": [ + "simple-cipher.nu" + ], + "test": [ + "tests.nu" + ], + "example": [ + ".meta/example.nu" + ] + }, + "blurb": "Implement the Vigenère cipher, a simple substitution cipher.", + "source": "Substitution Cipher at Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Substitution_cipher" +} diff --git a/exercises/practice/simple-cipher/.meta/example.nu b/exercises/practice/simple-cipher/.meta/example.nu new file mode 100644 index 0000000..e69de29 diff --git a/exercises/practice/simple-cipher/.meta/tests.toml b/exercises/practice/simple-cipher/.meta/tests.toml new file mode 100644 index 0000000..77e6571 --- /dev/null +++ b/exercises/practice/simple-cipher/.meta/tests.toml @@ -0,0 +1,46 @@ +# 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. + +[b8bdfbe1-bea3-41bb-a999-b41403f2b15d] +description = "Random key cipher -> Can encode" + +[3dff7f36-75db-46b4-ab70-644b3f38b81c] +description = "Random key cipher -> Can decode" + +[8143c684-6df6-46ba-bd1f-dea8fcb5d265] +description = "Random key cipher -> Is reversible. I.e., if you apply decode in a encoded result, you must see the same plaintext encode parameter as a result of the decode method" + +[defc0050-e87d-4840-85e4-51a1ab9dd6aa] +description = "Random key cipher -> Key is made only of lowercase letters" + +[565e5158-5b3b-41dd-b99d-33b9f413c39f] +description = "Substitution cipher -> Can encode" + +[d44e4f6a-b8af-4e90-9d08-fd407e31e67b] +description = "Substitution cipher -> Can decode" + +[70a16473-7339-43df-902d-93408c69e9d1] +description = "Substitution cipher -> Is reversible. I.e., if you apply decode in a encoded result, you must see the same plaintext encode parameter as a result of the decode method" + +[69a1458b-92a6-433a-a02d-7beac3ea91f9] +description = "Substitution cipher -> Can double shift encode" + +[21d207c1-98de-40aa-994f-86197ae230fb] +description = "Substitution cipher -> Can wrap on encode" + +[a3d7a4d7-24a9-4de6-bdc4-a6614ced0cb3] +description = "Substitution cipher -> Can wrap on decode" + +[e31c9b8c-8eb6-45c9-a4b5-8344a36b9641] +description = "Substitution cipher -> Can encode messages longer than the key" + +[93cfaae0-17da-4627-9a04-d6d1e1be52e3] +description = "Substitution cipher -> Can decode messages longer than the key" diff --git a/exercises/practice/simple-cipher/TODO b/exercises/practice/simple-cipher/TODO new file mode 100644 index 0000000..cf56e8e --- /dev/null +++ b/exercises/practice/simple-cipher/TODO @@ -0,0 +1 @@ +remove this file when implementation is done diff --git a/exercises/practice/simple-cipher/simple-cipher.nu b/exercises/practice/simple-cipher/simple-cipher.nu new file mode 100644 index 0000000..3f792f6 --- /dev/null +++ b/exercises/practice/simple-cipher/simple-cipher.nu @@ -0,0 +1,13 @@ +def caesar_cipher [text, shift] { + text | split chars | each {|c| + if ($c =~ "[A-Z]") { + char --integer (((($c | encode hex | into int --radix 16) + shift) - ('A'| encode hex | into int --radix 16)) mod 26 + ('A'| encode hex | into int --radix 16)); + + } else if ($c =~ "[a-z]") { + char --integer (((($c | encode hex | into int --radix 16) + shift) - ('a'| encode hex | into int --radix 16)) mod 26 + ('a'| encode hex | into int --radix 16)); + + } else { + $c + } + } | str join +} diff --git a/exercises/practice/simple-cipher/tests.nu b/exercises/practice/simple-cipher/tests.nu new file mode 100644 index 0000000..e69de29 From af424b112ef3d3e0d9a3ac32e8468f6f670c95bb Mon Sep 17 00:00:00 2001 From: J R M Date: Fri, 30 Jan 2026 16:42:27 +0100 Subject: [PATCH 3/4] configlet fmt --- config.json | 2 +- exercises/practice/resistor-color-duo/.meta/config.json | 3 +-- exercises/practice/resistor-color-trio/.meta/config.json | 3 +-- exercises/practice/resistor-color/.meta/config.json | 3 +-- exercises/practice/strain/.meta/config.json | 3 +-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/config.json b/config.json index a550e73..8932b17 100644 --- a/config.json +++ b/config.json @@ -138,4 +138,4 @@ "typing/static", "used_for/scripts" ] -} \ No newline at end of file +} diff --git a/exercises/practice/resistor-color-duo/.meta/config.json b/exercises/practice/resistor-color-duo/.meta/config.json index 04c0bd5..7b53b87 100644 --- a/exercises/practice/resistor-color-duo/.meta/config.json +++ b/exercises/practice/resistor-color-duo/.meta/config.json @@ -15,6 +15,5 @@ }, "blurb": "Convert color codes, as used on resistors, to a numeric value.", "source": "Maud de Vries, Erik Schierboom", - "source_url": "https://github.com/exercism/problem-specifications/issues/1464", - "difficulty": 2 + "source_url": "https://github.com/exercism/problem-specifications/issues/1464" } diff --git a/exercises/practice/resistor-color-trio/.meta/config.json b/exercises/practice/resistor-color-trio/.meta/config.json index 44143a1..53e3554 100644 --- a/exercises/practice/resistor-color-trio/.meta/config.json +++ b/exercises/practice/resistor-color-trio/.meta/config.json @@ -15,6 +15,5 @@ }, "blurb": "Convert color codes, as used on resistors, to a human-readable label.", "source": "Maud de Vries, Erik Schierboom", - "source_url": "https://github.com/exercism/problem-specifications/issues/1549", - "difficulty": 4 + "source_url": "https://github.com/exercism/problem-specifications/issues/1549" } diff --git a/exercises/practice/resistor-color/.meta/config.json b/exercises/practice/resistor-color/.meta/config.json index 914c584..db31a4a 100644 --- a/exercises/practice/resistor-color/.meta/config.json +++ b/exercises/practice/resistor-color/.meta/config.json @@ -15,6 +15,5 @@ }, "blurb": "Convert a resistor band's color to its numeric representation.", "source": "Maud de Vries, Erik Schierboom", - "source_url": "https://github.com/exercism/problem-specifications/issues/1458", - "difficulty": 1 + "source_url": "https://github.com/exercism/problem-specifications/issues/1458" } diff --git a/exercises/practice/strain/.meta/config.json b/exercises/practice/strain/.meta/config.json index 9f3cf35..55616ed 100644 --- a/exercises/practice/strain/.meta/config.json +++ b/exercises/practice/strain/.meta/config.json @@ -15,6 +15,5 @@ }, "blurb": "Implement the `keep` and `discard` operation on collections.", "source": "Conversation with James Edward Gray II", - "source_url": "http://graysoftinc.com/", - "difficulty": 2 + "source_url": "http://graysoftinc.com/" } From 3767d64c8634e087c082079b821fee94c2787ca6 Mon Sep 17 00:00:00 2001 From: J R M Date: Fri, 30 Jan 2026 16:45:00 +0100 Subject: [PATCH 4/4] oops --- .../simple-cipher/.docs/instructions.md | 40 ---------------- .../practice/simple-cipher/.meta/config.json | 19 -------- .../practice/simple-cipher/.meta/example.nu | 0 .../practice/simple-cipher/.meta/tests.toml | 46 ------------------- exercises/practice/simple-cipher/TODO | 1 - .../practice/simple-cipher/simple-cipher.nu | 13 ------ exercises/practice/simple-cipher/tests.nu | 0 7 files changed, 119 deletions(-) delete mode 100644 exercises/practice/simple-cipher/.docs/instructions.md delete mode 100644 exercises/practice/simple-cipher/.meta/config.json delete mode 100644 exercises/practice/simple-cipher/.meta/example.nu delete mode 100644 exercises/practice/simple-cipher/.meta/tests.toml delete mode 100644 exercises/practice/simple-cipher/TODO delete mode 100644 exercises/practice/simple-cipher/simple-cipher.nu delete mode 100644 exercises/practice/simple-cipher/tests.nu diff --git a/exercises/practice/simple-cipher/.docs/instructions.md b/exercises/practice/simple-cipher/.docs/instructions.md deleted file mode 100644 index afd0b57..0000000 --- a/exercises/practice/simple-cipher/.docs/instructions.md +++ /dev/null @@ -1,40 +0,0 @@ -# Instructions - -Create an implementation of the [Vigenère cipher][wiki]. -The Vigenère cipher is a simple substitution cipher. - -## Cipher terminology - -A cipher is an algorithm used to encrypt, or encode, a string. -The unencrypted string is called the _plaintext_ and the encrypted string is called the _ciphertext_. -Converting plaintext to ciphertext is called _encoding_ while the reverse is called _decoding_. - -In a _substitution cipher_, each plaintext letter is replaced with a ciphertext letter which is computed with the help of a _key_. -(Note, it is possible for replacement letter to be the same as the original letter.) - -## Encoding details - -In this cipher, the key is a series of lowercase letters, such as `"abcd"`. -Each letter of the plaintext is _shifted_ or _rotated_ by a distance based on a corresponding letter in the key. -An `"a"` in the key means a shift of 0 (that is, no shift). -A `"b"` in the key means a shift of 1. -A `"c"` in the key means a shift of 2, and so on. - -The first letter of the plaintext uses the first letter of the key, the second letter of the plaintext uses the second letter of the key and so on. -If you run out of letters in the key before you run out of letters in the plaintext, start over from the start of the key again. - -If the key only contains one letter, such as `"dddddd"`, then all letters of the plaintext are shifted by the same amount (three in this example), which would make this the same as a rotational cipher or shift cipher (sometimes called a Caesar cipher). -For example, the plaintext `"iamapandabear"` would become `"ldpdsdqgdehdu"`. - -If the key only contains the letter `"a"` (one or more times), the shift distance is zero and the ciphertext is the same as the plaintext. - -Usually the key is more complicated than that, though! -If the key is `"abcd"` then letters of the plaintext would be shifted by a distance of 0, 1, 2, and 3. -If the plaintext is `"hello"`, we need 5 shifts so the key would wrap around, giving shift distances of 0, 1, 2, 3, and 0. -Applying those shifts to the letters of `"hello"` we get `"hfnoo"`. - -## Random keys - -If no key is provided, generate a key which consists of at least 100 random lowercase letters from the Latin alphabet. - -[wiki]: https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher diff --git a/exercises/practice/simple-cipher/.meta/config.json b/exercises/practice/simple-cipher/.meta/config.json deleted file mode 100644 index bbb27b7..0000000 --- a/exercises/practice/simple-cipher/.meta/config.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "authors": [ - "quintuple-mallard" - ], - "files": { - "solution": [ - "simple-cipher.nu" - ], - "test": [ - "tests.nu" - ], - "example": [ - ".meta/example.nu" - ] - }, - "blurb": "Implement the Vigenère cipher, a simple substitution cipher.", - "source": "Substitution Cipher at Wikipedia", - "source_url": "https://en.wikipedia.org/wiki/Substitution_cipher" -} diff --git a/exercises/practice/simple-cipher/.meta/example.nu b/exercises/practice/simple-cipher/.meta/example.nu deleted file mode 100644 index e69de29..0000000 diff --git a/exercises/practice/simple-cipher/.meta/tests.toml b/exercises/practice/simple-cipher/.meta/tests.toml deleted file mode 100644 index 77e6571..0000000 --- a/exercises/practice/simple-cipher/.meta/tests.toml +++ /dev/null @@ -1,46 +0,0 @@ -# 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. - -[b8bdfbe1-bea3-41bb-a999-b41403f2b15d] -description = "Random key cipher -> Can encode" - -[3dff7f36-75db-46b4-ab70-644b3f38b81c] -description = "Random key cipher -> Can decode" - -[8143c684-6df6-46ba-bd1f-dea8fcb5d265] -description = "Random key cipher -> Is reversible. I.e., if you apply decode in a encoded result, you must see the same plaintext encode parameter as a result of the decode method" - -[defc0050-e87d-4840-85e4-51a1ab9dd6aa] -description = "Random key cipher -> Key is made only of lowercase letters" - -[565e5158-5b3b-41dd-b99d-33b9f413c39f] -description = "Substitution cipher -> Can encode" - -[d44e4f6a-b8af-4e90-9d08-fd407e31e67b] -description = "Substitution cipher -> Can decode" - -[70a16473-7339-43df-902d-93408c69e9d1] -description = "Substitution cipher -> Is reversible. I.e., if you apply decode in a encoded result, you must see the same plaintext encode parameter as a result of the decode method" - -[69a1458b-92a6-433a-a02d-7beac3ea91f9] -description = "Substitution cipher -> Can double shift encode" - -[21d207c1-98de-40aa-994f-86197ae230fb] -description = "Substitution cipher -> Can wrap on encode" - -[a3d7a4d7-24a9-4de6-bdc4-a6614ced0cb3] -description = "Substitution cipher -> Can wrap on decode" - -[e31c9b8c-8eb6-45c9-a4b5-8344a36b9641] -description = "Substitution cipher -> Can encode messages longer than the key" - -[93cfaae0-17da-4627-9a04-d6d1e1be52e3] -description = "Substitution cipher -> Can decode messages longer than the key" diff --git a/exercises/practice/simple-cipher/TODO b/exercises/practice/simple-cipher/TODO deleted file mode 100644 index cf56e8e..0000000 --- a/exercises/practice/simple-cipher/TODO +++ /dev/null @@ -1 +0,0 @@ -remove this file when implementation is done diff --git a/exercises/practice/simple-cipher/simple-cipher.nu b/exercises/practice/simple-cipher/simple-cipher.nu deleted file mode 100644 index 3f792f6..0000000 --- a/exercises/practice/simple-cipher/simple-cipher.nu +++ /dev/null @@ -1,13 +0,0 @@ -def caesar_cipher [text, shift] { - text | split chars | each {|c| - if ($c =~ "[A-Z]") { - char --integer (((($c | encode hex | into int --radix 16) + shift) - ('A'| encode hex | into int --radix 16)) mod 26 + ('A'| encode hex | into int --radix 16)); - - } else if ($c =~ "[a-z]") { - char --integer (((($c | encode hex | into int --radix 16) + shift) - ('a'| encode hex | into int --radix 16)) mod 26 + ('a'| encode hex | into int --radix 16)); - - } else { - $c - } - } | str join -} diff --git a/exercises/practice/simple-cipher/tests.nu b/exercises/practice/simple-cipher/tests.nu deleted file mode 100644 index e69de29..0000000