trackler 2.2.1.10 → 2.2.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/lib/trackler/version.rb +1 -1
  4. data/problem-specifications/CONTRIBUTING.md +1 -1
  5. data/problem-specifications/TOPICS.txt +1 -0
  6. data/problem-specifications/exercises/accumulate/description.md +0 -3
  7. data/problem-specifications/exercises/hamming/canonical-data.json +3 -3
  8. data/problem-specifications/exercises/house/canonical-data.json +322 -0
  9. data/problem-specifications/exercises/palindrome-products/description.md +2 -2
  10. data/problem-specifications/exercises/simple-cipher/description.md +1 -1
  11. data/tracks/bash/config.json +0 -11
  12. data/tracks/cpp/docs/ABOUT.md +12 -37
  13. data/tracks/csharp/config.json +37 -0
  14. data/tracks/csharp/config/maintainers.json +10 -0
  15. data/tracks/csharp/docs/ABOUT.md +1 -1
  16. data/tracks/csharp/docs/RESOURCES.md +2 -2
  17. data/tracks/csharp/exercises/Exercises.All.sln +50 -8
  18. data/tracks/csharp/exercises/Exercises.Default.sln +50 -8
  19. data/tracks/csharp/exercises/collatz-conjecture/CollatzConjecture.cs +9 -0
  20. data/tracks/csharp/exercises/collatz-conjecture/CollatzConjecture.csproj +18 -0
  21. data/tracks/csharp/exercises/collatz-conjecture/CollatzConjectureTest.cs +43 -0
  22. data/tracks/csharp/exercises/collatz-conjecture/Example.cs +30 -0
  23. data/tracks/csharp/exercises/collatz-conjecture/README.md +38 -0
  24. data/tracks/csharp/exercises/diamond/Diamond.cs +1 -1
  25. data/tracks/csharp/exercises/diamond/Diamond.csproj +3 -1
  26. data/tracks/csharp/exercises/diamond/DiamondTest.cs +39 -21
  27. data/tracks/csharp/exercises/diamond/Example.cs +2 -2
  28. data/tracks/csharp/exercises/diamond/HINTS.md +3 -1
  29. data/tracks/csharp/exercises/spiral-matrix/Example.cs +40 -0
  30. data/tracks/csharp/exercises/spiral-matrix/README.md +36 -0
  31. data/tracks/csharp/exercises/spiral-matrix/SpiralMatrix.cs +9 -0
  32. data/tracks/csharp/exercises/spiral-matrix/SpiralMatrix.csproj +18 -0
  33. data/tracks/csharp/exercises/spiral-matrix/SpiralMatrixTest.cs +78 -0
  34. data/tracks/csharp/exercises/two-fer/Example.cs +16 -0
  35. data/tracks/csharp/exercises/two-fer/README.md +25 -0
  36. data/tracks/csharp/exercises/two-fer/TwoFer.cs +9 -0
  37. data/tracks/csharp/exercises/two-fer/TwoFer.csproj +18 -0
  38. data/tracks/csharp/exercises/two-fer/TwoFerTest.cs +24 -0
  39. data/tracks/dart/README.md +1 -1
  40. data/tracks/dart/docs/EXERCISE_README_INSERT.md +9 -0
  41. data/tracks/dart/docs/INSTALLATION.md +13 -0
  42. data/tracks/dart/docs/LEARNING.md +6 -0
  43. data/tracks/dart/docs/RESOURCES.md +7 -0
  44. data/tracks/dart/docs/TESTS.md +133 -0
  45. data/tracks/delphi/docs/ABOUT.md +18 -5
  46. data/tracks/delphi/docs/Getting_Started_Guide.md +930 -0
  47. data/tracks/delphi/exercises/hamming/uHammingExample.pas +1 -1
  48. data/tracks/delphi/exercises/hamming/uHammingTests.pas +15 -15
  49. data/tracks/ecmascript/.travis.yml +2 -1
  50. data/tracks/ecmascript/Makefile +19 -8
  51. data/tracks/ecmascript/config.json +16 -0
  52. data/tracks/ecmascript/exercises/accumulate/package.json +5 -5
  53. data/tracks/ecmascript/exercises/acronym/package.json +5 -5
  54. data/tracks/ecmascript/exercises/all-your-base/package.json +5 -5
  55. data/tracks/ecmascript/exercises/allergies/package.json +5 -5
  56. data/tracks/ecmascript/exercises/alphametics/package.json +5 -5
  57. data/tracks/ecmascript/exercises/anagram/package.json +5 -5
  58. data/tracks/ecmascript/exercises/atbash-cipher/package.json +5 -5
  59. data/tracks/ecmascript/exercises/beer-song/package.json +5 -5
  60. data/tracks/ecmascript/exercises/binary-search-tree/package.json +5 -5
  61. data/tracks/ecmascript/exercises/binary-search/package.json +5 -5
  62. data/tracks/ecmascript/exercises/binary/package.json +5 -5
  63. data/tracks/ecmascript/exercises/bob/package.json +5 -5
  64. data/tracks/ecmascript/exercises/bracket-push/package.json +5 -5
  65. data/tracks/ecmascript/exercises/circular-buffer/package.json +5 -5
  66. data/tracks/ecmascript/exercises/clock/package.json +5 -5
  67. data/tracks/ecmascript/exercises/connect/package.json +5 -5
  68. data/tracks/ecmascript/exercises/crypto-square/package.json +5 -5
  69. data/tracks/ecmascript/exercises/custom-set/package.json +5 -5
  70. data/tracks/ecmascript/exercises/diamond/package.json +5 -5
  71. data/tracks/ecmascript/exercises/difference-of-squares/package.json +5 -5
  72. data/tracks/ecmascript/exercises/diffie-hellman/package.json +5 -5
  73. data/tracks/ecmascript/exercises/etl/package.json +5 -5
  74. data/tracks/ecmascript/exercises/flatten-array/package.json +5 -5
  75. data/tracks/ecmascript/exercises/food-chain/package.json +5 -5
  76. data/tracks/ecmascript/exercises/gigasecond/package.json +5 -5
  77. data/tracks/ecmascript/exercises/grade-school/package.json +5 -5
  78. data/tracks/ecmascript/exercises/grains/package.json +5 -5
  79. data/tracks/ecmascript/exercises/hamming/package.json +5 -5
  80. data/tracks/ecmascript/exercises/hello-world/package.json +5 -5
  81. data/tracks/ecmascript/exercises/hexadecimal/package.json +5 -5
  82. data/tracks/ecmascript/exercises/isogram/package.json +5 -5
  83. data/tracks/ecmascript/exercises/kindergarten-garden/package.json +5 -5
  84. data/tracks/ecmascript/exercises/largest-series-product/package.json +5 -5
  85. data/tracks/ecmascript/exercises/leap/package.json +5 -5
  86. data/tracks/ecmascript/exercises/linked-list/package.json +5 -5
  87. data/tracks/ecmascript/exercises/list-ops/package.json +5 -5
  88. data/tracks/ecmascript/exercises/luhn/package.json +5 -5
  89. data/tracks/ecmascript/exercises/matrix/package.json +5 -5
  90. data/tracks/ecmascript/exercises/meetup/package.json +5 -5
  91. data/tracks/ecmascript/exercises/minesweeper/package.json +5 -5
  92. data/tracks/ecmascript/exercises/nth-prime/package.json +5 -5
  93. data/tracks/ecmascript/exercises/ocr-numbers/package.json +5 -5
  94. data/tracks/ecmascript/exercises/octal/package.json +5 -5
  95. data/tracks/ecmascript/exercises/palindrome-products/package.json +5 -5
  96. data/tracks/ecmascript/exercises/pangram/package.json +5 -5
  97. data/tracks/ecmascript/exercises/pascals-triangle/package.json +5 -5
  98. data/tracks/ecmascript/exercises/perfect-numbers/package.json +5 -5
  99. data/tracks/ecmascript/exercises/phone-number/package.json +5 -5
  100. data/tracks/ecmascript/exercises/pig-latin/package.json +5 -5
  101. data/tracks/ecmascript/exercises/prime-factors/package.json +5 -5
  102. data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +5 -5
  103. data/tracks/ecmascript/exercises/queen-attack/package.json +5 -5
  104. data/tracks/ecmascript/exercises/raindrops/package.json +5 -5
  105. data/tracks/ecmascript/exercises/rna-transcription/package.json +5 -5
  106. data/tracks/ecmascript/exercises/robot-name/package.json +5 -5
  107. data/tracks/ecmascript/exercises/robot-simulator/package.json +5 -5
  108. data/tracks/ecmascript/exercises/roman-numerals/package.json +5 -5
  109. data/tracks/ecmascript/exercises/run-length-encoding/README.md +59 -0
  110. data/tracks/ecmascript/exercises/run-length-encoding/example.js +13 -0
  111. data/tracks/ecmascript/exercises/run-length-encoding/package.json +69 -0
  112. data/tracks/ecmascript/exercises/run-length-encoding/run-length-encoding.spec.js +59 -0
  113. data/tracks/ecmascript/exercises/saddle-points/package.json +5 -5
  114. data/tracks/ecmascript/exercises/say/package.json +5 -5
  115. data/tracks/ecmascript/exercises/scrabble-score/package.json +5 -5
  116. data/tracks/ecmascript/exercises/secret-handshake/package.json +5 -5
  117. data/tracks/ecmascript/exercises/series/package.json +5 -5
  118. data/tracks/ecmascript/exercises/sieve/package.json +5 -5
  119. data/tracks/ecmascript/exercises/simple-cipher/package.json +5 -5
  120. data/tracks/ecmascript/exercises/space-age/package.json +5 -5
  121. data/tracks/ecmascript/exercises/strain/package.json +5 -5
  122. data/tracks/ecmascript/exercises/sublist/package.json +5 -5
  123. data/tracks/ecmascript/exercises/sum-of-multiples/package.json +5 -5
  124. data/tracks/ecmascript/exercises/triangle/package.json +5 -5
  125. data/tracks/ecmascript/exercises/trinary/package.json +5 -5
  126. data/tracks/ecmascript/exercises/twelve-days/package.json +6 -5
  127. data/tracks/ecmascript/exercises/two-bucket/package.json +5 -5
  128. data/tracks/ecmascript/exercises/word-count/package.json +5 -5
  129. data/tracks/ecmascript/exercises/wordy/package.json +5 -5
  130. data/tracks/ecmascript/package.json +5 -5
  131. data/tracks/ecmascript/yarn.lock +403 -152
  132. data/tracks/elixir/docs/ABOUT.md +7 -20
  133. data/tracks/erlang/docs/ABOUT.md +4 -6
  134. data/tracks/fsharp/config.json +2 -1
  135. data/tracks/fsharp/docs/ABOUT.md +6 -2
  136. data/tracks/gnu-apl/.gitignore +4 -0
  137. data/tracks/gnu-apl/.travis.yml +5 -0
  138. data/tracks/gnu-apl/LICENSE +21 -0
  139. data/tracks/gnu-apl/README.md +67 -0
  140. data/tracks/gnu-apl/bin/fetch-configlet +32 -0
  141. data/tracks/gnu-apl/config.json +15 -0
  142. data/tracks/{scala/exercises/binary-search/src/main/scala/BinarySearch.scala → gnu-apl/config/exercise-readme-insert.md} +0 -0
  143. data/tracks/gnu-apl/config/exercise-readme.go.tmpl +16 -0
  144. data/tracks/gnu-apl/config/maintainers.json +6 -0
  145. data/tracks/gnu-apl/docs/ABOUT.md +0 -0
  146. data/tracks/gnu-apl/docs/INSTALLATION.md +0 -0
  147. data/tracks/gnu-apl/docs/LEARNING.md +0 -0
  148. data/tracks/gnu-apl/docs/RESOURCES.md +0 -0
  149. data/tracks/gnu-apl/docs/TESTS.md +0 -0
  150. data/tracks/gnu-apl/img/.keep +0 -0
  151. data/tracks/go/docs/ABOUT.md +4 -2
  152. data/tracks/go/exercises/pangram/example.go +1 -1
  153. data/tracks/go/exercises/pangram/pangram.go +1 -1
  154. data/tracks/go/exercises/pangram/pangram_test.go +1 -3
  155. data/tracks/groovy/README.md +2 -0
  156. data/tracks/groovy/config.json +25 -20
  157. data/tracks/groovy/docs/ABOUT.md +10 -3
  158. data/tracks/groovy/exercises/difference-of-squares/DifferenceOfSquares.groovy +19 -0
  159. data/tracks/groovy/exercises/difference-of-squares/{SquaresSpec.groovy → DifferenceOfSquaresSpec.groovy} +3 -3
  160. data/tracks/groovy/exercises/difference-of-squares/Example.groovy +1 -1
  161. data/tracks/groovy/exercises/hamming/Hamming.groovy +7 -0
  162. data/tracks/groovy/exercises/leap/Example.groovy +2 -2
  163. data/tracks/groovy/exercises/leap/Leap.groovy +11 -0
  164. data/tracks/groovy/exercises/leap/LeapSpec.groovy +4 -4
  165. data/tracks/groovy/exercises/nth-prime/Example.groovy +1 -1
  166. data/tracks/groovy/exercises/nth-prime/NthPrime.groovy +7 -0
  167. data/tracks/groovy/exercises/nth-prime/{PrimeSpec.groovy → NthPrimeSpec.groovy} +6 -6
  168. data/tracks/groovy/exercises/phone-number/PhoneNumber.groovy +17 -0
  169. data/tracks/groovy/exercises/raindrops/Raindrops.groovy +7 -0
  170. data/tracks/groovy/exercises/rna-transcription/Example.groovy +1 -1
  171. data/tracks/groovy/exercises/rna-transcription/RnaTranscription.groovy +7 -0
  172. data/tracks/groovy/exercises/rna-transcription/{ComplementSpec.groovy → RnaTranscriptionSpec.groovy} +2 -2
  173. data/tracks/groovy/exercises/robot-name/Example.groovy +2 -2
  174. data/tracks/groovy/exercises/robot-name/RobotName.groovy +9 -0
  175. data/tracks/groovy/exercises/robot-name/{RobotSpec.groovy → RobotNameSpec.groovy} +6 -6
  176. data/tracks/groovy/exercises/roman-numerals/Example.groovy +2 -2
  177. data/tracks/groovy/exercises/roman-numerals/RomanNumerals.groovy +7 -0
  178. data/tracks/groovy/exercises/roman-numerals/{RomanSpec.groovy → RomanNumeralsSpec.groovy} +2 -2
  179. data/tracks/groovy/exercises/word-count/Example.groovy +2 -2
  180. data/tracks/groovy/exercises/word-count/{Phrase.groovy → WordCount.groovy} +2 -2
  181. data/tracks/groovy/exercises/word-count/WordCountSpec.groovy +47 -0
  182. data/tracks/java/config.json +84 -74
  183. data/tracks/java/docs/ABOUT.md +11 -5
  184. data/tracks/java/exercises/house/README.md +124 -0
  185. data/tracks/java/exercises/house/build.gradle +18 -0
  186. data/tracks/java/exercises/house/src/example/java/House.java +55 -0
  187. data/tracks/java/exercises/house/src/main/java/.keep +0 -0
  188. data/tracks/java/exercises/house/src/test/java/HouseTest.java +341 -0
  189. data/tracks/java/exercises/minesweeper/src/example/java/MinesweeperBoard.java +3 -3
  190. data/tracks/java/exercises/series/src/test/java/SeriesTest.java +6 -5
  191. data/tracks/java/exercises/settings.gradle +1 -0
  192. data/tracks/java/exercises/two-fer/src/test/java/TwoferTest.java +9 -0
  193. data/tracks/javascript/exercises/circular-buffer/circular-buffer.spec.js +8 -0
  194. data/tracks/javascript/exercises/simple-cipher/README.md +1 -1
  195. data/tracks/kotlin/docs/ABOUT.md +7 -10
  196. data/tracks/lisp/.travis.yml +26 -11
  197. data/tracks/purescript/docs/ABOUT.md +16 -0
  198. data/tracks/r/config.json +1 -1
  199. data/tracks/r/config/maintainers.json +9 -9
  200. data/tracks/r/docs/ABOUT.md +9 -11
  201. data/tracks/r/docs/snippet.txt +10 -0
  202. data/tracks/ruby/docs/ABOUT.md +5 -5
  203. data/tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb +1 -2
  204. data/tracks/ruby/exercises/space-age/.meta/generator/space_age_case.rb +1 -2
  205. data/tracks/ruby/exercises/sum-of-multiples/.meta/generator/sum_of_multiples_case.rb +1 -1
  206. data/tracks/ruby/lib/generator/exercise_case.rb +15 -0
  207. data/tracks/scala/exercises/alphametics/src/test/scala/AlphameticsTest.scala +42 -28
  208. data/tracks/scala/exercises/binary-search/example.scala +1 -1
  209. data/tracks/scala/exercises/binary-search/src/main/scala/.keep +0 -0
  210. data/tracks/scala/exercises/binary-search/src/test/scala/BinarySearchTest.scala +13 -22
  211. data/tracks/scala/exercises/bowling/src/main/scala/.keep +0 -0
  212. data/tracks/scala/exercises/bowling/src/test/scala/BowlingSuite.scala +30 -17
  213. data/tracks/scala/exercises/change/src/test/scala/ChangeTest.scala +14 -4
  214. data/tracks/scala/exercises/custom-set/src/test/scala/CustomSetTest.scala +6 -4
  215. data/tracks/scala/exercises/food-chain/example.scala +4 -2
  216. data/tracks/scala/exercises/food-chain/src/test/scala/FoodChainTest.scala +170 -59
  217. data/tracks/scala/exercises/luhn/example.scala +9 -21
  218. data/tracks/scala/exercises/luhn/src/test/scala/LuhnTest.scala +46 -10
  219. data/tracks/scala/testgen/src/main/scala/AlphametricsTestGenerator.scala +42 -0
  220. data/tracks/scala/testgen/src/main/scala/BinarySearchTestGenerator.scala +32 -42
  221. data/tracks/scala/testgen/src/main/scala/BowlingTestGenerator.scala +22 -7
  222. data/tracks/scala/testgen/src/main/scala/ChangeTestGenerator.scala +37 -0
  223. data/tracks/scala/testgen/src/main/scala/CustomSetTestGenerator.scala +25 -20
  224. data/tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala +13 -2
  225. data/tracks/scala/testgen/src/main/scala/LuhnTestGenerator.scala +15 -0
  226. data/tracks/scala/testgen/src/main/scala/TestBuilder.scala +10 -0
  227. data/tracks/sml/.travis.yml +9 -2
  228. data/tracks/sml/Makefile +42 -0
  229. data/tracks/sml/docs/EXERCISE_README_INSERT.md +21 -5
  230. data/tracks/sml/docs/RESOURCES.md +1 -1
  231. data/tracks/sml/docs/TESTS.md +2 -2
  232. metadata +67 -17
  233. data/tracks/bash/exercises/word-count/README.md +0 -24
  234. data/tracks/bash/exercises/word-count/example.awk +0 -12
  235. data/tracks/bash/exercises/word-count/example.sh +0 -21
  236. data/tracks/dart/.github/PULL_REQUEST_TEMPLATE.md +0 -23
  237. data/tracks/ecmascript/.babelrc +0 -3
  238. data/tracks/groovy/exercises/roman-numerals/Roman.groovy +0 -33
  239. data/tracks/groovy/exercises/word-count/PhraseSpec.groovy +0 -47
  240. data/tracks/scala/exercises/bowling/src/main/scala/Bowling.scala +0 -11
