From 76f484537d21edaa47eb2105ea541d7137deeace Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Sun, 3 Sep 2017 00:16:50 +0530 Subject: [PATCH 01/11] Rail Fence Cipher completed --- exercises/rail-fence-cipher/build.gradle | 17 +++++ .../src/example/java/RailFenceCipher.java | 74 +++++++++++++++++++ .../src/test/java/RailFenceCipherTest.java | 44 +++++++++++ exercises/settings.gradle | 1 + 4 files changed, 136 insertions(+) create mode 100644 exercises/rail-fence-cipher/build.gradle create mode 100644 exercises/rail-fence-cipher/src/example/java/RailFenceCipher.java create mode 100644 exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java diff --git a/exercises/rail-fence-cipher/build.gradle b/exercises/rail-fence-cipher/build.gradle new file mode 100644 index 000000000..0bf827a6f --- /dev/null +++ b/exercises/rail-fence-cipher/build.gradle @@ -0,0 +1,17 @@ +apply plugin: "java" +apply plugin: "eclipse" +apply plugin: "idea" + +repositories { + mavenCentral() +} + +dependencies { + testCompile "junit:junit:4.12" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/rail-fence-cipher/src/example/java/RailFenceCipher.java b/exercises/rail-fence-cipher/src/example/java/RailFenceCipher.java new file mode 100644 index 000000000..06cf294f4 --- /dev/null +++ b/exercises/rail-fence-cipher/src/example/java/RailFenceCipher.java @@ -0,0 +1,74 @@ +import java.util.ArrayList; +import java.util.List; + +class RailFenceCipher { + + private int noOfRails; + + RailFenceCipher(int noOfRails) { + this.noOfRails = noOfRails; + } + + String getEncryptedData(String plainText) { + List railFence = new ArrayList<>(); + for (int i = 0; i < noOfRails; i++) { + railFence.add(""); + } + + int number = 0, increment = 1; + for (char c : plainText.toCharArray()) { + if (number + increment == noOfRails) { + increment = -1; + } else if (number + increment == -1) { + increment = 1; + } + String temp = railFence.get(number); + railFence.remove(number); + railFence.add(number, temp + c); + number += increment; + } + String buffer = ""; + for (String s : railFence) { + buffer = buffer.concat(s); + } + return buffer; + } + + String getDecryptedData(String cipherText) { + String decrypted; + ArrayList> railFence = new ArrayList<>(noOfRails); + + for (int i = 0; i < noOfRails; ++i) { + railFence.add(new ArrayList<>(cipherText.length())); + } + + int rowIncrementFactor = 0, step = 1; + + for (int i = 0; i < cipherText.length(); ++i) { + if (rowIncrementFactor + step == noOfRails) { + step = -1; + } else if (rowIncrementFactor + step == -1) { + step = 1; + } + + railFence.get(rowIncrementFactor).add(i); + rowIncrementFactor += step; + } + + int counter = 0; + ArrayList buffer = new ArrayList<>(cipherText.length()); + for (int i = 0; i < cipherText.length(); ++i) { + buffer.add('a'); + } + + for (int i = 0; i < noOfRails; ++i) { + for (int j = 0; j < railFence.get(i).size(); ++j) { + buffer.set(railFence.get(i).get(j), cipherText.charAt(counter)); + counter++; + } + } + + decrypted = buffer.toString().replaceAll(",", "").replaceAll("\\s+", "").replace("[", "").replace("]", ""); + return decrypted; + } +} diff --git a/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java b/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java new file mode 100644 index 000000000..23878e87c --- /dev/null +++ b/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java @@ -0,0 +1,44 @@ +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +public class RailFenceCipherTest { + + private RailFenceCipher railFenceCipher; + + @Test + public void encodeWithTwoRails() { + railFenceCipher = new RailFenceCipher(2); + Assert.assertEquals("XXXXXXXXXOOOOOOOOO", railFenceCipher.getEncryptedData("XOXOXOXOXOXOXOXOXO")); + } + + @Test + public void encodeWithThreeRails() { + railFenceCipher = new RailFenceCipher(3); + Assert.assertEquals("WECRLTEERDSOEEFEAOCAIVDEN", railFenceCipher.getEncryptedData("WEAREDISCOVEREDFLEEATONCE")); + } + + @Test + public void encodeWithEndingInTheMiddle() { + railFenceCipher = new RailFenceCipher(4); + Assert.assertEquals("ESXIEECSR", railFenceCipher.getEncryptedData("EXERCISES")); + } + + @Test + public void decodeWithThreeRails() { + railFenceCipher = new RailFenceCipher(3); + Assert.assertEquals("THEDEVILISINTHEDETAILS", railFenceCipher.getDecryptedData("TEITELHDVLSNHDTISEIIEA")); + } + + @Test + public void decodeWithFiveRails() { + railFenceCipher = new RailFenceCipher(5); + Assert.assertEquals("EXERCISMISAWESOME", railFenceCipher.getDecryptedData("EIEXMSMESAORIWSCE")); + } + + @Test + public void decodeWithSixRails() { + railFenceCipher = new RailFenceCipher(6); + Assert.assertEquals("112358132134558914423337761098715972584418167651094617711286", railFenceCipher.getDecryptedData("133714114238148966225439541018335470986172518171757571896261")); + } +} \ No newline at end of file diff --git a/exercises/settings.gradle b/exercises/settings.gradle index da2430a49..fe40a72a9 100644 --- a/exercises/settings.gradle +++ b/exercises/settings.gradle @@ -55,6 +55,7 @@ include 'poker' include 'prime-factors' include 'pythagorean-triplet' include 'queen-attack' +include 'rail-fence-cipher' include 'raindrops' include 'rectangles' include 'rna-transcription' From 705e96c863d3da389059b0957d55247ed2bb359b Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Sun, 3 Sep 2017 00:28:39 +0530 Subject: [PATCH 02/11] Added @Ignore in the test file --- .../rail-fence-cipher/src/test/java/RailFenceCipherTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java b/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java index 23878e87c..76a3afd5c 100644 --- a/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java +++ b/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java @@ -12,30 +12,35 @@ public void encodeWithTwoRails() { Assert.assertEquals("XXXXXXXXXOOOOOOOOO", railFenceCipher.getEncryptedData("XOXOXOXOXOXOXOXOXO")); } + @Ignore("Remove to run test") @Test public void encodeWithThreeRails() { railFenceCipher = new RailFenceCipher(3); Assert.assertEquals("WECRLTEERDSOEEFEAOCAIVDEN", railFenceCipher.getEncryptedData("WEAREDISCOVEREDFLEEATONCE")); } + @Ignore("Remove to run test") @Test public void encodeWithEndingInTheMiddle() { railFenceCipher = new RailFenceCipher(4); Assert.assertEquals("ESXIEECSR", railFenceCipher.getEncryptedData("EXERCISES")); } + @Ignore("Remove to run test") @Test public void decodeWithThreeRails() { railFenceCipher = new RailFenceCipher(3); Assert.assertEquals("THEDEVILISINTHEDETAILS", railFenceCipher.getDecryptedData("TEITELHDVLSNHDTISEIIEA")); } + @Ignore("Remove to run test") @Test public void decodeWithFiveRails() { railFenceCipher = new RailFenceCipher(5); Assert.assertEquals("EXERCISMISAWESOME", railFenceCipher.getDecryptedData("EIEXMSMESAORIWSCE")); } + @Ignore("Remove to run test") @Test public void decodeWithSixRails() { railFenceCipher = new RailFenceCipher(6); From 40b7955e759094b6cf08a72c1e0593c9f238c2d5 Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Sun, 3 Sep 2017 00:40:05 +0530 Subject: [PATCH 03/11] Build fail corrections --- config.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.json b/config.json index a85e5e846..b0f0c4958 100644 --- a/config.json +++ b/config.json @@ -353,6 +353,15 @@ ] }, +{ + "slug": "rail-fence-cipher", + "core": false, + "difficulty": 5, + "topics": [ + + ] + }, + { "uuid": "6a617ddb-04e3-451c-bb30-27ccd0be9125", "slug": "allergies", From 1728cc14acc0997867895f54110f7fe87f622bdf Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Sun, 3 Sep 2017 01:00:49 +0530 Subject: [PATCH 04/11] Build Fail --- config.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config.json b/config.json index b0f0c4958..d6185080b 100644 --- a/config.json +++ b/config.json @@ -11,6 +11,15 @@ "difficulty": 1, "topics": [ + ] + }, +{ + "slug": "rail-fence-cipher", + "core": true, + "unlocked_by": null, + "difficulty": 1, + "topics": [ + ] }, { @@ -353,15 +362,6 @@ ] }, -{ - "slug": "rail-fence-cipher", - "core": false, - "difficulty": 5, - "topics": [ - - ] - }, - { "uuid": "6a617ddb-04e3-451c-bb30-27ccd0be9125", "slug": "allergies", From 01ed3889bb0f5b157fb66ab505686c3f258fb390 Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Sun, 3 Sep 2017 16:58:06 +0530 Subject: [PATCH 05/11] Added .keep file, the abscence caused build to fail --- exercises/rail-fence-cipher/src/main/java/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 exercises/rail-fence-cipher/src/main/java/.keep diff --git a/exercises/rail-fence-cipher/src/main/java/.keep b/exercises/rail-fence-cipher/src/main/java/.keep new file mode 100644 index 000000000..e69de29bb From 4caff4403e3a4e4064a95fc402fc1cc7ceabff63 Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Tue, 26 Sep 2017 22:03:42 +0530 Subject: [PATCH 06/11] Changes done as per the recent conventions --- config.json | 1402 +++++++++-------- .../src/reference}/java/RailFenceCipher.java | 0 .../src/test/java/RailFenceCipherTest.java | 18 +- 3 files changed, 714 insertions(+), 706 deletions(-) rename exercises/rail-fence-cipher/{src/example => .meta/src/reference}/java/RailFenceCipher.java (100%) diff --git a/config.json b/config.json index 8e0859cf6..cddf0cff8 100644 --- a/config.json +++ b/config.json @@ -1,701 +1,703 @@ -{ - "active": true, - "blurb": "Java is a very widely used Object Oriented programming language. It's safe, simple to use and portable so that you can \"write once, run anywhere\".", - "exercises": [ - { - "core": true, - "difficulty": 1, - "slug": "hello-world", - "topics": [ - "strings" - ], - "unlocked_by": null, - "uuid": "f77dc7e3-35a8-4300-a7c8-2c1765e9644d" - }, -{ - "slug": "rail-fence-cipher", - "core": true, - "unlocked_by": null, - "difficulty": 1, - "topics": [ +{ + "active":true, + "blurb":"Java is a very widely used Object Oriented programming language. It's safe, simple to use and portable so that you can \"write once, run anywhere\".", + "exercises":[ + { + "core":true, + "difficulty":1, + "slug":"hello-world", + "topics":[ + "strings" + ], + "unlocked_by":null, + "uuid":"f77dc7e3-35a8-4300-a7c8-2c1765e9644d" + }, + { + "slug":"rail-fence-cipher", + "core":false, + "unlocked_by":null, + "difficulty":6, + "topics":[ - ] - }, - { - "core": true, - "difficulty": 1, - "slug": "two-fer", - "topics": [ - "strings", - "conditionals" - ], - "unlocked_by": null, - "uuid": "74515d45-565b-4be2-96c4-77e58efa9257" - }, - { - "core": false, - "difficulty": 2, - "slug": "rna-transcription", - "topics": null, - "unlocked_by": null, - "uuid": "8e983ed2-62f7-439a-a144-fb8fdbdf4d30" - }, - { - "core": false, - "difficulty": 3, - "slug": "pangram", - "topics": null, - "unlocked_by": null, - "uuid": "133b0f84-bdc7-4508-a0a1-5732a7db81ef" - }, - { - "core": true, - "difficulty": 3, - "slug": "hamming", - "topics": [ - "strings", - "loops", - "integers" - ], - "unlocked_by": null, - "uuid": "ce899ca6-9cc7-47ba-b76f-1bbcf2630b76" - }, - { - "core": true, - "difficulty": 3, - "slug": "gigasecond", - "topics": null, - "unlocked_by": null, - "uuid": "bf1641c8-dc0d-4d38-9cfe-b4c132ea3553" - }, - { - "core": false, - "difficulty": 3, - "slug": "space-age", - "topics": null, - "unlocked_by": null, - "uuid": "e5b524cd-3a1c-468a-8981-13e8eeccb29d" - }, - { - "core": false, - "difficulty": 3, - "slug": "acronym", - "topics": null, - "unlocked_by": null, - "uuid": "c31bbc6d-bdcf-44f7-bf35-5f98752e38d0" - }, - { - "core": true, - "difficulty": 3, - "slug": "scrabble-score", - "topics": null, - "unlocked_by": null, - "uuid": "afae9f2d-8baf-4bd7-8d7c-d486337f7c97" - }, - { - "core": false, - "difficulty": 3, - "slug": "raindrops", - "topics": null, - "unlocked_by": "hello-world", - "uuid": "d916e4f8-fda1-41c0-ab24-79e8fc3f1272" - }, - { - "core": true, - "difficulty": 3, - "slug": "difference-of-squares", - "topics": null, - "unlocked_by": null, - "uuid": "b0da59c6-1b55-405c-b163-007ebf09f5e8" - }, - { - "core": true, - "difficulty": 3, - "slug": "secret-handshake", - "topics": null, - "unlocked_by": null, - "uuid": "71c7c174-7e2c-43c2-bdd6-7515fcb12a91" - }, - { - "core": false, - "difficulty": 3, - "slug": "perfect-numbers", - "topics": null, - "unlocked_by": "difference-of-squares", - "uuid": "d0dcc898-ec38-4822-9e3c-1a1829c9b2d9" - }, - { - "core": false, - "difficulty": 4, - "slug": "sum-of-multiples", - "topics": null, - "unlocked_by": "difference-of-squares", - "uuid": "2f244afc-3e7b-4f89-92af-e2b427f4ef35" - }, - { - "core": false, - "difficulty": 4, - "slug": "luhn", - "topics": null, - "unlocked_by": "hamming", - "uuid": "5227a76c-8ecb-4e5f-b023-6af65a057c41" - }, - { - "core": true, - "difficulty": 4, - "slug": "matrix", - "topics": null, - "unlocked_by": null, - "uuid": "c1d4e0b4-6a0f-4be9-8222-345966621f53" - }, - { - "core": true, - "difficulty": 4, - "slug": "triangle", - "topics": null, - "unlocked_by": null, - "uuid": "ec268d8e-997b-4553-8c67-8bdfa1ecb888" - }, - { - "core": false, - "difficulty": 4, - "slug": "largest-series-product", - "topics": null, - "unlocked_by": "hamming", - "uuid": "b7310b6e-435c-4d5f-b2bd-31e586d0f238" - }, - { - "core": false, - "difficulty": 4, - "slug": "sieve", - "topics": null, - "unlocked_by": "difference-of-squares", - "uuid": "6791d01f-bae4-4b63-ae76-86529ac49e36" - }, - { - "core": false, - "difficulty": 4, - "slug": "twelve-days", - "topics": null, - "unlocked_by": "two-fer", - "uuid": "581afdbb-dfb6-4dc5-9554-a025b5469a3c" - }, - { - "core": true, - "difficulty": 4, - "slug": "rotational-cipher", - "topics": null, - "unlocked_by": null, - "uuid": "9eb41883-55ef-4681-b5ac-5c2259302772" - }, - { - "core": false, - "difficulty": 4, - "slug": "kindergarten-garden", - "topics": null, - "unlocked_by": "matrix", - "uuid": "0b92ffee-c092-4ab1-ad78-76c8cf80e1b5" - }, - { - "core": false, - "difficulty": 4, - "slug": "collatz-conjecture", - "topics": null, - "unlocked_by": "triangle", - "uuid": "1500d39a-c9d9-4d3a-9e77-fdc1837fc6ad" - }, - { - "core": false, - "difficulty": 4, - "slug": "nth-prime", - "topics": null, - "unlocked_by": "triangle", - "uuid": "2c69db99-648d-4bd7-8012-1fbdeff6ca0a" - }, - { - "core": true, - "difficulty": 4, - "slug": "saddle-points", - "topics": null, - "unlocked_by": null, - "uuid": "8dfc2f0d-1141-46e9-95e2-6f35ccf6f160" - }, - { - "core": false, - "difficulty": 4, - "slug": "diamond", - "topics": null, - "unlocked_by": "two-fer", - "uuid": "ecbd997b-86f4-4e11-9ff0-706ac2899415" - }, - { - "core": false, - "difficulty": 4, - "slug": "isogram", - "topics": null, - "unlocked_by": "hello-world", - "uuid": "c3e89c7c-3a8a-4ddc-b653-9b0ff9e1d7d8" - }, - { - "core": true, - "difficulty": 5, - "slug": "flatten-array", - "topics": null, - "unlocked_by": null, - "uuid": "a732a838-8170-458a-a85e-d6b4c46f97a1" - }, - { - "core": false, - "difficulty": 5, - "slug": "pig-latin", - "topics": null, - "unlocked_by": "hello-world", - "uuid": "38bc80ae-d842-4c04-a797-48edf322504d" - }, - { - "core": false, - "difficulty": 5, - "slug": "phone-number", - "topics": null, - "unlocked_by": "hamming", - "uuid": "5f9139e7-9fbb-496a-a0d7-a946283033de" - }, - { - "core": false, - "difficulty": 5, - "slug": "nucleotide-count", - "topics": null, - "unlocked_by": "hamming", - "uuid": "2d80fdfc-5bd7-4b67-9fbe-8ab820d89051" - }, - { - "core": true, - "difficulty": 5, - "slug": "word-count", - "topics": null, - "unlocked_by": null, - "uuid": "3603b770-87a5-4758-91f3-b4d1f9075bc1" - }, - { - "core": false, - "difficulty": 5, - "slug": "run-length-encoding", - "topics": null, - "unlocked_by": "rotational-cipher", - "uuid": "4499a3f9-73a7-48bf-8753-d5b6abf588c9" - }, - { - "core": true, - "difficulty": 5, - "slug": "robot-name", - "topics": null, - "unlocked_by": null, - "uuid": "d7c2eed9-64c7-4c4a-b45d-c787d460337f" - }, - { - "core": false, - "difficulty": 5, - "slug": "prime-factors", - "topics": null, - "unlocked_by": "triangle", - "uuid": "599c08ec-7338-46ed-99f8-a76f78f724e6" - }, - { - "core": false, - "difficulty": 5, - "slug": "allergies", - "topics": null, - "unlocked_by": "gigasecond", - "uuid": "6a617ddb-04e3-451c-bb30-27ccd0be9125" - }, - { - "core": false, - "difficulty": 5, - "slug": "bob", - "topics": null, - "unlocked_by": "two-fer", - "uuid": "34cd328c-cd96-492b-abd4-2b8716cdcd9a" - }, - { - "core": false, - "difficulty": 5, - "slug": "pascals-triangle", - "topics": null, - "unlocked_by": "matrix", - "uuid": "d2a76905-1c8c-4b03-b4f7-4fbff19329f3" - }, - { - "core": false, - "difficulty": 5, - "slug": "bracket-push", - "topics": null, - "unlocked_by": "flatten-array", - "uuid": "85aa50ac-0141-49eb-bc6f-62f3f7a97647" - }, - { - "core": false, - "difficulty": 5, - "slug": "series", - "topics": null, - "unlocked_by": "hamming", - "uuid": "af80d7f4-c7d0-4d0b-9c30-09da120f6bb9" - }, - { - "core": false, - "difficulty": 5, - "slug": "atbash-cipher", - "topics": null, - "unlocked_by": "rotational-cipher", - "uuid": "d36ce010-210f-4e9a-9d6c-cb933e0a59af" - }, - { - "core": false, - "difficulty": 6, - "slug": "spiral-matrix", - "topics": null, - "unlocked_by": "matrix", - "uuid": "163fcc6b-c054-4232-a88b-0aded846a6eb" - }, - { - "core": false, - "difficulty": 6, - "slug": "roman-numerals", - "topics": null, - "unlocked_by": "hamming", - "uuid": "3e728cd4-5e5f-4c69-8a53-bc36d020fcdb" - }, - { - "core": false, - "difficulty": 6, - "slug": "transpose", - "topics": null, - "unlocked_by": "matrix", - "uuid": "57b76837-4610-466f-9373-d5c2697625f1" - }, - { - "core": false, - "difficulty": 6, - "slug": "house", - "topics": null, - "unlocked_by": "two-fer", - "uuid": "6b51aca3-3451-4a64-ad7b-00b151d7548a" - }, - { - "core": false, - "difficulty": 6, - "slug": "food-chain", - "topics": null, - "unlocked_by": "two-fer", - "uuid": "dd3e6fd6-5359-4978-acd7-c39374cead4d" - }, - { - "core": false, - "difficulty": 6, - "slug": "beer-song", - "topics": null, - "unlocked_by": "two-fer", - "uuid": "56943095-de76-40bf-b42b-fa3e70f8df5e" - }, - { - "core": false, - "difficulty": 6, - "slug": "queen-attack", - "topics": null, - "unlocked_by": "scrabble-score", - "uuid": "5404109e-3ed9-4691-8eaf-af8b36024a44" - }, - { - "core": false, - "difficulty": 6, - "slug": "etl", - "topics": null, - "unlocked_by": "word-count", - "uuid": "76d28d97-75d3-47eb-bb77-3d347b76f1b6" - }, - { - "core": true, - "difficulty": 6, - "slug": "linked-list", - "topics": null, - "unlocked_by": null, - "uuid": "7ba5084d-3b75-4406-a0d7-87c26387f9c0" - }, - { - "core": false, - "difficulty": 6, - "slug": "grade-school", - "topics": null, - "unlocked_by": "word-count", - "uuid": "b4af5da1-601f-4b0f-bfb8-4a381851090c" - }, - { - "core": false, - "difficulty": 6, - "slug": "robot-simulator", - "topics": null, - "unlocked_by": "secret-handshake", - "uuid": "993bde9d-7774-4e7a-a381-9eee75f28ecb" - }, - { - "core": true, - "difficulty": 6, - "slug": "binary-search", - "topics": null, - "unlocked_by": null, - "uuid": "50136dc3-caf7-4fa1-b7bd-0cba1bea9176" - }, - { - "core": false, - "difficulty": 6, - "slug": "minesweeper", - "topics": null, - "unlocked_by": "scrabble-score", - "uuid": "416a1489-12af-4593-8540-0f55285c96b4" - }, - { - "core": false, - "difficulty": 6, - "slug": "wordy", - "topics": null, - "unlocked_by": "secret-handshake", - "uuid": "3310a3cd-c0cb-45fa-8c51-600178be904a" - }, - { - "core": false, - "difficulty": 6, - "slug": "all-your-base", - "topics": null, - "unlocked_by": "saddle-points", - "uuid": "f7c2e4b5-1995-4dfe-b827-c9aff8ac5332" - }, - { - "core": true, - "difficulty": 6, - "slug": "bank-account", - "topics": null, - "unlocked_by": null, - "uuid": "a242efc5-159d-492b-861d-12a1459fb334" - }, - { - "core": false, - "difficulty": 6, - "slug": "bowling", - "topics": null, - "unlocked_by": "scrabble-score", - "uuid": "4b3f7771-c642-4278-a3d9-2fb958f26361" - }, - { - "core": false, - "difficulty": 7, - "slug": "anagram", - "topics": null, - "unlocked_by": "hello-world", - "uuid": "fb10dc2f-0ba1-44b6-8365-5e48e86d1283" - }, - { - "core": false, - "difficulty": 7, - "slug": "sublist", - "topics": null, - "unlocked_by": "linked-list", - "uuid": "d2aedbd7-092a-43d0-8a5e-ae3ebd5b9c7f" - }, - { - "core": false, - "difficulty": 7, - "slug": "word-search", - "topics": null, - "unlocked_by": "scrabble-score", - "uuid": "b53bde52-cb5f-4d43-86ec-18aa509d62f9" - }, - { - "core": false, - "difficulty": 7, - "slug": "simple-linked-list", - "topics": null, - "unlocked_by": "linked-list", - "uuid": "e3e5ffe5-cfc1-467e-a28a-da0302130144" - }, - { - "core": false, - "difficulty": 7, - "slug": "binary-search-tree", - "topics": null, - "unlocked_by": "binary-search", - "uuid": "0a2d18aa-7b5e-4401-a952-b93d2060694f" - }, - { - "core": false, - "difficulty": 7, - "slug": "meetup", - "topics": null, - "unlocked_by": "gigasecond", - "uuid": "602511d5-7e89-4def-b072-4dd311816810" - }, - { - "core": false, - "difficulty": 7, - "slug": "crypto-square", - "topics": null, - "unlocked_by": "rotational-cipher", - "uuid": "162bebdc-9bf2-43c0-8460-a91f5fc16147" - }, - { - "core": false, - "difficulty": 7, - "slug": "poker", - "topics": [ - "games", - "parsing", - "sorting" - ], - "unlocked_by": "scrabble-score", - "uuid": "57eeac00-741c-4843-907a-51f0ac5ea4cb" - }, - { - "core": false, - "difficulty": 7, - "slug": "clock", - "topics": null, - "unlocked_by": "saddle-points", - "uuid": "97c8fcd4-85b6-41cb-9de2-b4e1b4951222" - }, - { - "core": false, - "difficulty": 8, - "slug": "ocr-numbers", - "topics": null, - "unlocked_by": "robot-name", - "uuid": "5cbc6a67-3a53-4aad-ae68-ff469525437f" - }, - { - "core": false, - "difficulty": 8, - "slug": "circular-buffer", - "topics": [ - "classes", - "exception-handling", - "queues" - ], - "unlocked_by": "linked-list", - "uuid": "626dc25a-062c-4053-a8c1-788e4dc44ca0" - }, - { - "core": false, - "difficulty": 8, - "slug": "rectangles", - "topics": null, - "unlocked_by": "robot-name", - "uuid": "64cda115-919a-4eef-9a45-9ec5d1af98cc" - }, - { - "core": false, - "difficulty": 8, - "slug": "book-store", - "topics": null, - "unlocked_by": "flatten-array", - "uuid": "e5f05d00-fe5b-4d78-b2fa-934c1c9afb32" - }, - { - "core": false, - "difficulty": 8, - "slug": "simple-cipher", - "topics": null, - "unlocked_by": "rotational-cipher", - "uuid": "f654831f-c34b-44f5-9dd5-054efbb486f2" - }, - { - "core": false, - "difficulty": 8, - "slug": "complex-numbers", - "topics": null, - "unlocked_by": "triangle", - "uuid": "52d11278-0d65-4b5b-b387-1374fced3243" - }, - { - "core": false, - "difficulty": 8, - "slug": "list-ops", - "topics": null, - "unlocked_by": "linked-list", - "uuid": "a9836565-5c39-4285-b83a-53408be36ccc" - }, - { - "core": false, - "difficulty": 8, - "slug": "change", - "topics": null, - "unlocked_by": "flatten-array", - "uuid": "bac1f4bc-eea9-43c1-8e95-097347f5925e" - }, - { - "core": false, - "difficulty": 8, - "slug": "palindrome-products", - "topics": null, - "unlocked_by": "saddle-points", - "uuid": "873c05de-b5f5-4c5b-97f0-d1ede8a82832" - }, - { - "core": false, - "difficulty": 9, - "slug": "pythagorean-triplet", - "topics": null, - "unlocked_by": "triangle", - "uuid": "88505f95-89e5-4a08-8ed2-208eb818cdf1" - }, - { - "core": false, - "difficulty": 9, - "slug": "forth", - "topics": null, - "unlocked_by": "secret-handshake", - "uuid": "f0c0316d-3fb5-455e-952a-91161e7fb298" - }, - { - "core": false, - "difficulty": 10, - "slug": "custom-set", - "topics": null, - "unlocked_by": "linked-list", - "uuid": "377fe38b-08ad-4f3a-8118-a43c10f7b9b2" - }, - { - "deprecated": true, - "slug": "accumulate", - "uuid": "e58c29d2-80a7-40ef-bed0-4a184ae35f34" - }, - { - "deprecated": true, - "slug": "binary", - "uuid": "9ea6e0fa-b91d-4d17-ac8f-6d2dc30fdd44" - }, - { - "deprecated": true, - "slug": "hexadecimal", - "uuid": "6fe53a08-c123-465d-864a-ef18217203c4" - }, - { - "deprecated": true, - "slug": "octal", - "uuid": "14a29e82-f9b1-4662-b678-06992e306c01" - }, - { - "deprecated": true, - "slug": "strain", - "uuid": "2d195cd9-1814-490a-8dd6-a2c676f1d4cd" - }, - { - "deprecated": true, - "slug": "trinary", - "uuid": "ee3a8abe-6b19-4b47-9cf6-4d39ae915fb7" - } - ], - "foregone": [ - "leap", - "grains", - "say" - ], - "language": "Java", - "solution_pattern": "reference" -} + ], + "unlocked_by":null, + "uuid":"8382f1c7-4ba4-4d6e-abe1-2d5a2519a11a" + }, + { + "core":true, + "difficulty":1, + "slug":"two-fer", + "topics":[ + "strings", + "conditionals" + ], + "unlocked_by":null, + "uuid":"74515d45-565b-4be2-96c4-77e58efa9257" + }, + { + "core":false, + "difficulty":2, + "slug":"rna-transcription", + "topics":null, + "unlocked_by":null, + "uuid":"8e983ed2-62f7-439a-a144-fb8fdbdf4d30" + }, + { + "core":false, + "difficulty":3, + "slug":"pangram", + "topics":null, + "unlocked_by":null, + "uuid":"133b0f84-bdc7-4508-a0a1-5732a7db81ef" + }, + { + "core":true, + "difficulty":3, + "slug":"hamming", + "topics":[ + "strings", + "loops", + "integers" + ], + "unlocked_by":null, + "uuid":"ce899ca6-9cc7-47ba-b76f-1bbcf2630b76" + }, + { + "core":true, + "difficulty":3, + "slug":"gigasecond", + "topics":null, + "unlocked_by":null, + "uuid":"bf1641c8-dc0d-4d38-9cfe-b4c132ea3553" + }, + { + "core":false, + "difficulty":3, + "slug":"space-age", + "topics":null, + "unlocked_by":null, + "uuid":"e5b524cd-3a1c-468a-8981-13e8eeccb29d" + }, + { + "core":false, + "difficulty":3, + "slug":"acronym", + "topics":null, + "unlocked_by":null, + "uuid":"c31bbc6d-bdcf-44f7-bf35-5f98752e38d0" + }, + { + "core":true, + "difficulty":3, + "slug":"scrabble-score", + "topics":null, + "unlocked_by":null, + "uuid":"afae9f2d-8baf-4bd7-8d7c-d486337f7c97" + }, + { + "core":false, + "difficulty":3, + "slug":"raindrops", + "topics":null, + "unlocked_by":"hello-world", + "uuid":"d916e4f8-fda1-41c0-ab24-79e8fc3f1272" + }, + { + "core":true, + "difficulty":3, + "slug":"difference-of-squares", + "topics":null, + "unlocked_by":null, + "uuid":"b0da59c6-1b55-405c-b163-007ebf09f5e8" + }, + { + "core":true, + "difficulty":3, + "slug":"secret-handshake", + "topics":null, + "unlocked_by":null, + "uuid":"71c7c174-7e2c-43c2-bdd6-7515fcb12a91" + }, + { + "core":false, + "difficulty":3, + "slug":"perfect-numbers", + "topics":null, + "unlocked_by":"difference-of-squares", + "uuid":"d0dcc898-ec38-4822-9e3c-1a1829c9b2d9" + }, + { + "core":false, + "difficulty":4, + "slug":"sum-of-multiples", + "topics":null, + "unlocked_by":"difference-of-squares", + "uuid":"2f244afc-3e7b-4f89-92af-e2b427f4ef35" + }, + { + "core":false, + "difficulty":4, + "slug":"luhn", + "topics":null, + "unlocked_by":"hamming", + "uuid":"5227a76c-8ecb-4e5f-b023-6af65a057c41" + }, + { + "core":true, + "difficulty":4, + "slug":"matrix", + "topics":null, + "unlocked_by":null, + "uuid":"c1d4e0b4-6a0f-4be9-8222-345966621f53" + }, + { + "core":true, + "difficulty":4, + "slug":"triangle", + "topics":null, + "unlocked_by":null, + "uuid":"ec268d8e-997b-4553-8c67-8bdfa1ecb888" + }, + { + "core":false, + "difficulty":4, + "slug":"largest-series-product", + "topics":null, + "unlocked_by":"hamming", + "uuid":"b7310b6e-435c-4d5f-b2bd-31e586d0f238" + }, + { + "core":false, + "difficulty":4, + "slug":"sieve", + "topics":null, + "unlocked_by":"difference-of-squares", + "uuid":"6791d01f-bae4-4b63-ae76-86529ac49e36" + }, + { + "core":false, + "difficulty":4, + "slug":"twelve-days", + "topics":null, + "unlocked_by":"two-fer", + "uuid":"581afdbb-dfb6-4dc5-9554-a025b5469a3c" + }, + { + "core":true, + "difficulty":4, + "slug":"rotational-cipher", + "topics":null, + "unlocked_by":null, + "uuid":"9eb41883-55ef-4681-b5ac-5c2259302772" + }, + { + "core":false, + "difficulty":4, + "slug":"kindergarten-garden", + "topics":null, + "unlocked_by":"matrix", + "uuid":"0b92ffee-c092-4ab1-ad78-76c8cf80e1b5" + }, + { + "core":false, + "difficulty":4, + "slug":"collatz-conjecture", + "topics":null, + "unlocked_by":"triangle", + "uuid":"1500d39a-c9d9-4d3a-9e77-fdc1837fc6ad" + }, + { + "core":false, + "difficulty":4, + "slug":"nth-prime", + "topics":null, + "unlocked_by":"triangle", + "uuid":"2c69db99-648d-4bd7-8012-1fbdeff6ca0a" + }, + { + "core":true, + "difficulty":4, + "slug":"saddle-points", + "topics":null, + "unlocked_by":null, + "uuid":"8dfc2f0d-1141-46e9-95e2-6f35ccf6f160" + }, + { + "core":false, + "difficulty":4, + "slug":"diamond", + "topics":null, + "unlocked_by":"two-fer", + "uuid":"ecbd997b-86f4-4e11-9ff0-706ac2899415" + }, + { + "core":false, + "difficulty":4, + "slug":"isogram", + "topics":null, + "unlocked_by":"hello-world", + "uuid":"c3e89c7c-3a8a-4ddc-b653-9b0ff9e1d7d8" + }, + { + "core":true, + "difficulty":5, + "slug":"flatten-array", + "topics":null, + "unlocked_by":null, + "uuid":"a732a838-8170-458a-a85e-d6b4c46f97a1" + }, + { + "core":false, + "difficulty":5, + "slug":"pig-latin", + "topics":null, + "unlocked_by":"hello-world", + "uuid":"38bc80ae-d842-4c04-a797-48edf322504d" + }, + { + "core":false, + "difficulty":5, + "slug":"phone-number", + "topics":null, + "unlocked_by":"hamming", + "uuid":"5f9139e7-9fbb-496a-a0d7-a946283033de" + }, + { + "core":false, + "difficulty":5, + "slug":"nucleotide-count", + "topics":null, + "unlocked_by":"hamming", + "uuid":"2d80fdfc-5bd7-4b67-9fbe-8ab820d89051" + }, + { + "core":true, + "difficulty":5, + "slug":"word-count", + "topics":null, + "unlocked_by":null, + "uuid":"3603b770-87a5-4758-91f3-b4d1f9075bc1" + }, + { + "core":false, + "difficulty":5, + "slug":"run-length-encoding", + "topics":null, + "unlocked_by":"rotational-cipher", + "uuid":"4499a3f9-73a7-48bf-8753-d5b6abf588c9" + }, + { + "core":true, + "difficulty":5, + "slug":"robot-name", + "topics":null, + "unlocked_by":null, + "uuid":"d7c2eed9-64c7-4c4a-b45d-c787d460337f" + }, + { + "core":false, + "difficulty":5, + "slug":"prime-factors", + "topics":null, + "unlocked_by":"triangle", + "uuid":"599c08ec-7338-46ed-99f8-a76f78f724e6" + }, + { + "core":false, + "difficulty":5, + "slug":"allergies", + "topics":null, + "unlocked_by":"gigasecond", + "uuid":"6a617ddb-04e3-451c-bb30-27ccd0be9125" + }, + { + "core":false, + "difficulty":5, + "slug":"bob", + "topics":null, + "unlocked_by":"two-fer", + "uuid":"34cd328c-cd96-492b-abd4-2b8716cdcd9a" + }, + { + "core":false, + "difficulty":5, + "slug":"pascals-triangle", + "topics":null, + "unlocked_by":"matrix", + "uuid":"d2a76905-1c8c-4b03-b4f7-4fbff19329f3" + }, + { + "core":false, + "difficulty":5, + "slug":"bracket-push", + "topics":null, + "unlocked_by":"flatten-array", + "uuid":"85aa50ac-0141-49eb-bc6f-62f3f7a97647" + }, + { + "core":false, + "difficulty":5, + "slug":"series", + "topics":null, + "unlocked_by":"hamming", + "uuid":"af80d7f4-c7d0-4d0b-9c30-09da120f6bb9" + }, + { + "core":false, + "difficulty":5, + "slug":"atbash-cipher", + "topics":null, + "unlocked_by":"rotational-cipher", + "uuid":"d36ce010-210f-4e9a-9d6c-cb933e0a59af" + }, + { + "core":false, + "difficulty":6, + "slug":"spiral-matrix", + "topics":null, + "unlocked_by":"matrix", + "uuid":"163fcc6b-c054-4232-a88b-0aded846a6eb" + }, + { + "core":false, + "difficulty":6, + "slug":"roman-numerals", + "topics":null, + "unlocked_by":"hamming", + "uuid":"3e728cd4-5e5f-4c69-8a53-bc36d020fcdb" + }, + { + "core":false, + "difficulty":6, + "slug":"transpose", + "topics":null, + "unlocked_by":"matrix", + "uuid":"57b76837-4610-466f-9373-d5c2697625f1" + }, + { + "core":false, + "difficulty":6, + "slug":"house", + "topics":null, + "unlocked_by":"two-fer", + "uuid":"6b51aca3-3451-4a64-ad7b-00b151d7548a" + }, + { + "core":false, + "difficulty":6, + "slug":"food-chain", + "topics":null, + "unlocked_by":"two-fer", + "uuid":"dd3e6fd6-5359-4978-acd7-c39374cead4d" + }, + { + "core":false, + "difficulty":6, + "slug":"beer-song", + "topics":null, + "unlocked_by":"two-fer", + "uuid":"56943095-de76-40bf-b42b-fa3e70f8df5e" + }, + { + "core":false, + "difficulty":6, + "slug":"queen-attack", + "topics":null, + "unlocked_by":"scrabble-score", + "uuid":"5404109e-3ed9-4691-8eaf-af8b36024a44" + }, + { + "core":false, + "difficulty":6, + "slug":"etl", + "topics":null, + "unlocked_by":"word-count", + "uuid":"76d28d97-75d3-47eb-bb77-3d347b76f1b6" + }, + { + "core":true, + "difficulty":6, + "slug":"linked-list", + "topics":null, + "unlocked_by":null, + "uuid":"7ba5084d-3b75-4406-a0d7-87c26387f9c0" + }, + { + "core":false, + "difficulty":6, + "slug":"grade-school", + "topics":null, + "unlocked_by":"word-count", + "uuid":"b4af5da1-601f-4b0f-bfb8-4a381851090c" + }, + { + "core":false, + "difficulty":6, + "slug":"robot-simulator", + "topics":null, + "unlocked_by":"secret-handshake", + "uuid":"993bde9d-7774-4e7a-a381-9eee75f28ecb" + }, + { + "core":true, + "difficulty":6, + "slug":"binary-search", + "topics":null, + "unlocked_by":null, + "uuid":"50136dc3-caf7-4fa1-b7bd-0cba1bea9176" + }, + { + "core":false, + "difficulty":6, + "slug":"minesweeper", + "topics":null, + "unlocked_by":"scrabble-score", + "uuid":"416a1489-12af-4593-8540-0f55285c96b4" + }, + { + "core":false, + "difficulty":6, + "slug":"wordy", + "topics":null, + "unlocked_by":"secret-handshake", + "uuid":"3310a3cd-c0cb-45fa-8c51-600178be904a" + }, + { + "core":false, + "difficulty":6, + "slug":"all-your-base", + "topics":null, + "unlocked_by":"saddle-points", + "uuid":"f7c2e4b5-1995-4dfe-b827-c9aff8ac5332" + }, + { + "core":true, + "difficulty":6, + "slug":"bank-account", + "topics":null, + "unlocked_by":null, + "uuid":"a242efc5-159d-492b-861d-12a1459fb334" + }, + { + "core":false, + "difficulty":6, + "slug":"bowling", + "topics":null, + "unlocked_by":"scrabble-score", + "uuid":"4b3f7771-c642-4278-a3d9-2fb958f26361" + }, + { + "core":false, + "difficulty":7, + "slug":"anagram", + "topics":null, + "unlocked_by":"hello-world", + "uuid":"fb10dc2f-0ba1-44b6-8365-5e48e86d1283" + }, + { + "core":false, + "difficulty":7, + "slug":"sublist", + "topics":null, + "unlocked_by":"linked-list", + "uuid":"d2aedbd7-092a-43d0-8a5e-ae3ebd5b9c7f" + }, + { + "core":false, + "difficulty":7, + "slug":"word-search", + "topics":null, + "unlocked_by":"scrabble-score", + "uuid":"b53bde52-cb5f-4d43-86ec-18aa509d62f9" + }, + { + "core":false, + "difficulty":7, + "slug":"simple-linked-list", + "topics":null, + "unlocked_by":"linked-list", + "uuid":"e3e5ffe5-cfc1-467e-a28a-da0302130144" + }, + { + "core":false, + "difficulty":7, + "slug":"binary-search-tree", + "topics":null, + "unlocked_by":"binary-search", + "uuid":"0a2d18aa-7b5e-4401-a952-b93d2060694f" + }, + { + "core":false, + "difficulty":7, + "slug":"meetup", + "topics":null, + "unlocked_by":"gigasecond", + "uuid":"602511d5-7e89-4def-b072-4dd311816810" + }, + { + "core":false, + "difficulty":7, + "slug":"crypto-square", + "topics":null, + "unlocked_by":"rotational-cipher", + "uuid":"162bebdc-9bf2-43c0-8460-a91f5fc16147" + }, + { + "core":false, + "difficulty":7, + "slug":"poker", + "topics":[ + "games", + "parsing", + "sorting" + ], + "unlocked_by":"scrabble-score", + "uuid":"57eeac00-741c-4843-907a-51f0ac5ea4cb" + }, + { + "core":false, + "difficulty":7, + "slug":"clock", + "topics":null, + "unlocked_by":"saddle-points", + "uuid":"97c8fcd4-85b6-41cb-9de2-b4e1b4951222" + }, + { + "core":false, + "difficulty":8, + "slug":"ocr-numbers", + "topics":null, + "unlocked_by":"robot-name", + "uuid":"5cbc6a67-3a53-4aad-ae68-ff469525437f" + }, + { + "core":false, + "difficulty":8, + "slug":"circular-buffer", + "topics":[ + "classes", + "exception-handling", + "queues" + ], + "unlocked_by":"linked-list", + "uuid":"626dc25a-062c-4053-a8c1-788e4dc44ca0" + }, + { + "core":false, + "difficulty":8, + "slug":"rectangles", + "topics":null, + "unlocked_by":"robot-name", + "uuid":"64cda115-919a-4eef-9a45-9ec5d1af98cc" + }, + { + "core":false, + "difficulty":8, + "slug":"book-store", + "topics":null, + "unlocked_by":"flatten-array", + "uuid":"e5f05d00-fe5b-4d78-b2fa-934c1c9afb32" + }, + { + "core":false, + "difficulty":8, + "slug":"simple-cipher", + "topics":null, + "unlocked_by":"rotational-cipher", + "uuid":"f654831f-c34b-44f5-9dd5-054efbb486f2" + }, + { + "core":false, + "difficulty":8, + "slug":"complex-numbers", + "topics":null, + "unlocked_by":"triangle", + "uuid":"52d11278-0d65-4b5b-b387-1374fced3243" + }, + { + "core":false, + "difficulty":8, + "slug":"list-ops", + "topics":null, + "unlocked_by":"linked-list", + "uuid":"a9836565-5c39-4285-b83a-53408be36ccc" + }, + { + "core":false, + "difficulty":8, + "slug":"change", + "topics":null, + "unlocked_by":"flatten-array", + "uuid":"bac1f4bc-eea9-43c1-8e95-097347f5925e" + }, + { + "core":false, + "difficulty":8, + "slug":"palindrome-products", + "topics":null, + "unlocked_by":"saddle-points", + "uuid":"873c05de-b5f5-4c5b-97f0-d1ede8a82832" + }, + { + "core":false, + "difficulty":9, + "slug":"pythagorean-triplet", + "topics":null, + "unlocked_by":"triangle", + "uuid":"88505f95-89e5-4a08-8ed2-208eb818cdf1" + }, + { + "core":false, + "difficulty":9, + "slug":"forth", + "topics":null, + "unlocked_by":"secret-handshake", + "uuid":"f0c0316d-3fb5-455e-952a-91161e7fb298" + }, + { + "core":false, + "difficulty":10, + "slug":"custom-set", + "topics":null, + "unlocked_by":"linked-list", + "uuid":"377fe38b-08ad-4f3a-8118-a43c10f7b9b2" + }, + { + "deprecated":true, + "slug":"accumulate", + "uuid":"e58c29d2-80a7-40ef-bed0-4a184ae35f34" + }, + { + "deprecated":true, + "slug":"binary", + "uuid":"9ea6e0fa-b91d-4d17-ac8f-6d2dc30fdd44" + }, + { + "deprecated":true, + "slug":"hexadecimal", + "uuid":"6fe53a08-c123-465d-864a-ef18217203c4" + }, + { + "deprecated":true, + "slug":"octal", + "uuid":"14a29e82-f9b1-4662-b678-06992e306c01" + }, + { + "deprecated":true, + "slug":"strain", + "uuid":"2d195cd9-1814-490a-8dd6-a2c676f1d4cd" + }, + { + "deprecated":true, + "slug":"trinary", + "uuid":"ee3a8abe-6b19-4b47-9cf6-4d39ae915fb7" + } + ], + "foregone":[ + "leap", + "grains", + "say" + ], + "language":"Java", + "solution_pattern":"reference" +} \ No newline at end of file diff --git a/exercises/rail-fence-cipher/src/example/java/RailFenceCipher.java b/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java similarity index 100% rename from exercises/rail-fence-cipher/src/example/java/RailFenceCipher.java rename to exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java diff --git a/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java b/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java index 76a3afd5c..df0dc3830 100644 --- a/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java +++ b/exercises/rail-fence-cipher/src/test/java/RailFenceCipherTest.java @@ -9,41 +9,47 @@ public class RailFenceCipherTest { @Test public void encodeWithTwoRails() { railFenceCipher = new RailFenceCipher(2); - Assert.assertEquals("XXXXXXXXXOOOOOOOOO", railFenceCipher.getEncryptedData("XOXOXOXOXOXOXOXOXO")); + Assert.assertEquals("XXXXXXXXXOOOOOOOOO", + railFenceCipher.getEncryptedData("XOXOXOXOXOXOXOXOXO")); } @Ignore("Remove to run test") @Test public void encodeWithThreeRails() { railFenceCipher = new RailFenceCipher(3); - Assert.assertEquals("WECRLTEERDSOEEFEAOCAIVDEN", railFenceCipher.getEncryptedData("WEAREDISCOVEREDFLEEATONCE")); + Assert.assertEquals("WECRLTEERDSOEEFEAOCAIVDEN", + railFenceCipher.getEncryptedData("WEAREDISCOVEREDFLEEATONCE")); } @Ignore("Remove to run test") @Test public void encodeWithEndingInTheMiddle() { railFenceCipher = new RailFenceCipher(4); - Assert.assertEquals("ESXIEECSR", railFenceCipher.getEncryptedData("EXERCISES")); + Assert.assertEquals("ESXIEECSR", + railFenceCipher.getEncryptedData("EXERCISES")); } @Ignore("Remove to run test") @Test public void decodeWithThreeRails() { railFenceCipher = new RailFenceCipher(3); - Assert.assertEquals("THEDEVILISINTHEDETAILS", railFenceCipher.getDecryptedData("TEITELHDVLSNHDTISEIIEA")); + Assert.assertEquals("THEDEVILISINTHEDETAILS", + railFenceCipher.getDecryptedData("TEITELHDVLSNHDTISEIIEA")); } @Ignore("Remove to run test") @Test public void decodeWithFiveRails() { railFenceCipher = new RailFenceCipher(5); - Assert.assertEquals("EXERCISMISAWESOME", railFenceCipher.getDecryptedData("EIEXMSMESAORIWSCE")); + Assert.assertEquals("EXERCISMISAWESOME", + railFenceCipher.getDecryptedData("EIEXMSMESAORIWSCE")); } @Ignore("Remove to run test") @Test public void decodeWithSixRails() { railFenceCipher = new RailFenceCipher(6); - Assert.assertEquals("112358132134558914423337761098715972584418167651094617711286", railFenceCipher.getDecryptedData("133714114238148966225439541018335470986172518171757571896261")); + Assert.assertEquals("112358132134558914423337761098715972584418167651094617711286", + railFenceCipher.getDecryptedData("133714114238148966225439541018335470986172518171757571896261")); } } \ No newline at end of file From 818015288f3fe2d37c6da7fbe6c6a4bc186e3947 Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Tue, 26 Sep 2017 22:21:48 +0530 Subject: [PATCH 07/11] Modified the config.json adding topics as well --- config.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index cddf0cff8..95c485abf 100644 --- a/config.json +++ b/config.json @@ -13,12 +13,14 @@ "uuid":"f77dc7e3-35a8-4300-a7c8-2c1765e9644d" }, { - "slug":"rail-fence-cipher", "core":false, - "unlocked_by":null, "difficulty":6, + "slug":"rail-fence-cipher", + "unlocked_by":null, "topics":[ - + "strings", + "loops", + "conditionals" ], "unlocked_by":null, "uuid":"8382f1c7-4ba4-4d6e-abe1-2d5a2519a11a" From 9b25d5a5506435e54407c1123710f45e7af79f8e Mon Sep 17 00:00:00 2001 From: Leon D'souza Date: Sat, 30 Sep 2017 22:12:31 +0530 Subject: [PATCH 08/11] Update config.json --- config.json | 1405 +++++++++++++++++++++++++-------------------------- 1 file changed, 700 insertions(+), 705 deletions(-) diff --git a/config.json b/config.json index 95c485abf..790af865d 100644 --- a/config.json +++ b/config.json @@ -1,705 +1,700 @@ -{ - "active":true, - "blurb":"Java is a very widely used Object Oriented programming language. It's safe, simple to use and portable so that you can \"write once, run anywhere\".", - "exercises":[ - { - "core":true, - "difficulty":1, - "slug":"hello-world", - "topics":[ - "strings" - ], - "unlocked_by":null, - "uuid":"f77dc7e3-35a8-4300-a7c8-2c1765e9644d" - }, - { - "core":false, - "difficulty":6, - "slug":"rail-fence-cipher", - "unlocked_by":null, - "topics":[ - "strings", - "loops", - "conditionals" - ], - "unlocked_by":null, - "uuid":"8382f1c7-4ba4-4d6e-abe1-2d5a2519a11a" - }, - { - "core":true, - "difficulty":1, - "slug":"two-fer", - "topics":[ - "strings", - "conditionals" - ], - "unlocked_by":null, - "uuid":"74515d45-565b-4be2-96c4-77e58efa9257" - }, - { - "core":false, - "difficulty":2, - "slug":"rna-transcription", - "topics":null, - "unlocked_by":null, - "uuid":"8e983ed2-62f7-439a-a144-fb8fdbdf4d30" - }, - { - "core":false, - "difficulty":3, - "slug":"pangram", - "topics":null, - "unlocked_by":null, - "uuid":"133b0f84-bdc7-4508-a0a1-5732a7db81ef" - }, - { - "core":true, - "difficulty":3, - "slug":"hamming", - "topics":[ - "strings", - "loops", - "integers" - ], - "unlocked_by":null, - "uuid":"ce899ca6-9cc7-47ba-b76f-1bbcf2630b76" - }, - { - "core":true, - "difficulty":3, - "slug":"gigasecond", - "topics":null, - "unlocked_by":null, - "uuid":"bf1641c8-dc0d-4d38-9cfe-b4c132ea3553" - }, - { - "core":false, - "difficulty":3, - "slug":"space-age", - "topics":null, - "unlocked_by":null, - "uuid":"e5b524cd-3a1c-468a-8981-13e8eeccb29d" - }, - { - "core":false, - "difficulty":3, - "slug":"acronym", - "topics":null, - "unlocked_by":null, - "uuid":"c31bbc6d-bdcf-44f7-bf35-5f98752e38d0" - }, - { - "core":true, - "difficulty":3, - "slug":"scrabble-score", - "topics":null, - "unlocked_by":null, - "uuid":"afae9f2d-8baf-4bd7-8d7c-d486337f7c97" - }, - { - "core":false, - "difficulty":3, - "slug":"raindrops", - "topics":null, - "unlocked_by":"hello-world", - "uuid":"d916e4f8-fda1-41c0-ab24-79e8fc3f1272" - }, - { - "core":true, - "difficulty":3, - "slug":"difference-of-squares", - "topics":null, - "unlocked_by":null, - "uuid":"b0da59c6-1b55-405c-b163-007ebf09f5e8" - }, - { - "core":true, - "difficulty":3, - "slug":"secret-handshake", - "topics":null, - "unlocked_by":null, - "uuid":"71c7c174-7e2c-43c2-bdd6-7515fcb12a91" - }, - { - "core":false, - "difficulty":3, - "slug":"perfect-numbers", - "topics":null, - "unlocked_by":"difference-of-squares", - "uuid":"d0dcc898-ec38-4822-9e3c-1a1829c9b2d9" - }, - { - "core":false, - "difficulty":4, - "slug":"sum-of-multiples", - "topics":null, - "unlocked_by":"difference-of-squares", - "uuid":"2f244afc-3e7b-4f89-92af-e2b427f4ef35" - }, - { - "core":false, - "difficulty":4, - "slug":"luhn", - "topics":null, - "unlocked_by":"hamming", - "uuid":"5227a76c-8ecb-4e5f-b023-6af65a057c41" - }, - { - "core":true, - "difficulty":4, - "slug":"matrix", - "topics":null, - "unlocked_by":null, - "uuid":"c1d4e0b4-6a0f-4be9-8222-345966621f53" - }, - { - "core":true, - "difficulty":4, - "slug":"triangle", - "topics":null, - "unlocked_by":null, - "uuid":"ec268d8e-997b-4553-8c67-8bdfa1ecb888" - }, - { - "core":false, - "difficulty":4, - "slug":"largest-series-product", - "topics":null, - "unlocked_by":"hamming", - "uuid":"b7310b6e-435c-4d5f-b2bd-31e586d0f238" - }, - { - "core":false, - "difficulty":4, - "slug":"sieve", - "topics":null, - "unlocked_by":"difference-of-squares", - "uuid":"6791d01f-bae4-4b63-ae76-86529ac49e36" - }, - { - "core":false, - "difficulty":4, - "slug":"twelve-days", - "topics":null, - "unlocked_by":"two-fer", - "uuid":"581afdbb-dfb6-4dc5-9554-a025b5469a3c" - }, - { - "core":true, - "difficulty":4, - "slug":"rotational-cipher", - "topics":null, - "unlocked_by":null, - "uuid":"9eb41883-55ef-4681-b5ac-5c2259302772" - }, - { - "core":false, - "difficulty":4, - "slug":"kindergarten-garden", - "topics":null, - "unlocked_by":"matrix", - "uuid":"0b92ffee-c092-4ab1-ad78-76c8cf80e1b5" - }, - { - "core":false, - "difficulty":4, - "slug":"collatz-conjecture", - "topics":null, - "unlocked_by":"triangle", - "uuid":"1500d39a-c9d9-4d3a-9e77-fdc1837fc6ad" - }, - { - "core":false, - "difficulty":4, - "slug":"nth-prime", - "topics":null, - "unlocked_by":"triangle", - "uuid":"2c69db99-648d-4bd7-8012-1fbdeff6ca0a" - }, - { - "core":true, - "difficulty":4, - "slug":"saddle-points", - "topics":null, - "unlocked_by":null, - "uuid":"8dfc2f0d-1141-46e9-95e2-6f35ccf6f160" - }, - { - "core":false, - "difficulty":4, - "slug":"diamond", - "topics":null, - "unlocked_by":"two-fer", - "uuid":"ecbd997b-86f4-4e11-9ff0-706ac2899415" - }, - { - "core":false, - "difficulty":4, - "slug":"isogram", - "topics":null, - "unlocked_by":"hello-world", - "uuid":"c3e89c7c-3a8a-4ddc-b653-9b0ff9e1d7d8" - }, - { - "core":true, - "difficulty":5, - "slug":"flatten-array", - "topics":null, - "unlocked_by":null, - "uuid":"a732a838-8170-458a-a85e-d6b4c46f97a1" - }, - { - "core":false, - "difficulty":5, - "slug":"pig-latin", - "topics":null, - "unlocked_by":"hello-world", - "uuid":"38bc80ae-d842-4c04-a797-48edf322504d" - }, - { - "core":false, - "difficulty":5, - "slug":"phone-number", - "topics":null, - "unlocked_by":"hamming", - "uuid":"5f9139e7-9fbb-496a-a0d7-a946283033de" - }, - { - "core":false, - "difficulty":5, - "slug":"nucleotide-count", - "topics":null, - "unlocked_by":"hamming", - "uuid":"2d80fdfc-5bd7-4b67-9fbe-8ab820d89051" - }, - { - "core":true, - "difficulty":5, - "slug":"word-count", - "topics":null, - "unlocked_by":null, - "uuid":"3603b770-87a5-4758-91f3-b4d1f9075bc1" - }, - { - "core":false, - "difficulty":5, - "slug":"run-length-encoding", - "topics":null, - "unlocked_by":"rotational-cipher", - "uuid":"4499a3f9-73a7-48bf-8753-d5b6abf588c9" - }, - { - "core":true, - "difficulty":5, - "slug":"robot-name", - "topics":null, - "unlocked_by":null, - "uuid":"d7c2eed9-64c7-4c4a-b45d-c787d460337f" - }, - { - "core":false, - "difficulty":5, - "slug":"prime-factors", - "topics":null, - "unlocked_by":"triangle", - "uuid":"599c08ec-7338-46ed-99f8-a76f78f724e6" - }, - { - "core":false, - "difficulty":5, - "slug":"allergies", - "topics":null, - "unlocked_by":"gigasecond", - "uuid":"6a617ddb-04e3-451c-bb30-27ccd0be9125" - }, - { - "core":false, - "difficulty":5, - "slug":"bob", - "topics":null, - "unlocked_by":"two-fer", - "uuid":"34cd328c-cd96-492b-abd4-2b8716cdcd9a" - }, - { - "core":false, - "difficulty":5, - "slug":"pascals-triangle", - "topics":null, - "unlocked_by":"matrix", - "uuid":"d2a76905-1c8c-4b03-b4f7-4fbff19329f3" - }, - { - "core":false, - "difficulty":5, - "slug":"bracket-push", - "topics":null, - "unlocked_by":"flatten-array", - "uuid":"85aa50ac-0141-49eb-bc6f-62f3f7a97647" - }, - { - "core":false, - "difficulty":5, - "slug":"series", - "topics":null, - "unlocked_by":"hamming", - "uuid":"af80d7f4-c7d0-4d0b-9c30-09da120f6bb9" - }, - { - "core":false, - "difficulty":5, - "slug":"atbash-cipher", - "topics":null, - "unlocked_by":"rotational-cipher", - "uuid":"d36ce010-210f-4e9a-9d6c-cb933e0a59af" - }, - { - "core":false, - "difficulty":6, - "slug":"spiral-matrix", - "topics":null, - "unlocked_by":"matrix", - "uuid":"163fcc6b-c054-4232-a88b-0aded846a6eb" - }, - { - "core":false, - "difficulty":6, - "slug":"roman-numerals", - "topics":null, - "unlocked_by":"hamming", - "uuid":"3e728cd4-5e5f-4c69-8a53-bc36d020fcdb" - }, - { - "core":false, - "difficulty":6, - "slug":"transpose", - "topics":null, - "unlocked_by":"matrix", - "uuid":"57b76837-4610-466f-9373-d5c2697625f1" - }, - { - "core":false, - "difficulty":6, - "slug":"house", - "topics":null, - "unlocked_by":"two-fer", - "uuid":"6b51aca3-3451-4a64-ad7b-00b151d7548a" - }, - { - "core":false, - "difficulty":6, - "slug":"food-chain", - "topics":null, - "unlocked_by":"two-fer", - "uuid":"dd3e6fd6-5359-4978-acd7-c39374cead4d" - }, - { - "core":false, - "difficulty":6, - "slug":"beer-song", - "topics":null, - "unlocked_by":"two-fer", - "uuid":"56943095-de76-40bf-b42b-fa3e70f8df5e" - }, - { - "core":false, - "difficulty":6, - "slug":"queen-attack", - "topics":null, - "unlocked_by":"scrabble-score", - "uuid":"5404109e-3ed9-4691-8eaf-af8b36024a44" - }, - { - "core":false, - "difficulty":6, - "slug":"etl", - "topics":null, - "unlocked_by":"word-count", - "uuid":"76d28d97-75d3-47eb-bb77-3d347b76f1b6" - }, - { - "core":true, - "difficulty":6, - "slug":"linked-list", - "topics":null, - "unlocked_by":null, - "uuid":"7ba5084d-3b75-4406-a0d7-87c26387f9c0" - }, - { - "core":false, - "difficulty":6, - "slug":"grade-school", - "topics":null, - "unlocked_by":"word-count", - "uuid":"b4af5da1-601f-4b0f-bfb8-4a381851090c" - }, - { - "core":false, - "difficulty":6, - "slug":"robot-simulator", - "topics":null, - "unlocked_by":"secret-handshake", - "uuid":"993bde9d-7774-4e7a-a381-9eee75f28ecb" - }, - { - "core":true, - "difficulty":6, - "slug":"binary-search", - "topics":null, - "unlocked_by":null, - "uuid":"50136dc3-caf7-4fa1-b7bd-0cba1bea9176" - }, - { - "core":false, - "difficulty":6, - "slug":"minesweeper", - "topics":null, - "unlocked_by":"scrabble-score", - "uuid":"416a1489-12af-4593-8540-0f55285c96b4" - }, - { - "core":false, - "difficulty":6, - "slug":"wordy", - "topics":null, - "unlocked_by":"secret-handshake", - "uuid":"3310a3cd-c0cb-45fa-8c51-600178be904a" - }, - { - "core":false, - "difficulty":6, - "slug":"all-your-base", - "topics":null, - "unlocked_by":"saddle-points", - "uuid":"f7c2e4b5-1995-4dfe-b827-c9aff8ac5332" - }, - { - "core":true, - "difficulty":6, - "slug":"bank-account", - "topics":null, - "unlocked_by":null, - "uuid":"a242efc5-159d-492b-861d-12a1459fb334" - }, - { - "core":false, - "difficulty":6, - "slug":"bowling", - "topics":null, - "unlocked_by":"scrabble-score", - "uuid":"4b3f7771-c642-4278-a3d9-2fb958f26361" - }, - { - "core":false, - "difficulty":7, - "slug":"anagram", - "topics":null, - "unlocked_by":"hello-world", - "uuid":"fb10dc2f-0ba1-44b6-8365-5e48e86d1283" - }, - { - "core":false, - "difficulty":7, - "slug":"sublist", - "topics":null, - "unlocked_by":"linked-list", - "uuid":"d2aedbd7-092a-43d0-8a5e-ae3ebd5b9c7f" - }, - { - "core":false, - "difficulty":7, - "slug":"word-search", - "topics":null, - "unlocked_by":"scrabble-score", - "uuid":"b53bde52-cb5f-4d43-86ec-18aa509d62f9" - }, - { - "core":false, - "difficulty":7, - "slug":"simple-linked-list", - "topics":null, - "unlocked_by":"linked-list", - "uuid":"e3e5ffe5-cfc1-467e-a28a-da0302130144" - }, - { - "core":false, - "difficulty":7, - "slug":"binary-search-tree", - "topics":null, - "unlocked_by":"binary-search", - "uuid":"0a2d18aa-7b5e-4401-a952-b93d2060694f" - }, - { - "core":false, - "difficulty":7, - "slug":"meetup", - "topics":null, - "unlocked_by":"gigasecond", - "uuid":"602511d5-7e89-4def-b072-4dd311816810" - }, - { - "core":false, - "difficulty":7, - "slug":"crypto-square", - "topics":null, - "unlocked_by":"rotational-cipher", - "uuid":"162bebdc-9bf2-43c0-8460-a91f5fc16147" - }, - { - "core":false, - "difficulty":7, - "slug":"poker", - "topics":[ - "games", - "parsing", - "sorting" - ], - "unlocked_by":"scrabble-score", - "uuid":"57eeac00-741c-4843-907a-51f0ac5ea4cb" - }, - { - "core":false, - "difficulty":7, - "slug":"clock", - "topics":null, - "unlocked_by":"saddle-points", - "uuid":"97c8fcd4-85b6-41cb-9de2-b4e1b4951222" - }, - { - "core":false, - "difficulty":8, - "slug":"ocr-numbers", - "topics":null, - "unlocked_by":"robot-name", - "uuid":"5cbc6a67-3a53-4aad-ae68-ff469525437f" - }, - { - "core":false, - "difficulty":8, - "slug":"circular-buffer", - "topics":[ - "classes", - "exception-handling", - "queues" - ], - "unlocked_by":"linked-list", - "uuid":"626dc25a-062c-4053-a8c1-788e4dc44ca0" - }, - { - "core":false, - "difficulty":8, - "slug":"rectangles", - "topics":null, - "unlocked_by":"robot-name", - "uuid":"64cda115-919a-4eef-9a45-9ec5d1af98cc" - }, - { - "core":false, - "difficulty":8, - "slug":"book-store", - "topics":null, - "unlocked_by":"flatten-array", - "uuid":"e5f05d00-fe5b-4d78-b2fa-934c1c9afb32" - }, - { - "core":false, - "difficulty":8, - "slug":"simple-cipher", - "topics":null, - "unlocked_by":"rotational-cipher", - "uuid":"f654831f-c34b-44f5-9dd5-054efbb486f2" - }, - { - "core":false, - "difficulty":8, - "slug":"complex-numbers", - "topics":null, - "unlocked_by":"triangle", - "uuid":"52d11278-0d65-4b5b-b387-1374fced3243" - }, - { - "core":false, - "difficulty":8, - "slug":"list-ops", - "topics":null, - "unlocked_by":"linked-list", - "uuid":"a9836565-5c39-4285-b83a-53408be36ccc" - }, - { - "core":false, - "difficulty":8, - "slug":"change", - "topics":null, - "unlocked_by":"flatten-array", - "uuid":"bac1f4bc-eea9-43c1-8e95-097347f5925e" - }, - { - "core":false, - "difficulty":8, - "slug":"palindrome-products", - "topics":null, - "unlocked_by":"saddle-points", - "uuid":"873c05de-b5f5-4c5b-97f0-d1ede8a82832" - }, - { - "core":false, - "difficulty":9, - "slug":"pythagorean-triplet", - "topics":null, - "unlocked_by":"triangle", - "uuid":"88505f95-89e5-4a08-8ed2-208eb818cdf1" - }, - { - "core":false, - "difficulty":9, - "slug":"forth", - "topics":null, - "unlocked_by":"secret-handshake", - "uuid":"f0c0316d-3fb5-455e-952a-91161e7fb298" - }, - { - "core":false, - "difficulty":10, - "slug":"custom-set", - "topics":null, - "unlocked_by":"linked-list", - "uuid":"377fe38b-08ad-4f3a-8118-a43c10f7b9b2" - }, - { - "deprecated":true, - "slug":"accumulate", - "uuid":"e58c29d2-80a7-40ef-bed0-4a184ae35f34" - }, - { - "deprecated":true, - "slug":"binary", - "uuid":"9ea6e0fa-b91d-4d17-ac8f-6d2dc30fdd44" - }, - { - "deprecated":true, - "slug":"hexadecimal", - "uuid":"6fe53a08-c123-465d-864a-ef18217203c4" - }, - { - "deprecated":true, - "slug":"octal", - "uuid":"14a29e82-f9b1-4662-b678-06992e306c01" - }, - { - "deprecated":true, - "slug":"strain", - "uuid":"2d195cd9-1814-490a-8dd6-a2c676f1d4cd" - }, - { - "deprecated":true, - "slug":"trinary", - "uuid":"ee3a8abe-6b19-4b47-9cf6-4d39ae915fb7" - } - ], - "foregone":[ - "leap", - "grains", - "say" - ], - "language":"Java", - "solution_pattern":"reference" -} \ No newline at end of file +{ + "active": true, + "blurb": "Java is a very widely used Object Oriented programming language. It's safe, simple to use and portable so that you can \"write once, run anywhere\".", + "exercises": [ + { + "core": true, + "difficulty": 1, + "slug": "hello-world", + "topics": [ + "strings" + ], + "unlocked_by": null, + "uuid": "f77dc7e3-35a8-4300-a7c8-2c1765e9644d" + }, + { + "core": true, + "difficulty": 1, + "slug": "two-fer", + "topics": [ + "strings", + "conditionals" + ], + "unlocked_by": null, + "uuid": "74515d45-565b-4be2-96c4-77e58efa9257" + }, + { + "core": false, + "difficulty": 2, + "slug": "rna-transcription", + "topics": null, + "unlocked_by": null, + "uuid": "8e983ed2-62f7-439a-a144-fb8fdbdf4d30" + }, + { + "core": false, + "difficulty": 3, + "slug": "pangram", + "topics": null, + "unlocked_by": null, + "uuid": "133b0f84-bdc7-4508-a0a1-5732a7db81ef" + }, + { + "core": true, + "difficulty": 3, + "slug": "hamming", + "topics": [ + "strings", + "loops", + "integers" + ], + "unlocked_by": null, + "uuid": "ce899ca6-9cc7-47ba-b76f-1bbcf2630b76" + }, + { + "core": true, + "difficulty": 3, + "slug": "gigasecond", + "topics": [ + "dates", + "time", + "integers" + ], + "unlocked_by": null, + "uuid": "bf1641c8-dc0d-4d38-9cfe-b4c132ea3553" + }, + { + "core": false, + "difficulty": 3, + "slug": "space-age", + "topics": null, + "unlocked_by": null, + "uuid": "e5b524cd-3a1c-468a-8981-13e8eeccb29d" + }, + { + "core": false, + "difficulty": 3, + "slug": "acronym", + "topics": null, + "unlocked_by": null, + "uuid": "c31bbc6d-bdcf-44f7-bf35-5f98752e38d0" + }, + { + "core": true, + "difficulty": 3, + "slug": "scrabble-score", + "topics": null, + "unlocked_by": null, + "uuid": "afae9f2d-8baf-4bd7-8d7c-d486337f7c97" + }, + { + "core": false, + "difficulty": 3, + "slug": "raindrops", + "topics": null, + "unlocked_by": "hello-world", + "uuid": "d916e4f8-fda1-41c0-ab24-79e8fc3f1272" + }, + { + "core": true, + "difficulty": 3, + "slug": "difference-of-squares", + "topics": null, + "unlocked_by": null, + "uuid": "b0da59c6-1b55-405c-b163-007ebf09f5e8" + }, + { + "core": true, + "difficulty": 3, + "slug": "secret-handshake", + "topics": null, + "unlocked_by": null, + "uuid": "71c7c174-7e2c-43c2-bdd6-7515fcb12a91" + }, + { + "core": false, + "difficulty": 3, + "slug": "perfect-numbers", + "topics": null, + "unlocked_by": "difference-of-squares", + "uuid": "d0dcc898-ec38-4822-9e3c-1a1829c9b2d9" + }, + { + "core": false, + "difficulty": 4, + "slug": "sum-of-multiples", + "topics": null, + "unlocked_by": "difference-of-squares", + "uuid": "2f244afc-3e7b-4f89-92af-e2b427f4ef35" + }, + { + "core": false, + "difficulty": 4, + "slug": "luhn", + "topics": null, + "unlocked_by": "hamming", + "uuid": "5227a76c-8ecb-4e5f-b023-6af65a057c41" + }, + { + "core": true, + "difficulty": 4, + "slug": "matrix", + "topics": null, + "unlocked_by": null, + "uuid": "c1d4e0b4-6a0f-4be9-8222-345966621f53" + }, + { + "core": true, + "difficulty": 4, + "slug": "triangle", + "topics": null, + "unlocked_by": null, + "uuid": "ec268d8e-997b-4553-8c67-8bdfa1ecb888" + }, + { + "core": false, + "difficulty": 4, + "slug": "largest-series-product", + "topics": null, + "unlocked_by": "hamming", + "uuid": "b7310b6e-435c-4d5f-b2bd-31e586d0f238" + }, + { + "core": false, + "difficulty": 4, + "slug": "sieve", + "topics": null, + "unlocked_by": "difference-of-squares", + "uuid": "6791d01f-bae4-4b63-ae76-86529ac49e36" + }, + { + "core": false, + "difficulty": 4, + "slug": "twelve-days", + "topics": null, + "unlocked_by": "two-fer", + "uuid": "581afdbb-dfb6-4dc5-9554-a025b5469a3c" + }, + { + "core": true, + "difficulty": 4, + "slug": "rotational-cipher", + "topics": null, + "unlocked_by": null, + "uuid": "9eb41883-55ef-4681-b5ac-5c2259302772" + }, + { + "core": false, + "difficulty": 4, + "slug": "kindergarten-garden", + "topics": null, + "unlocked_by": "matrix", + "uuid": "0b92ffee-c092-4ab1-ad78-76c8cf80e1b5" + }, + { + "core": false, + "difficulty": 4, + "slug": "collatz-conjecture", + "topics": null, + "unlocked_by": "triangle", + "uuid": "1500d39a-c9d9-4d3a-9e77-fdc1837fc6ad" + }, + { + "core": false, + "difficulty": 4, + "slug": "nth-prime", + "topics": null, + "unlocked_by": "triangle", + "uuid": "2c69db99-648d-4bd7-8012-1fbdeff6ca0a" + }, + { + "core": true, + "difficulty": 4, + "slug": "saddle-points", + "topics": null, + "unlocked_by": null, + "uuid": "8dfc2f0d-1141-46e9-95e2-6f35ccf6f160" + }, + { + "core": false, + "difficulty": 4, + "slug": "diamond", + "topics": null, + "unlocked_by": "two-fer", + "uuid": "ecbd997b-86f4-4e11-9ff0-706ac2899415" + }, + { + "core": false, + "difficulty": 4, + "slug": "isogram", + "topics": null, + "unlocked_by": "hello-world", + "uuid": "c3e89c7c-3a8a-4ddc-b653-9b0ff9e1d7d8" + }, + { + "core": true, + "difficulty": 5, + "slug": "flatten-array", + "topics": null, + "unlocked_by": null, + "uuid": "a732a838-8170-458a-a85e-d6b4c46f97a1" + }, + { + "core": false, + "difficulty": 5, + "slug": "pig-latin", + "topics": null, + "unlocked_by": "hello-world", + "uuid": "38bc80ae-d842-4c04-a797-48edf322504d" + }, + { + "core": false, + "difficulty": 5, + "slug": "phone-number", + "topics": null, + "unlocked_by": "hamming", + "uuid": "5f9139e7-9fbb-496a-a0d7-a946283033de" + }, + { + "core": false, + "difficulty": 5, + "slug": "nucleotide-count", + "topics": null, + "unlocked_by": "hamming", + "uuid": "2d80fdfc-5bd7-4b67-9fbe-8ab820d89051" + }, + { + "core": true, + "difficulty": 5, + "slug": "word-count", + "topics": null, + "unlocked_by": null, + "uuid": "3603b770-87a5-4758-91f3-b4d1f9075bc1" + }, + { + "core": false, + "difficulty": 5, + "slug": "run-length-encoding", + "topics": null, + "unlocked_by": "rotational-cipher", + "uuid": "4499a3f9-73a7-48bf-8753-d5b6abf588c9" + }, + { + "core": true, + "difficulty": 5, + "slug": "robot-name", + "topics": null, + "unlocked_by": null, + "uuid": "d7c2eed9-64c7-4c4a-b45d-c787d460337f" + }, + { + "core": false, + "difficulty": 5, + "slug": "prime-factors", + "topics": null, + "unlocked_by": "triangle", + "uuid": "599c08ec-7338-46ed-99f8-a76f78f724e6" + }, + { + "core": false, + "difficulty": 5, + "slug": "allergies", + "topics": null, + "unlocked_by": "gigasecond", + "uuid": "6a617ddb-04e3-451c-bb30-27ccd0be9125" + }, + { + "core": false, + "difficulty": 5, + "slug": "bob", + "topics": [ + "strings", + "booleans", + "conditionals" + ], + "unlocked_by": "two-fer", + "uuid": "34cd328c-cd96-492b-abd4-2b8716cdcd9a" + }, + { + "core": false, + "difficulty": 5, + "slug": "pascals-triangle", + "topics": null, + "unlocked_by": "matrix", + "uuid": "d2a76905-1c8c-4b03-b4f7-4fbff19329f3" + }, + { + "core": false, + "difficulty": 5, + "slug": "bracket-push", + "topics": null, + "unlocked_by": "flatten-array", + "uuid": "85aa50ac-0141-49eb-bc6f-62f3f7a97647" + }, + { + "core": false, + "difficulty": 5, + "slug": "series", + "topics": null, + "unlocked_by": "hamming", + "uuid": "af80d7f4-c7d0-4d0b-9c30-09da120f6bb9" + }, + { + "core": false, + "difficulty": 5, + "slug": "atbash-cipher", + "topics": null, + "unlocked_by": "rotational-cipher", + "uuid": "d36ce010-210f-4e9a-9d6c-cb933e0a59af" + }, + { + "core": false, + "difficulty": 6, + "slug": "spiral-matrix", + "topics": null, + "unlocked_by": "matrix", + "uuid": "163fcc6b-c054-4232-a88b-0aded846a6eb" + }, + { + "core": false, + "difficulty": 6, + "slug": "roman-numerals", + "topics": null, + "unlocked_by": "hamming", + "uuid": "3e728cd4-5e5f-4c69-8a53-bc36d020fcdb" + }, + { + "core": false, + "difficulty": 6, + "slug": "transpose", + "topics": null, + "unlocked_by": "matrix", + "uuid": "57b76837-4610-466f-9373-d5c2697625f1" + }, + { + "core": false, + "difficulty": 6, + "slug": "house", + "topics": null, + "unlocked_by": "two-fer", + "uuid": "6b51aca3-3451-4a64-ad7b-00b151d7548a" + }, + { + "core": false, + "difficulty": 6, + "slug": "food-chain", + "topics": null, + "unlocked_by": "two-fer", + "uuid": "dd3e6fd6-5359-4978-acd7-c39374cead4d" + }, + { + "core": false, + "difficulty": 6, + "slug": "beer-song", + "topics": null, + "unlocked_by": "two-fer", + "uuid": "56943095-de76-40bf-b42b-fa3e70f8df5e" + }, + { + "core": false, + "difficulty": 6, + "slug": "queen-attack", + "topics": null, + "unlocked_by": "scrabble-score", + "uuid": "5404109e-3ed9-4691-8eaf-af8b36024a44" + }, + { + "core": false, + "difficulty": 6, + "slug": "etl", + "topics": null, + "unlocked_by": "word-count", + "uuid": "76d28d97-75d3-47eb-bb77-3d347b76f1b6" + }, + { + "core": true, + "difficulty": 6, + "slug": "linked-list", + "topics": null, + "unlocked_by": null, + "uuid": "7ba5084d-3b75-4406-a0d7-87c26387f9c0" + }, + { + "core": false, + "difficulty": 6, + "slug": "grade-school", + "topics": null, + "unlocked_by": "word-count", + "uuid": "b4af5da1-601f-4b0f-bfb8-4a381851090c" + }, + { + "core": false, + "difficulty": 6, + "slug": "robot-simulator", + "topics": null, + "unlocked_by": "secret-handshake", + "uuid": "993bde9d-7774-4e7a-a381-9eee75f28ecb" + }, + { + "core": true, + "difficulty": 6, + "slug": "binary-search", + "topics": null, + "unlocked_by": null, + "uuid": "50136dc3-caf7-4fa1-b7bd-0cba1bea9176" + }, + { + "core": false, + "difficulty": 6, + "slug": "minesweeper", + "topics": null, + "unlocked_by": "scrabble-score", + "uuid": "416a1489-12af-4593-8540-0f55285c96b4" + }, + { + "core": false, + "difficulty": 6, + "slug": "wordy", + "topics": null, + "unlocked_by": "secret-handshake", + "uuid": "3310a3cd-c0cb-45fa-8c51-600178be904a" + }, + { + "core": false, + "difficulty": 6, + "slug": "all-your-base", + "topics": null, + "unlocked_by": "saddle-points", + "uuid": "f7c2e4b5-1995-4dfe-b827-c9aff8ac5332" + }, + { + "core": true, + "difficulty": 6, + "slug": "bank-account", + "topics": null, + "unlocked_by": null, + "uuid": "a242efc5-159d-492b-861d-12a1459fb334" + }, + { + "core": false, + "difficulty": 6, + "slug": "bowling", + "topics": null, + "unlocked_by": "scrabble-score", + "uuid": "4b3f7771-c642-4278-a3d9-2fb958f26361" + }, + { + "core": false, + "difficulty": 7, + "slug": "anagram", + "topics": null, + "unlocked_by": "hello-world", + "uuid": "fb10dc2f-0ba1-44b6-8365-5e48e86d1283" + }, + { + "core": false, + "difficulty": 7, + "slug": "sublist", + "topics": null, + "unlocked_by": "linked-list", + "uuid": "d2aedbd7-092a-43d0-8a5e-ae3ebd5b9c7f" + }, + { + "core": false, + "difficulty": 7, + "slug": "word-search", + "topics": null, + "unlocked_by": "scrabble-score", + "uuid": "b53bde52-cb5f-4d43-86ec-18aa509d62f9" + }, + { + "core": false, + "difficulty": 7, + "slug": "simple-linked-list", + "topics": null, + "unlocked_by": "linked-list", + "uuid": "e3e5ffe5-cfc1-467e-a28a-da0302130144" + }, + { + "core": false, + "difficulty": 7, + "slug": "binary-search-tree", + "topics": null, + "unlocked_by": "binary-search", + "uuid": "0a2d18aa-7b5e-4401-a952-b93d2060694f" + }, + { + "core": false, + "difficulty": 7, + "slug": "meetup", + "topics": null, + "unlocked_by": "gigasecond", + "uuid": "602511d5-7e89-4def-b072-4dd311816810" + }, + { + "core": false, + "difficulty": 7, + "slug": "crypto-square", + "topics": null, + "unlocked_by": "rotational-cipher", + "uuid": "162bebdc-9bf2-43c0-8460-a91f5fc16147" + }, + { + "core": false, + "difficulty": 7, + "slug": "poker", + "topics": [ + "games", + "parsing", + "sorting" + ], + "unlocked_by": "scrabble-score", + "uuid": "57eeac00-741c-4843-907a-51f0ac5ea4cb" + }, + { + "core": false, + "difficulty": 7, + "slug": "clock", + "topics": null, + "unlocked_by": "saddle-points", + "uuid": "97c8fcd4-85b6-41cb-9de2-b4e1b4951222" + }, + { + "core": false, + "difficulty": 8, + "slug": "ocr-numbers", + "topics": null, + "unlocked_by": "robot-name", + "uuid": "5cbc6a67-3a53-4aad-ae68-ff469525437f" + }, + { + "core": false, + "difficulty": 8, + "slug": "circular-buffer", + "topics": [ + "classes", + "exception-handling", + "queues" + ], + "unlocked_by": "linked-list", + "uuid": "626dc25a-062c-4053-a8c1-788e4dc44ca0" + }, + { + "core": false, + "difficulty": 8, + "slug": "rectangles", + "topics": null, + "unlocked_by": "robot-name", + "uuid": "64cda115-919a-4eef-9a45-9ec5d1af98cc" + }, + { + "core": false, + "difficulty": 8, + "slug": "book-store", + "topics": null, + "unlocked_by": "flatten-array", + "uuid": "e5f05d00-fe5b-4d78-b2fa-934c1c9afb32" + }, + { + "core": false, + "difficulty": 8, + "slug": "simple-cipher", + "topics": null, + "unlocked_by": "rotational-cipher", + "uuid": "f654831f-c34b-44f5-9dd5-054efbb486f2" + }, + { + "core": false, + "difficulty": 8, + "slug": "complex-numbers", + "topics": null, + "unlocked_by": "triangle", + "uuid": "52d11278-0d65-4b5b-b387-1374fced3243" + }, + { + "core": false, + "difficulty": 8, + "slug": "list-ops", + "topics": null, + "unlocked_by": "linked-list", + "uuid": "a9836565-5c39-4285-b83a-53408be36ccc" + }, + { + "core": false, + "difficulty": 8, + "slug": "change", + "topics": null, + "unlocked_by": "flatten-array", + "uuid": "bac1f4bc-eea9-43c1-8e95-097347f5925e" + }, + { + "core": false, + "difficulty": 8, + "slug": "palindrome-products", + "topics": null, + "unlocked_by": "saddle-points", + "uuid": "873c05de-b5f5-4c5b-97f0-d1ede8a82832" + }, + { + "core": false, + "difficulty": 9, + "slug": "pythagorean-triplet", + "topics": null, + "unlocked_by": "triangle", + "uuid": "88505f95-89e5-4a08-8ed2-208eb818cdf1" + }, + { + "core": false, + "difficulty": 9, + "slug": "forth", + "topics": null, + "unlocked_by": "secret-handshake", + "uuid": "f0c0316d-3fb5-455e-952a-91161e7fb298" + }, + { + "core": false, + "difficulty": 10, + "slug": "custom-set", + "topics": null, + "unlocked_by": "linked-list", + "uuid": "377fe38b-08ad-4f3a-8118-a43c10f7b9b2" + }, + { + "deprecated": true, + "slug": "accumulate", + "uuid": "e58c29d2-80a7-40ef-bed0-4a184ae35f34" + }, + { + "deprecated": true, + "slug": "binary", + "uuid": "9ea6e0fa-b91d-4d17-ac8f-6d2dc30fdd44" + }, + { + "deprecated": true, + "slug": "hexadecimal", + "uuid": "6fe53a08-c123-465d-864a-ef18217203c4" + }, + { + "deprecated": true, + "slug": "octal", + "uuid": "14a29e82-f9b1-4662-b678-06992e306c01" + }, + { + "deprecated": true, + "slug": "strain", + "uuid": "2d195cd9-1814-490a-8dd6-a2c676f1d4cd" + }, + { + "deprecated": true, + "slug": "trinary", + "uuid": "ee3a8abe-6b19-4b47-9cf6-4d39ae915fb7" + } + ], + "foregone": [ + "leap", + "grains", + "say" + ], + "language": "Java", + "solution_pattern": "reference" +} From 76d0ee8e3fae911f06f756ae2a65b5958e6d589f Mon Sep 17 00:00:00 2001 From: Sam Warner Date: Sat, 23 Dec 2017 09:37:22 +0000 Subject: [PATCH 09/11] rail-fence-encoding: add to config.json --- config.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config.json b/config.json index 790af865d..f144c3f18 100644 --- a/config.json +++ b/config.json @@ -483,6 +483,18 @@ "unlocked_by": "scrabble-score", "uuid": "4b3f7771-c642-4278-a3d9-2fb958f26361" }, + { + "core": false, + "difficulty": 6, + "slug": "rail-fence-cipher", + "topics": [ + "strings", + "loops", + "conditionals" + ], + "unlocked_by": "atbash-cipher", + "uuid": "6e4ad4ed-cc02-4132-973d-b9163ba0ea3d" + }, { "core": false, "difficulty": 7, From 909418f8db3f7f9693d2c68f371e44b7436366f6 Mon Sep 17 00:00:00 2001 From: Sam Warner Date: Sun, 24 Dec 2017 18:23:11 +0000 Subject: [PATCH 10/11] rail-fence-cipher: improve reference solution --- .../src/reference/java/RailFenceCipher.java | 104 ++++++++---------- 1 file changed, 47 insertions(+), 57 deletions(-) diff --git a/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java b/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java index 06cf294f4..d9bcd3e6b 100644 --- a/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java +++ b/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java @@ -1,74 +1,64 @@ -import java.util.ArrayList; -import java.util.List; +public class RailFenceCipher { -class RailFenceCipher { + private static int key; - private int noOfRails; - - RailFenceCipher(int noOfRails) { - this.noOfRails = noOfRails; + public RailFenceCipher(int key) { + RailFenceCipher.key = key; } - String getEncryptedData(String plainText) { - List railFence = new ArrayList<>(); - for (int i = 0; i < noOfRails; i++) { - railFence.add(""); - } - - int number = 0, increment = 1; - for (char c : plainText.toCharArray()) { - if (number + increment == noOfRails) { - increment = -1; - } else if (number + increment == -1) { - increment = 1; - } - String temp = railFence.get(number); - railFence.remove(number); - railFence.add(number, temp + c); - number += increment; + public static String getEncryptedData(String message) { + String[] lines = splitIntoLines(message, false); + String result = ""; + for (String line : lines) { + result += line; } - String buffer = ""; - for (String s : railFence) { - buffer = buffer.concat(s); - } - return buffer; + return result; } - String getDecryptedData(String cipherText) { - String decrypted; - ArrayList> railFence = new ArrayList<>(noOfRails); - - for (int i = 0; i < noOfRails; ++i) { - railFence.add(new ArrayList<>(cipherText.length())); - } - - int rowIncrementFactor = 0, step = 1; + public static String getDecryptedData(String message) { + String[] lines = splitIntoLines(message, true); - for (int i = 0; i < cipherText.length(); ++i) { - if (rowIncrementFactor + step == noOfRails) { - step = -1; - } else if (rowIncrementFactor + step == -1) { - step = 1; + int charCount = 0; + for (int i = 0; i < key; ++i) { + while (lines[i].contains("?")) { + String letter = String.valueOf(message.charAt(charCount)); + lines[i] = lines[i].replaceFirst("\\?", letter); + charCount++; } - - railFence.get(rowIncrementFactor).add(i); - rowIncrementFactor += step; } - int counter = 0; - ArrayList buffer = new ArrayList<>(cipherText.length()); - for (int i = 0; i < cipherText.length(); ++i) { - buffer.add('a'); + String result = ""; + int lineCount = 0; + int direction = -1; + for (int i = 0; i < message.length(); ++i) { + String letter = String.valueOf(lines[lineCount].charAt(0)); + lines[lineCount] = lines[lineCount].substring(1); + result += letter; + direction *= lineCount == 0 || lineCount == key - 1 ? -1 : 1; + lineCount += direction; } + return result; + } - for (int i = 0; i < noOfRails; ++i) { - for (int j = 0; j < railFence.get(i).size(); ++j) { - buffer.set(railFence.get(i).get(j), cipherText.charAt(counter)); - counter++; - } + private static String[] splitIntoLines(String message, boolean encrypted) { + String[] result = generateEmptyStrings(key); + int lineCount = 0; + int direction = -1; + for (char c : message.toCharArray()) { + String letter = String.valueOf(c); + result[lineCount] += encrypted ? "?" : letter; + direction *= lineCount == 0 || lineCount == key - 1 ? -1 : 1; + lineCount += direction; } + return result; + } - decrypted = buffer.toString().replaceAll(",", "").replaceAll("\\s+", "").replace("[", "").replace("]", ""); - return decrypted; + private static String[] generateEmptyStrings(int num) { + String[] strings = new String[num]; + for (int i = 0; i < num; ++i) { + strings[i] = ""; + } + return strings; } + } From 9917119bafd72425b70550bd0bc2d3fd37cc76aa Mon Sep 17 00:00:00 2001 From: Sam Warner Date: Tue, 26 Dec 2017 14:45:20 +0000 Subject: [PATCH 11/11] rail-fence-cipher: update with @FridaTveit's suggestions. --- config.json | 2 +- .../src/reference/java/RailFenceCipher.java | 34 ++++---- exercises/rail-fence-cipher/README.md | 78 +++++++++++++++++++ 3 files changed, 96 insertions(+), 18 deletions(-) create mode 100644 exercises/rail-fence-cipher/README.md diff --git a/config.json b/config.json index f144c3f18..b76317a94 100644 --- a/config.json +++ b/config.json @@ -492,7 +492,7 @@ "loops", "conditionals" ], - "unlocked_by": "atbash-cipher", + "unlocked_by": "rotational-cipher", "uuid": "6e4ad4ed-cc02-4132-973d-b9163ba0ea3d" }, { diff --git a/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java b/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java index d9bcd3e6b..0a165a36c 100644 --- a/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java +++ b/exercises/rail-fence-cipher/.meta/src/reference/java/RailFenceCipher.java @@ -1,21 +1,23 @@ -public class RailFenceCipher { +import java.util.Arrays; - private static int key; +class RailFenceCipher { - public RailFenceCipher(int key) { - RailFenceCipher.key = key; + private int key; + + RailFenceCipher(int key) { + this.key = key; } - public static String getEncryptedData(String message) { + String getEncryptedData(String message) { String[] lines = splitIntoLines(message, false); - String result = ""; + StringBuilder result = new StringBuilder(); for (String line : lines) { - result += line; + result.append(line); } - return result; + return result.toString(); } - public static String getDecryptedData(String message) { + String getDecryptedData(String message) { String[] lines = splitIntoLines(message, true); int charCount = 0; @@ -27,20 +29,20 @@ public static String getDecryptedData(String message) { } } - String result = ""; + StringBuilder result = new StringBuilder(); int lineCount = 0; int direction = -1; for (int i = 0; i < message.length(); ++i) { String letter = String.valueOf(lines[lineCount].charAt(0)); lines[lineCount] = lines[lineCount].substring(1); - result += letter; + result.append(letter); direction *= lineCount == 0 || lineCount == key - 1 ? -1 : 1; lineCount += direction; } - return result; + return result.toString(); } - private static String[] splitIntoLines(String message, boolean encrypted) { + private String[] splitIntoLines(String message, boolean encrypted) { String[] result = generateEmptyStrings(key); int lineCount = 0; int direction = -1; @@ -53,11 +55,9 @@ private static String[] splitIntoLines(String message, boolean encrypted) { return result; } - private static String[] generateEmptyStrings(int num) { + private String[] generateEmptyStrings(int num) { String[] strings = new String[num]; - for (int i = 0; i < num; ++i) { - strings[i] = ""; - } + Arrays.fill(strings, ""); return strings; } diff --git a/exercises/rail-fence-cipher/README.md b/exercises/rail-fence-cipher/README.md new file mode 100644 index 000000000..3b9a2035f --- /dev/null +++ b/exercises/rail-fence-cipher/README.md @@ -0,0 +1,78 @@ +# Rail Fence Cipher + +Implement encoding and decoding for the rail fence cipher. + +The Rail Fence cipher is a form of transposition cipher that gets its name from +the way in which it's encoded. It was already used by the ancient Greeks. + +In the Rail Fence cipher, the message is written downwards on successive "rails" +of an imaginary fence, then moving up when we get to the bottom (like a zig-zag). +Finally the message is then read off in rows. + +For example, using three "rails" and the message "WE ARE DISCOVERED FLEE AT ONCE", +the cipherer writes out: + +```text +W . . . E . . . C . . . R . . . L . . . T . . . E +. E . R . D . S . O . E . E . F . E . A . O . C . +. . A . . . I . . . V . . . D . . . E . . . N . . +``` + +Then reads off: + +```text +WECRLTEERDSOEEFEAOCAIVDEN +``` + +To decrypt a message you take the zig-zag shape and fill the ciphertext along the rows. + +```text +? . . . ? . . . ? . . . ? . . . ? . . . ? . . . ? +. ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . +. . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . +``` + +The first row has seven spots that can be filled with "WECRLTE". + +```text +W . . . E . . . C . . . R . . . L . . . T . . . E +. ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . +. . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . +``` + +Now the 2nd row takes "ERDSOEEFEAOC". + +```text +W . . . E . . . C . . . R . . . L . . . T . . . E +. E . R . D . S . O . E . E . F . E . A . O . C . +. . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . +``` + +Leaving "AIVDEN" for the last row. + +```text +W . . . E . . . C . . . R . . . L . . . T . . . E +. E . R . D . S . O . E . E . F . E . A . O . C . +. . A . . . I . . . V . . . D . . . E . . . N . . +``` + +If you now read along the zig-zag shape you can read the original message. + + + +To run the tests: + +```sh +$ gradle test +``` + +For more detailed info about the Java track see the [help page](http://exercism.io/languages/java). + + +## Source + +[Wikipedia](https://en.wikipedia.org/wiki/Transposition_cipher#Rail_Fence_cipher) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. +i