@@ -4,7 +4,7 @@
4
4
  2. [Class-Based](https://en.wikipedia.org/wiki/Class-based_programming)
5
5
  3. [Object-Oriented](https://en.wikipedia.org/wiki/Object-oriented_programming)
6
6
 
7
- It has been specifically designed to have as few [implementation dependencies](http://www.java-tips.org/other-api-tips-100035/60-netbeans/1025-what-is-an-implementation-dependency-and-whathowwhen-should-i-use-one.html) as possible. Java applications are typically compiled to [bytecode](https://en.wikipedia.org/wiki/Bytecode) that can run on any [Java virtual machine](https://en.wikipedia.org/wiki/Java_virtual_machine) (JVM) regardless of computer architecture.
7
+ Java applications are typically compiled to [bytecode](https://en.wikipedia.org/wiki/Bytecode) that can run on any [Java virtual machine](https://en.wikipedia.org/wiki/Java_virtual_machine) (JVM) regardless of computer architecture.
8
8
 
9
9
  The primary goals kept in mind during the making of the language were:
10
10
 
@@ -18,12 +18,18 @@ The language derives much of its syntax from C and C++, but it has fewer low-lev
18
18
 
19
19
  ## Why Learn Java?
20
20
 
21
- - JAVA IS EVERYWHERE. It is one of the most sought after programming languages. It is a standard for enterprise software, web-based content, games and mobile apps, as well as the [Android operating system](https://developer.android.com/index.html).
21
+ - JAVA IS EVERYWHERE.
22
+ It is one of the most sought after programming languages.
23
+ It is a standard for enterprise software, web-based content, games and mobile apps, as well as the [Android operating system](https://developer.android.com/index.html).
22
24
 
23
- - [Write once, run anywhere](https://en.wikipedia.org/wiki/Write_once,_run_anywhere) policy: Programs written in Java are compiled into machine-independent bytecodes, so it can run on any Java platform. Basically, Java is [Platform Independent](https://en.wikipedia.org/wiki/Cross-platform#Platform-independent_software)
25
+ - [Write once, run anywhere](https://en.wikipedia.org/wiki/Write_once,_run_anywhere) policy: Programs written in Java are compiled into machine-independent bytecodes, so it can run on any Java platform.
26
+ Basically, Java is [Platform Independent](https://en.wikipedia.org/wiki/Cross-platform#Platform-independent_software)
24
27
 
25
28
  - Java has rich APIs:
26
- Java has built-in [application programming interfaces](https://en.wikipedia.org/wiki/Application_programming_interface) (APIs) for I/O, networking, data structures, concurrency, and many other functions. Standard libraries can be supplemented by open source libraries like Apache Commons, Google Guava, Netty and others.
29
+ Java has built-in [application programming interfaces](https://en.wikipedia.org/wiki/Application_programming_interface) (APIs) for I/O, networking, data structures, concurrency, and many other functions.
30
+ Standard libraries can be supplemented by open source libraries like Apache Commons, Google Guava, Netty and others.
27
31
 
28
32
  - Standardization:
29
- If you need to write a web/enterprise app, or you need data persistence or you need to do cryptography, no problem! Java is all you require. There are many standard tools/practices that extend the Java ecosystem, thanks to the [Java Community Process](https://www.jcp.org/en/introduction/overview) (JCP)!
33
+ If you need to write a web/enterprise app, or you need data persistence or you need to do cryptography, no problem!
34
+ Java is all you require.
35
+ There are many standard tools/practices that extend the Java ecosystem, thanks to the [Java Community Process](https://www.jcp.org/en/introduction/overview) (JCP)!
@@ -0,0 +1,124 @@
1
+ # House
2
+
3
+ Output the nursery rhyme 'This is the House that Jack Built'.
4
+
5
+ > [The] process of placing a phrase of clause within another phrase of
6
+ > clause is called embedding. It is through the processes of recursion
7
+ > and embedding that we are able to take a finite number of forms (words
8
+ > and phrases) and construct an infinite number of expressions.
9
+ > Furthermore, embedding also allows us to construct an infinitely long
10
+ > structure, in theory anyway.
11
+
12
+ - [papyr.com](http://papyr.com/hypertextbooks/grammar/ph_noun.htm)
13
+
14
+
15
+ The nursery rhyme reads as follows:
16
+
17
+ ```plain
18
+ This is the house that Jack built.
19
+
20
+ This is the malt
21
+ that lay in the house that Jack built.
22
+
23
+ This is the rat
24
+ that ate the malt
25
+ that lay in the house that Jack built.
26
+
27
+ This is the cat
28
+ that killed the rat
29
+ that ate the malt
30
+ that lay in the house that Jack built.
31
+
32
+ This is the dog
33
+ that worried the cat
34
+ that killed the rat
35
+ that ate the malt
36
+ that lay in the house that Jack built.
37
+
38
+ This is the cow with the crumpled horn
39
+ that tossed the dog
40
+ that worried the cat
41
+ that killed the rat
42
+ that ate the malt
43
+ that lay in the house that Jack built.
44
+
45
+ This is the maiden all forlorn
46
+ that milked the cow with the crumpled horn
47
+ that tossed the dog
48
+ that worried the cat
49
+ that killed the rat
50
+ that ate the malt
51
+ that lay in the house that Jack built.
52
+
53
+ This is the man all tattered and torn
54
+ that kissed the maiden all forlorn
55
+ that milked the cow with the crumpled horn
56
+ that tossed the dog
57
+ that worried the cat
58
+ that killed the rat
59
+ that ate the malt
60
+ that lay in the house that Jack built.
61
+
62
+ This is the priest all shaven and shorn
63
+ that married the man all tattered and torn
64
+ that kissed the maiden all forlorn
65
+ that milked the cow with the crumpled horn
66
+ that tossed the dog
67
+ that worried the cat
68
+ that killed the rat
69
+ that ate the malt
70
+ that lay in the house that Jack built.
71
+
72
+ This is the rooster that crowed in the morn
73
+ that woke the priest all shaven and shorn
74
+ that married the man all tattered and torn
75
+ that kissed the maiden all forlorn
76
+ that milked the cow with the crumpled horn
77
+ that tossed the dog
78
+ that worried the cat
79
+ that killed the rat
80
+ that ate the malt
81
+ that lay in the house that Jack built.
82
+
83
+ This is the farmer sowing his corn
84
+ that kept the rooster that crowed in the morn
85
+ that woke the priest all shaven and shorn
86
+ that married the man all tattered and torn
87
+ that kissed the maiden all forlorn
88
+ that milked the cow with the crumpled horn
89
+ that tossed the dog
90
+ that worried the cat
91
+ that killed the rat
92
+ that ate the malt
93
+ that lay in the house that Jack built.
94
+
95
+ This is the horse and the hound and the horn
96
+ that belonged to the farmer sowing his corn
97
+ that kept the rooster that crowed in the morn
98
+ that woke the priest all shaven and shorn
99
+ that married the man all tattered and torn
100
+ that kissed the maiden all forlorn
101
+ that milked the cow with the crumpled horn
102
+ that tossed the dog
103
+ that worried the cat
104
+ that killed the rat
105
+ that ate the malt
106
+ that lay in the house that Jack built.
107
+ ```
108
+
109
+
110
+ To run the tests:
111
+
112
+ ```sh
113
+ $ gradle test
114
+ ```
115
+
116
+ For more detailed info about the Java track see the [help page](http://exercism.io/languages/java).
117
+
118
+
119
+ ## Source
120
+
121
+ British nursery rhyme [http://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built](http://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built)
122
+
123
+ ## Submitting Incomplete Solutions
124
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,18 @@
1
+ apply plugin: "java"
2
+ apply plugin: "eclipse"
3
+ apply plugin: "idea"
4
+
5
+ repositories {
6
+ mavenCentral()
7
+ }
8
+
9
+ dependencies {
10
+ testCompile "junit:junit:4.12"
11
+ }
12
+
13
+ test {
14
+ testLogging {
15
+ exceptionFormat = 'full'
16
+ events = ["passed", "failed", "skipped"]
17
+ }
18
+ }
@@ -0,0 +1,55 @@
1
+ class House {
2
+ private static final String[] CHARACTERS = {
3
+ "house that Jack built.",
4
+ "malt",
5
+ "rat",
6
+ "cat",
7
+ "dog",
8
+ "cow with the crumpled horn",
9
+ "maiden all forlorn",
10
+ "man all tattered and torn",
11
+ "priest all shaven and shorn",
12
+ "rooster that crowed in the morn",
13
+ "farmer sowing his corn",
14
+ "horse and the hound and the horn"
15
+ };
16
+
17
+ private static final String[] ACTIONS = {
18
+ "lay in",
19
+ "ate",
20
+ "killed",
21
+ "worried",
22
+ "tossed",
23
+ "milked",
24
+ "kissed",
25
+ "married",
26
+ "woke",
27
+ "kept",
28
+ "belonged to"
29
+ };
30
+
31
+ String verse(int verseNumber) {
32
+ StringBuilder verse = new StringBuilder();
33
+ verse.append("This is the " + CHARACTERS[verseNumber - 1]);
34
+
35
+ for (int i = verseNumber - 2; i >= 0; i--) {
36
+ verse.append("\nthat " + ACTIONS[i] + " the " + CHARACTERS[i]);
37
+ }
38
+
39
+ return verse.toString();
40
+ }
41
+
42
+ String verses(int startVerse, int endVerse) {
43
+ String[] verses = new String[endVerse - startVerse + 1];
44
+
45
+ for (int i = startVerse; i <= endVerse; i++) {
46
+ verses[i - startVerse] = verse(i);
47
+ }
48
+
49
+ return String.join("\n\n", verses);
50
+ }
51
+
52
+ String sing() {
53
+ return verses(1, 12);
54
+ }
55
+ }
File without changes
@@ -0,0 +1,341 @@
1
+ import org.junit.Test;
2
+ import org.junit.Ignore;
3
+ import org.junit.Before;
4
+
5
+ import static org.junit.Assert.assertEquals;
6
+
7
+ public class HouseTest {
8
+
9
+ private House house;
10
+
11
+ @Before
12
+ public void setup() {
13
+ house = new House();
14
+ }
15
+
16
+ @Test
17
+ public void verseOne() {
18
+ String expected = "This is the house that Jack built.";
19
+ int verse = 1;
20
+
21
+ assertEquals(expected, house.verse(verse));
22
+ }
23
+
24
+ @Ignore("Remove to run test")
25
+ @Test
26
+ public void verseTwo() {
27
+ String expected =
28
+ "This is the malt\n" +
29
+ "that lay in the house that Jack built.";
30
+ int verse = 2;
31
+
32
+ assertEquals(expected, house.verse(verse));
33
+ }
34
+
35
+ @Ignore("Remove to run test")
36
+ @Test
37
+ public void verseThree() {
38
+ String expected =
39
+ "This is the rat\n" +
40
+ "that ate the malt\n" +
41
+ "that lay in the house that Jack built.";
42
+ int verse = 3;
43
+
44
+ assertEquals(expected, house.verse(verse));
45
+ }
46
+
47
+ @Ignore("Remove to run test")
48
+ @Test
49
+ public void verseFour() {
50
+ String expected =
51
+ "This is the cat\n" +
52
+ "that killed the rat\n" +
53
+ "that ate the malt\n" +
54
+ "that lay in the house that Jack built.";
55
+ int verse = 4;
56
+
57
+ assertEquals(expected, house.verse(verse));
58
+ }
59
+
60
+ @Ignore("Remove to run test")
61
+ @Test
62
+ public void verseFive() {
63
+ String expected =
64
+ "This is the dog\n" +
65
+ "that worried the cat\n" +
66
+ "that killed the rat\n" +
67
+ "that ate the malt\n" +
68
+ "that lay in the house that Jack built.";
69
+ int verse = 5;
70
+
71
+ assertEquals(expected, house.verse(verse));
72
+ }
73
+
74
+ @Ignore("Remove to run test")
75
+ @Test
76
+ public void verseSix() {
77
+ String expected =
78
+ "This is the cow with the crumpled horn\n" +
79
+ "that tossed the dog\n" +
80
+ "that worried the cat\n" +
81
+ "that killed the rat\n" +
82
+ "that ate the malt\n" +
83
+ "that lay in the house that Jack built.";
84
+ int verse = 6;
85
+
86
+ assertEquals(expected, house.verse(verse));
87
+ }
88
+
89
+ @Ignore("Remove to run test")
90
+ @Test
91
+ public void verseSeven() {
92
+ String expected =
93
+ "This is the maiden all forlorn\n" +
94
+ "that milked the cow with the crumpled horn\n" +
95
+ "that tossed the dog\n" +
96
+ "that worried the cat\n" +
97
+ "that killed the rat\n" +
98
+ "that ate the malt\n" +
99
+ "that lay in the house that Jack built.";
100
+ int verse = 7;
101
+
102
+ assertEquals(expected, house.verse(verse));
103
+ }
104
+
105
+ @Ignore("Remove to run test")
106
+ @Test
107
+ public void verseEight() {
108
+ String expected =
109
+ "This is the man all tattered and torn\n" +
110
+ "that kissed the maiden all forlorn\n" +
111
+ "that milked the cow with the crumpled horn\n" +
112
+ "that tossed the dog\n" +
113
+ "that worried the cat\n" +
114
+ "that killed the rat\n" +
115
+ "that ate the malt\n" +
116
+ "that lay in the house that Jack built.";
117
+ int verse = 8;
118
+
119
+ assertEquals(expected, house.verse(verse));
120
+ }
121
+
122
+ @Ignore("Remove to run test")
123
+ @Test
124
+ public void verseNine() {
125
+ String expected =
126
+ "This is the priest all shaven and shorn\n" +
127
+ "that married the man all tattered and torn\n" +
128
+ "that kissed the maiden all forlorn\n" +
129
+ "that milked the cow with the crumpled horn\n" +
130
+ "that tossed the dog\n" +
131
+ "that worried the cat\n" +
132
+ "that killed the rat\n" +
133
+ "that ate the malt\n" +
134
+ "that lay in the house that Jack built.";
135
+ int verse = 9;
136
+
137
+ assertEquals(expected, house.verse(verse));
138
+ }
139
+
140
+ @Ignore("Remove to run test")
141
+ @Test
142
+ public void verse10() {
143
+ String expected =
144
+ "This is the rooster that crowed in the morn\n" +
145
+ "that woke the priest all shaven and shorn\n" +
146
+ "that married the man all tattered and torn\n" +
147
+ "that kissed the maiden all forlorn\n" +
148
+ "that milked the cow with the crumpled horn\n" +
149
+ "that tossed the dog\n" +
150
+ "that worried the cat\n" +
151
+ "that killed the rat\n" +
152
+ "that ate the malt\n" +
153
+ "that lay in the house that Jack built.";
154
+ int verse = 10;
155
+
156
+ assertEquals(expected, house.verse(verse));
157
+ }
158
+
159
+ @Ignore("Remove to run test")
160
+ @Test
161
+ public void verse11() {
162
+ String expected =
163
+ "This is the farmer sowing his corn\n" +
164
+ "that kept the rooster that crowed in the morn\n" +
165
+ "that woke the priest all shaven and shorn\n" +
166
+ "that married the man all tattered and torn\n" +
167
+ "that kissed the maiden all forlorn\n" +
168
+ "that milked the cow with the crumpled horn\n" +
169
+ "that tossed the dog\n" +
170
+ "that worried the cat\n" +
171
+ "that killed the rat\n" +
172
+ "that ate the malt\n" +
173
+ "that lay in the house that Jack built.";
174
+ int verse = 11;
175
+
176
+ assertEquals(expected, house.verse(verse));
177
+ }
178
+
179
+ @Ignore("Remove to run test")
180
+ @Test
181
+ public void verse12() {
182
+ String expected =
183
+ "This is the horse and the hound and the horn\n" +
184
+ "that belonged to the farmer sowing his corn\n" +
185
+ "that kept the rooster that crowed in the morn\n" +
186
+ "that woke the priest all shaven and shorn\n" +
187
+ "that married the man all tattered and torn\n" +
188
+ "that kissed the maiden all forlorn\n" +
189
+ "that milked the cow with the crumpled horn\n" +
190
+ "that tossed the dog\n" +
191
+ "that worried the cat\n" +
192
+ "that killed the rat\n" +
193
+ "that ate the malt\n" +
194
+ "that lay in the house that Jack built.";
195
+ int verse = 12;
196
+
197
+ assertEquals(expected, house.verse(verse));
198
+ }
199
+
200
+ @Ignore("Remove to run test")
201
+ @Test
202
+ public void multipleVerses() {
203
+ String expected =
204
+ "This is the cat\n" +
205
+ "that killed the rat\n" +
206
+ "that ate the malt\n" +
207
+ "that lay in the house that Jack built.\n" +
208
+ "\n" +
209
+ "This is the dog\n" +
210
+ "that worried the cat\n" +
211
+ "that killed the rat\n" +
212
+ "that ate the malt\n" +
213
+ "that lay in the house that Jack built.\n" +
214
+ "\n" +
215
+ "This is the cow with the crumpled horn\n" +
216
+ "that tossed the dog\n" +
217
+ "that worried the cat\n" +
218
+ "that killed the rat\n" +
219
+ "that ate the malt\n" +
220
+ "that lay in the house that Jack built.\n" +
221
+ "\n" +
222
+ "This is the maiden all forlorn\n" +
223
+ "that milked the cow with the crumpled horn\n" +
224
+ "that tossed the dog\n" +
225
+ "that worried the cat\n" +
226
+ "that killed the rat\n" +
227
+ "that ate the malt\n" +
228
+ "that lay in the house that Jack built.\n" +
229
+ "\n" +
230
+ "This is the man all tattered and torn\n" +
231
+ "that kissed the maiden all forlorn\n" +
232
+ "that milked the cow with the crumpled horn\n" +
233
+ "that tossed the dog\n" +
234
+ "that worried the cat\n" +
235
+ "that killed the rat\n" +
236
+ "that ate the malt\n" +
237
+ "that lay in the house that Jack built.";
238
+
239
+ int startVerse = 4;
240
+ int endVerse = 8;
241
+
242
+ assertEquals(expected, house.verses(startVerse, endVerse));
243
+ }
244
+
245
+ @Ignore("Remove to run test")
246
+ @Test
247
+ public void wholeRhyme() {
248
+ String expected =
249
+ "This is the house that Jack built.\n" +
250
+ "\n" +
251
+ "This is the malt\n" +
252
+ "that lay in the house that Jack built.\n" +
253
+ "\n" +
254
+ "This is the rat\n" +
255
+ "that ate the malt\n" +
256
+ "that lay in the house that Jack built.\n" +
257
+ "\n" +
258
+ "This is the cat\n" +
259
+ "that killed the rat\n" +
260
+ "that ate the malt\n" +
261
+ "that lay in the house that Jack built.\n" +
262
+ "\n" +
263
+ "This is the dog\n" +
264
+ "that worried the cat\n" +
265
+ "that killed the rat\n" +
266
+ "that ate the malt\n" +
267
+ "that lay in the house that Jack built.\n" +
268
+ "\n" +
269
+ "This is the cow with the crumpled horn\n" +
270
+ "that tossed the dog\n" +
271
+ "that worried the cat\n" +
272
+ "that killed the rat\n" +
273
+ "that ate the malt\n" +
274
+ "that lay in the house that Jack built.\n" +
275
+ "\n" +
276
+ "This is the maiden all forlorn\n" +
277
+ "that milked the cow with the crumpled horn\n" +
278
+ "that tossed the dog\n" +
279
+ "that worried the cat\n" +
280
+ "that killed the rat\n" +
281
+ "that ate the malt\n" +
282
+ "that lay in the house that Jack built.\n" +
283
+ "\n" +
284
+ "This is the man all tattered and torn\n" +
285
+ "that kissed the maiden all forlorn\n" +
286
+ "that milked the cow with the crumpled horn\n" +
287
+ "that tossed the dog\n" +
288
+ "that worried the cat\n" +
289
+ "that killed the rat\n" +
290
+ "that ate the malt\n" +
291
+ "that lay in the house that Jack built.\n" +
292
+ "\n" +
293
+ "This is the priest all shaven and shorn\n" +
294
+ "that married the man all tattered and torn\n" +
295
+ "that kissed the maiden all forlorn\n" +
296
+ "that milked the cow with the crumpled horn\n" +
297
+ "that tossed the dog\n" +
298
+ "that worried the cat\n" +
299
+ "that killed the rat\n" +
300
+ "that ate the malt\n" +
301
+ "that lay in the house that Jack built.\n" +
302
+ "\n" +
303
+ "This is the rooster that crowed in the morn\n" +
304
+ "that woke the priest all shaven and shorn\n" +
305
+ "that married the man all tattered and torn\n" +
306
+ "that kissed the maiden all forlorn\n" +
307
+ "that milked the cow with the crumpled horn\n" +
308
+ "that tossed the dog\n" +
309
+ "that worried the cat\n" +
310
+ "that killed the rat\n" +
311
+ "that ate the malt\n" +
312
+ "that lay in the house that Jack built.\n" +
313
+ "\n" +
314
+ "This is the farmer sowing his corn\n" +
315
+ "that kept the rooster that crowed in the morn\n" +
316
+ "that woke the priest all shaven and shorn\n" +
317
+ "that married the man all tattered and torn\n" +
318
+ "that kissed the maiden all forlorn\n" +
319
+ "that milked the cow with the crumpled horn\n" +
320
+ "that tossed the dog\n" +
321
+ "that worried the cat\n" +
322
+ "that killed the rat\n" +
323
+ "that ate the malt\n" +
324
+ "that lay in the house that Jack built.\n" +
325
+ "\n" +
326
+ "This is the horse and the hound and the horn\n" +
327
+ "that belonged to the farmer sowing his corn\n" +
328
+ "that kept the rooster that crowed in the morn\n" +
329
+ "that woke the priest all shaven and shorn\n" +
330
+ "that married the man all tattered and torn\n" +
331
+ "that kissed the maiden all forlorn\n" +
332
+ "that milked the cow with the crumpled horn\n" +
333
+ "that tossed the dog\n" +
334
+ "that worried the cat\n" +
335
+ "that killed the rat\n" +
336
+ "that ate the malt\n" +
337
+ "that lay in the house that Jack built.";
338
+
339
+ assertEquals(expected, house.sing());
340
+ }
341
+ }