trackler 2.0.6.11 → 2.0.6.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +6 -1
  3. data/common/exercises/difference-of-squares/metadata.yml +1 -1
  4. data/common/exercises/luhn/canonical-data.json +2 -2
  5. data/common/exercises/rectangles/canonical-data.json +25 -0
  6. data/common/exercises/rectangles/description.md +11 -3
  7. data/lib/trackler/version.rb +1 -1
  8. data/tracks/ceylon/config.json +9 -0
  9. data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +38 -39
  10. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +28 -29
  11. data/tracks/ceylon/exercises/largest-series-product/example/Series.ceylon +13 -0
  12. data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/Series.ceylon +5 -0
  13. data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon +30 -0
  14. data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/module.ceylon +3 -0
  15. data/tracks/csharp/config.json +41 -0
  16. data/tracks/csharp/exercises/alphametics/AlphameticsTest.cs +122 -0
  17. data/tracks/csharp/exercises/alphametics/Example.cs +139 -0
  18. data/tracks/csharp/exercises/dot-dsl/DotDslTest.cs +91 -0
  19. data/tracks/csharp/exercises/dot-dsl/Example.cs +90 -0
  20. data/tracks/csharp/exercises/dot-dsl/HINTS.md +2 -0
  21. data/tracks/csharp/exercises/error-handling/ErrorHandlingTest.cs +65 -0
  22. data/tracks/csharp/exercises/error-handling/Example.cs +34 -0
  23. data/tracks/csharp/exercises/exercises.csproj +1 -1
  24. data/tracks/csharp/exercises/hangman/Example.cs +85 -0
  25. data/tracks/csharp/exercises/hangman/HangmanTest.cs +140 -0
  26. data/tracks/csharp/exercises/ledger/Example.cs +106 -0
  27. data/tracks/csharp/exercises/ledger/Ledger.cs +166 -0
  28. data/tracks/csharp/exercises/ledger/LedgerTest.cs +168 -0
  29. data/tracks/elixir/exercises/allergies/allergies_test.exs +2 -2
  30. data/tracks/elixir/exercises/markdown/example.exs +3 -3
  31. data/tracks/elixir/exercises/phone-number/example.exs +0 -2
  32. data/tracks/elixir/exercises/queen-attack/example.exs +1 -1
  33. data/tracks/elixir/exercises/wordy/example.exs +6 -6
  34. data/tracks/elixir/exercises/zipper/zipper_test.exs +12 -12
  35. data/tracks/elixir/mix.exs +1 -1
  36. data/tracks/fsharp/config.json +8 -8
  37. data/tracks/fsharp/docs/ABOUT.md +4 -0
  38. data/tracks/fsharp/exercises/alphametics/AlphameticsTest.fs +33 -13
  39. data/tracks/fsharp/exercises/alphametics/Example.fs +29 -64
  40. data/tracks/fsharp/exercises/binary-search-tree/BinarySearchTreeTest.fs +14 -14
  41. data/tracks/fsharp/exercises/binary-search-tree/Example.fs +17 -14
  42. data/tracks/fsharp/exercises/triangle/TriangleTest.fs +0 -5
  43. data/tracks/go/README.md +3 -3
  44. data/tracks/go/config.json +10 -3
  45. data/tracks/go/exercises/acronym/acronym.go +5 -0
  46. data/tracks/go/exercises/bob/example_gen.go +1 -1
  47. data/tracks/go/exercises/clock/example_gen.go +1 -1
  48. data/tracks/go/exercises/connect/example_gen.go +1 -1
  49. data/tracks/go/exercises/custom-set/example_gen.go +1 -1
  50. data/tracks/go/exercises/gigasecond/example_gen.go +1 -1
  51. data/tracks/go/exercises/hamming/example_gen.go +1 -1
  52. data/tracks/go/exercises/largest-series-product/example_gen.go +1 -1
  53. data/tracks/go/exercises/leap/cases_test.go +5 -7
  54. data/tracks/go/exercises/leap/example.go +1 -1
  55. data/tracks/go/exercises/leap/example_gen.go +1 -1
  56. data/tracks/go/exercises/leap/leap.go +1 -1
  57. data/tracks/go/exercises/leap/leap_test.go +1 -1
  58. data/tracks/go/exercises/meetup/example_gen.go +1 -1
  59. data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +0 -5
  60. data/tracks/go/exercises/pangram/pangram.go +5 -0
  61. data/tracks/go/exercises/raindrops/example_gen.go +1 -1
  62. data/tracks/go/exercises/rna-transcription/example_gen.go +1 -1
  63. data/tracks/go/exercises/roman-numerals/example_gen.go +1 -1
  64. data/tracks/go/exercises/word-count/example_gen.go +1 -1
  65. data/tracks/go/gen/gen.go +3 -2
  66. data/tracks/haskell/exercises/accumulate/src/Accumulate.hs +1 -1
  67. data/tracks/haskell/exercises/all-your-base/src/Base.hs +1 -1
  68. data/tracks/haskell/exercises/allergies/src/Allergies.hs +2 -2
  69. data/tracks/haskell/exercises/alphametics/src/Alphametics.hs +1 -1
  70. data/tracks/haskell/exercises/anagram/src/Anagram.hs +1 -1
  71. data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
  72. data/tracks/haskell/exercises/bank-account/src/BankAccount.hs +4 -4
  73. data/tracks/haskell/exercises/binary/src/Binary.hs +1 -1
  74. data/tracks/haskell/exercises/binary-search-tree/src/BST.hs +8 -8
  75. data/tracks/haskell/exercises/bob/src/Bob.hs +1 -1
  76. data/tracks/haskell/exercises/bowling/src/Bowling.hs +1 -1
  77. data/tracks/haskell/exercises/change/src/Change.hs +1 -1
  78. data/tracks/haskell/exercises/clock/src/Clock.hs +4 -4
  79. data/tracks/haskell/exercises/connect/src/Connect.hs +1 -1
  80. data/tracks/haskell/exercises/crypto-square/src/CryptoSquare.hs +1 -1
  81. data/tracks/haskell/exercises/custom-set/src/CustomSet.hs +13 -13
  82. data/tracks/haskell/exercises/difference-of-squares/src/Squares.hs +3 -3
  83. data/tracks/haskell/exercises/dominoes/src/Dominoes.hs +1 -1
  84. data/tracks/haskell/exercises/etl/src/ETL.hs +1 -1
  85. data/tracks/haskell/exercises/forth/src/Forth.hs +3 -3
  86. data/tracks/haskell/exercises/gigasecond/src/Gigasecond.hs +1 -1
  87. data/tracks/haskell/exercises/go-counting/src/Counting.hs +2 -2
  88. data/tracks/haskell/exercises/grade-school/src/School.hs +4 -4
  89. data/tracks/haskell/exercises/grains/src/Grains.hs +2 -2
  90. data/tracks/haskell/exercises/hamming/src/Hamming.hs +1 -1
  91. data/tracks/haskell/exercises/hexadecimal/src/Hexadecimal.hs +1 -1
  92. data/tracks/haskell/exercises/kindergarten-garden/src/Garden.hs +3 -3
  93. data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
  94. data/tracks/haskell/exercises/leap/src/LeapYear.hs +1 -1
  95. data/tracks/haskell/exercises/lens-person/src/Person.hs +4 -4
  96. data/tracks/haskell/exercises/linked-list/src/Deque.hs +5 -5
  97. data/tracks/haskell/exercises/list-ops/src/ListOps.hs +8 -8
  98. data/tracks/haskell/exercises/luhn/src/Luhn.hs +5 -5
  99. data/tracks/haskell/exercises/matrix/src/Matrix.hs +10 -10
  100. data/tracks/haskell/exercises/meetup/src/Meetup.hs +1 -1
  101. data/tracks/haskell/exercises/minesweeper/src/Minesweeper.hs +1 -1
  102. data/tracks/haskell/exercises/nth-prime/src/Prime.hs +1 -1
  103. data/tracks/haskell/exercises/nucleotide-count/src/DNA.hs +2 -2
  104. data/tracks/haskell/exercises/ocr-numbers/src/OCR.hs +1 -1
  105. data/tracks/haskell/exercises/octal/src/Octal.hs +2 -2
  106. data/tracks/haskell/exercises/palindrome-products/src/Palindromes.hs +2 -2
  107. data/tracks/haskell/exercises/parallel-letter-frequency/src/Frequency.hs +1 -1
  108. data/tracks/haskell/exercises/pascals-triangle/src/Triangle.hs +1 -1
  109. data/tracks/haskell/exercises/phone-number/src/Phone.hs +3 -3
  110. data/tracks/haskell/exercises/pig-latin/src/PigLatin.hs +1 -1
  111. data/tracks/haskell/exercises/pov/src/POV.hs +2 -2
  112. data/tracks/haskell/exercises/prime-factors/src/PrimeFactors.hs +1 -1
  113. data/tracks/haskell/exercises/pythagorean-triplet/src/Triplet.hs +3 -3
  114. data/tracks/haskell/exercises/queen-attack/src/Queens.hs +2 -2
  115. data/tracks/haskell/exercises/raindrops/src/Raindrops.hs +1 -1
  116. data/tracks/haskell/exercises/rna-transcription/src/DNA.hs +1 -1
  117. data/tracks/haskell/exercises/robot-name/src/Robot.hs +3 -3
  118. data/tracks/haskell/exercises/robot-simulator/src/Robot.hs +6 -6
  119. data/tracks/haskell/exercises/roman-numerals/src/Roman.hs +1 -1
  120. data/tracks/haskell/exercises/run-length-encoding/src/RunLength.hs +2 -2
  121. data/tracks/haskell/exercises/saddle-points/src/Matrix.hs +1 -1
  122. data/tracks/haskell/exercises/say/src/Say.hs +1 -1
  123. data/tracks/haskell/exercises/scrabble-score/src/Scrabble.hs +2 -2
  124. data/tracks/haskell/exercises/secret-handshake/src/SecretHandshake.hs +1 -1
  125. data/tracks/haskell/exercises/series/src/Series.hs +1 -1
  126. data/tracks/haskell/exercises/sgf-parsing/src/Sgf.hs +1 -1
  127. data/tracks/haskell/exercises/sieve/src/Sieve.hs +1 -1
  128. data/tracks/haskell/exercises/simple-cipher/src/Cipher.hs +3 -3
  129. data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +8 -8
  130. data/tracks/haskell/exercises/space-age/src/SpaceAge.hs +1 -1
  131. data/tracks/haskell/exercises/strain/src/Strain.hs +2 -2
  132. data/tracks/haskell/exercises/sublist/src/Sublist.hs +1 -1
  133. data/tracks/haskell/exercises/sum-of-multiples/src/SumOfMultiples.hs +1 -1
  134. data/tracks/haskell/exercises/triangle/src/Triangle.hs +1 -1
  135. data/tracks/haskell/exercises/trinary/src/Trinary.hs +2 -2
  136. data/tracks/haskell/exercises/word-count/src/WordCount.hs +1 -1
  137. data/tracks/haskell/exercises/wordy/src/WordProblem.hs +1 -1
  138. data/tracks/haskell/exercises/zebra-puzzle/src/ZebraPuzzle.hs +1 -1
  139. data/tracks/haskell/exercises/zipper/src/Zipper.hs +9 -9
  140. data/tracks/java/docs/MAINTAINING.md +48 -0
  141. data/tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java +51 -51
  142. data/tracks/kotlin/exercises/etl/src/example/kotlin/ETL.kt +1 -1
  143. data/tracks/kotlin/exercises/etl/src/test/kotlin/ETLTest.kt +19 -19
  144. data/tracks/kotlin/exercises/pangram/src/test/kotlin/PangramTest.kt +5 -0
  145. data/tracks/lisp/docs/ABOUT.md +9 -0
  146. data/tracks/lua/exercises/transpose/example.lua +1 -1
  147. data/tracks/lua/exercises/transpose/transpose_spec.lua +16 -0
  148. data/tracks/pascal/config.json +36 -36
  149. data/tracks/pascal/exercises/bob/uBobTests.pas +0 -1
  150. data/tracks/pascal/exercises/hamming/uHammingTests.pas +0 -1
  151. data/tracks/pascal/exercises/leap/uLeapTests.pas +0 -1
  152. data/tracks/pascal/exercises/saddle-points/uSaddlePointsExample.pas +11 -0
  153. data/tracks/pascal/exercises/saddle-points/uSaddlePointsTests.pas +9 -1
  154. data/tracks/perl6/exercises/atbash-cipher/cipher.t +1 -1
  155. data/tracks/php/config.json +7 -0
  156. data/tracks/php/exercises/robot-simulator/example.php +148 -0
  157. data/tracks/php/exercises/robot-simulator/robot-simulator_test.php +168 -0
  158. data/tracks/pony/config.json +16 -7
  159. data/tracks/pony/exercises/roman-numerals/example.pony +35 -0
  160. data/tracks/pony/exercises/roman-numerals/test.pony +45 -0
  161. data/tracks/python/requirements-travis.txt +1 -1
  162. data/tracks/ruby/.rubocop.yml +1 -1
  163. data/tracks/ruby/bin/enable-executable +1 -1
  164. data/tracks/ruby/bin/executable-tests-check +1 -1
  165. data/tracks/ruby/exercises/acronym/example.tt +2 -3
  166. data/tracks/ruby/exercises/all-your-base/example.tt +2 -2
  167. data/tracks/ruby/exercises/alphametics/example.tt +2 -2
  168. data/tracks/ruby/exercises/anagram/example.tt +2 -3
  169. data/tracks/ruby/exercises/binary/example.tt +2 -3
  170. data/tracks/ruby/exercises/bowling/example.tt +2 -3
  171. data/tracks/ruby/exercises/bracket-push/example.tt +2 -3
  172. data/tracks/ruby/exercises/clock/example.tt +2 -3
  173. data/tracks/ruby/exercises/connect/example.rb +1 -1
  174. data/tracks/ruby/exercises/connect/example.tt +1 -1
  175. data/tracks/ruby/exercises/custom-set/example.tt +2 -3
  176. data/tracks/ruby/exercises/diamond/example.rb +1 -1
  177. data/tracks/ruby/exercises/difference-of-squares/example.tt +2 -3
  178. data/tracks/ruby/exercises/dominoes/example.tt +2 -2
  179. data/tracks/ruby/exercises/gigasecond/example.tt +2 -3
  180. data/tracks/ruby/exercises/grains/example.tt +2 -2
  181. data/tracks/ruby/exercises/hamming/example.tt +2 -3
  182. data/tracks/ruby/exercises/hello-world/example.tt +1 -2
  183. data/tracks/ruby/exercises/isogram/example.tt +2 -2
  184. data/tracks/ruby/exercises/largest-series-product/example.tt +2 -4
  185. data/tracks/ruby/exercises/leap/example.tt +2 -3
  186. data/tracks/ruby/exercises/nth-prime/example.tt +2 -4
  187. data/tracks/ruby/exercises/pangram/example.tt +2 -2
  188. data/tracks/ruby/exercises/queen-attack/example.tt +2 -3
  189. data/tracks/ruby/exercises/raindrops/example.tt +2 -3
  190. data/tracks/ruby/exercises/rna-transcription/example.tt +2 -3
  191. data/tracks/ruby/exercises/roman-numerals/example.tt +2 -3
  192. data/tracks/ruby/exercises/run-length-encoding/example.tt +2 -3
  193. data/tracks/ruby/exercises/sieve/example.tt +2 -4
  194. data/tracks/ruby/exercises/simple-linked-list/simple_linked_list_test.rb +6 -6
  195. data/tracks/ruby/exercises/tournament/example.tt +2 -3
  196. data/tracks/ruby/exercises/transpose/example.tt +2 -3
  197. data/tracks/ruby/exercises/triangle/example.tt +2 -3
  198. data/tracks/ruby/exercises/two-bucket/example.tt +2 -3
  199. data/tracks/ruby/exercises/word-count/example.tt +2 -3
  200. data/tracks/ruby/exercises/wordy/example.tt +2 -2
  201. data/tracks/ruby/lib/acronym_cases.rb +2 -0
  202. data/tracks/ruby/lib/all_your_base_cases.rb +3 -1
  203. data/tracks/ruby/lib/alphametics_cases.rb +6 -4
  204. data/tracks/ruby/lib/anagram_cases.rb +2 -0
  205. data/tracks/ruby/lib/binary_cases.rb +2 -0
  206. data/tracks/ruby/lib/bowling_cases.rb +2 -0
  207. data/tracks/ruby/lib/bracket_push_cases.rb +2 -0
  208. data/tracks/ruby/lib/clock_cases.rb +2 -0
  209. data/tracks/ruby/lib/connect_cases.rb +2 -0
  210. data/tracks/ruby/lib/custom_set_cases.rb +2 -0
  211. data/tracks/ruby/lib/difference_of_squares_cases.rb +2 -0
  212. data/tracks/ruby/lib/dominoes_cases.rb +2 -0
  213. data/tracks/ruby/lib/exercise_cases.rb +2 -0
  214. data/tracks/ruby/lib/generator/files/track_files.rb +3 -3
  215. data/tracks/ruby/lib/generator/files.rb +1 -1
  216. data/tracks/ruby/lib/generator/template_values.rb +5 -14
  217. data/tracks/ruby/lib/gigasecond_cases.rb +2 -0
  218. data/tracks/ruby/lib/grains_cases.rb +3 -1
  219. data/tracks/ruby/lib/hamming_cases.rb +2 -0
  220. data/tracks/ruby/lib/hello_world_cases.rb +2 -0
  221. data/tracks/ruby/lib/isogram_cases.rb +3 -1
  222. data/tracks/ruby/lib/largest_series_product_cases.rb +2 -0
  223. data/tracks/ruby/lib/leap_cases.rb +2 -0
  224. data/tracks/ruby/lib/nth_prime_cases.rb +2 -0
  225. data/tracks/ruby/lib/pangram_cases.rb +3 -1
  226. data/tracks/ruby/lib/queen_attack_cases.rb +2 -0
  227. data/tracks/ruby/lib/raindrops_cases.rb +2 -0
  228. data/tracks/ruby/lib/rna_transcription_cases.rb +2 -0
  229. data/tracks/ruby/lib/roman_numerals_cases.rb +2 -0
  230. data/tracks/ruby/lib/run_length_encoding_cases.rb +2 -0
  231. data/tracks/ruby/lib/sieve_cases.rb +2 -0
  232. data/tracks/ruby/lib/tournament_cases.rb +2 -0
  233. data/tracks/ruby/lib/transpose_cases.rb +2 -0
  234. data/tracks/ruby/lib/triangle_cases.rb +2 -0
  235. data/tracks/ruby/lib/two_bucket_cases.rb +2 -0
  236. data/tracks/ruby/lib/word_count_cases.rb +2 -0
  237. data/tracks/ruby/lib/wordy_cases.rb +2 -0
  238. data/tracks/ruby/test/fixtures/xruby/exercises/alpha/example.tt +2 -2
  239. data/tracks/ruby/test/fixtures/xruby/lib/alpha_cases.rb +1 -1
  240. data/tracks/ruby/test/generator/command_line_test.rb +1 -1
  241. data/tracks/ruby/test/generator/template_values_test.rb +7 -7
  242. data/tracks/rust/.travis.yml +4 -0
  243. data/tracks/rust/_test/check-exercises.sh +11 -2
  244. data/tracks/rust/config.json +9 -0
  245. data/tracks/rust/exercises/luhn/.gitignore +7 -0
  246. data/tracks/rust/exercises/luhn/Cargo.toml +3 -0
  247. data/tracks/rust/exercises/luhn/example.rs +13 -0
  248. data/tracks/rust/exercises/luhn/tests/luhn.rs +38 -0
  249. data/tracks/rust/exercises/parallel-letter-frequency/HINTS.md +32 -0
  250. data/tracks/rust/exercises/parallel-letter-frequency/benches/benchmark.rs +99 -0
  251. data/tracks/scala/config.json +57 -1
  252. data/tracks/scala/exercises/allergies/build.sbt +2 -2
  253. data/tracks/scala/exercises/atbash-cipher/build.sbt +2 -2
  254. data/tracks/scala/exercises/bank-account/build.sbt +3 -2
  255. data/tracks/scala/exercises/binary-search-tree/build.sbt +2 -2
  256. data/tracks/scala/exercises/clock/build.sbt +2 -2
  257. data/tracks/scala/exercises/crypto-square/build.sbt +2 -2
  258. data/tracks/scala/exercises/custom-set/build.sbt +3 -2
  259. data/tracks/scala/exercises/food-chain/build.sbt +3 -2
  260. data/tracks/scala/exercises/house/build.sbt +2 -2
  261. data/tracks/scala/exercises/kindergarten-garden/build.sbt +3 -2
  262. data/tracks/scala/exercises/largest-series-product/build.sbt +2 -2
  263. data/tracks/scala/exercises/linked-list/build.sbt +3 -2
  264. data/tracks/scala/exercises/matrix/build.sbt +2 -2
  265. data/tracks/scala/exercises/minesweeper/build.sbt +2 -2
  266. data/tracks/scala/exercises/nth-prime/build.sbt +2 -2
  267. data/tracks/scala/exercises/ocr-numbers/build.sbt +2 -2
  268. data/tracks/scala/exercises/palindrome-products/build.sbt +2 -2
  269. data/tracks/scala/exercises/prime-factors/build.sbt +3 -2
  270. data/tracks/scala/exercises/queen-attack/build.sbt +2 -2
  271. data/tracks/scala/exercises/raindrops/build.sbt +2 -2
  272. data/tracks/scala/exercises/robot-simulator/build.sbt +2 -2
  273. data/tracks/scala/exercises/triangle/build.sbt +2 -2
  274. data/tracks/scala/exercises/trinary/build.sbt +2 -2
  275. data/tracks/scala/exercises/wordy/build.sbt +3 -3
  276. metadata +33 -2
@@ -36,26 +36,27 @@
36
36
  ]
37
37
  },
38
38
  {
39
- "slug": "bowling",
40
- "difficulty": 6,
39
+ "slug": "bank-account",
40
+ "difficulty": 2,
41
41
  "topics": [
42
- "Algorithms",
43
- "Control-flow (loops)"
42
+ "Classes"
44
43
  ]
45
44
  },
46
45
  {
47
- "slug": "allergies",
48
- "difficulty": 4,
46
+ "slug": "nucleotide-count",
47
+ "difficulty": 2,
49
48
  "topics": [
50
- "Bitwise operations",
51
- "Filtering"
49
+ "Dictionaries",
50
+ "Strings"
52
51
  ]
53
52
  },
54
53
  {
55
- "slug": "bank-account",
54
+ "slug": "etl",
56
55
  "difficulty": 2,
57
56
  "topics": [
58
- "Classes"
57
+ "Dictionaries",
58
+ "Lists",
59
+ "Transforming"
59
60
  ]
60
61
  },
61
62
  {
@@ -74,10 +75,6 @@
74
75
  "Transforming"
75
76
  ]
76
77
  },
77
- {
78
- "slug": "book-store",
79
- "difficulty": 6
80
- },
81
78
  {
82
79
  "slug": "perfect-numbers",
83
80
  "difficulty": 3,
@@ -85,23 +82,6 @@
85
82
  "Integers"
86
83
  ]
87
84
  },
88
- {
89
- "slug": "nucleotide-count",
90
- "difficulty": 2,
91
- "topics": [
92
- "Dictionaries",
93
- "Strings"
94
- ]
95
- },
96
- {
97
- "slug": "etl",
98
- "difficulty": 2,
99
- "topics": [
100
- "Dictionaries",
101
- "Lists",
102
- "Transforming"
103
- ]
104
- },
105
85
  {
106
86
  "slug": "binary-search",
107
87
  "difficulty": 3,
@@ -120,11 +100,11 @@
120
100
  ]
121
101
  },
122
102
  {
123
- "slug": "circular-buffer",
124
- "difficulty": 5,
103
+ "slug": "allergies",
104
+ "difficulty": 4,
125
105
  "topics": [
126
- "Queues",
127
- "Classes"
106
+ "Bitwise operations",
107
+ "Filtering"
128
108
  ]
129
109
  },
130
110
  {
@@ -135,7 +115,27 @@
135
115
  "Arrays",
136
116
  "Tuples"
137
117
  ]
138
- }
118
+ },
119
+ {
120
+ "slug": "circular-buffer",
121
+ "difficulty": 5,
122
+ "topics": [
123
+ "Queues",
124
+ "Classes"
125
+ ]
126
+ },
127
+ {
128
+ "slug": "bowling",
129
+ "difficulty": 6,
130
+ "topics": [
131
+ "Algorithms",
132
+ "Control-flow (loops)"
133
+ ]
134
+ },
135
+ {
136
+ "slug": "book-store",
137
+ "difficulty": 6
138
+ }
139
139
  ],
140
140
  "ignored": [
141
141
  "bin",
@@ -10,7 +10,6 @@ type
10
10
  BobTests = class(TObject)
11
11
  public
12
12
  [Test]
13
- [Ignore]
14
13
  procedure Stating_something;
15
14
 
16
15
  [Test]
@@ -10,7 +10,6 @@ type
10
10
  HammingTests = class(TObject)
11
11
  public
12
12
  [Test]
13
- [Ignore]
14
13
  procedure test_identical_strands;
15
14
 
16
15
  [Test]
@@ -10,7 +10,6 @@ type
10
10
  YearTest = class(TObject)
11
11
  public
12
12
  [Test]
13
- [Ignore]
14
13
  procedure test_leap_year;
15
14
 
16
15
  [Test]
@@ -1,3 +1,14 @@
1
+ //========================================================================
2
+ // For this example solution I utilized Stefen Glienke's
3
+ // open-source code library titled Spring4D. Latest
4
+ // version is available here: https://bitbucket.org/sglienke/spring4d
5
+ // Spring4D is not absolutely necessary, but it does greatly help
6
+ // facilitate a much simpler solution.
7
+ //
8
+ // Spring4D does include a Tuple record type that I have purposely
9
+ // not used in favor of my own, simple, TTuple that I declared in the
10
+ // test runner, in order to remove Spring4D dependency for test execution
11
+ //========================================================================
1
12
  unit uSaddlePoints;
2
13
 
3
14
  interface
@@ -1,3 +1,12 @@
1
+ //******************************************************************
2
+ // Hint: You will be using TTuple in your solution. TTuple is
3
+ // declared in this unit. It will be necessary for you to add
4
+ // a uses statement in the interface section of uSaddlePoints.pas.
5
+ //
6
+ // For more guidance as you work on this exercise, see
7
+ // GETTING_STARTED.md.
8
+ //******************************************************************
9
+
1
10
  unit uSaddlePointsTests;
2
11
 
3
12
  interface
@@ -52,7 +61,6 @@ begin
52
61
  fValue2 := Value2;
53
62
  end;
54
63
 
55
-
56
64
  procedure TSaddlePointTests.Readme_example;
57
65
  var SaddlePoints: ISaddlePoints;
58
66
  values: TArray<TArray<integer>>;
@@ -5,7 +5,7 @@ use JSON::Tiny;
5
5
 
6
6
  use lib ( my $dir = IO::Path.new($?FILE).parent ).path;
7
7
 
8
- my $module_name = %*ENV<EXERCISM>.so ?? 'Example' !! 'Allergies';
8
+ my $module_name = %*ENV<EXERCISM>.so ?? 'Example' !! 'Cipher';
9
9
  my @potential_module = <p6 pm6 pm>.map: $module_name ~ '.' ~ *;
10
10
 
11
11
  my $module = first { $dir.child($_).e }, |@potential_module
@@ -315,6 +315,13 @@
315
315
  "Floating-point numbers",
316
316
  "Algorithms"
317
317
  ]
318
+ },
319
+ {
320
+ "slug": "robot-simulator",
321
+ "difficulty": 3,
322
+ "topics": [
323
+ "OOP"
324
+ ]
318
325
  }
319
326
  ]
320
327
  }
@@ -0,0 +1,148 @@
1
+ <?php
2
+
3
+ class Robot
4
+ {
5
+ const DIRECTION_NORTH = 'north';
6
+ const DIRECTION_EAST = 'east';
7
+ const DIRECTION_SOUTH = 'south';
8
+ const DIRECTION_WEST = 'west';
9
+
10
+ /**
11
+ *
12
+ * @var int[]
13
+ */
14
+ protected $position;
15
+
16
+ /**
17
+ *
18
+ * @var string
19
+ */
20
+ protected $direction;
21
+
22
+
23
+ public function __construct(array $position, string $direction)
24
+ {
25
+ $this->position = $position;
26
+ $this->direction = $direction;
27
+ }
28
+
29
+
30
+ /**
31
+ * Make protected properties read-only.
32
+ * __get() is slow, but it's ok for the given task.
33
+ *
34
+ * @param string $name
35
+ * @return mixed
36
+ */
37
+ public function __get($name)
38
+ {
39
+ return property_exists(self::class, $name) ? $this->$name : null;
40
+ }
41
+
42
+
43
+ /**
44
+ * Turn the Robot clockwise
45
+ * @return Robot
46
+ */
47
+ public function turnRight()
48
+ {
49
+ $this->direction = self::listDirectionsClockwize()[$this->direction];
50
+ return $this;
51
+ }
52
+
53
+
54
+ /**
55
+ * Turn the Robot counterclockwise
56
+ * @return Robot
57
+ */
58
+ public function turnLeft()
59
+ {
60
+ $this->direction = self::listDirectionsCounterClockwize()[$this->direction];
61
+ return $this;
62
+ }
63
+
64
+
65
+ /**
66
+ * Advance the Robot one step forward
67
+ * @return Robot
68
+ */
69
+ public function advance()
70
+ {
71
+ switch ($this->direction) {
72
+ case self::DIRECTION_NORTH:
73
+ $this->position[1]++;
74
+ break;
75
+
76
+ case self::DIRECTION_EAST:
77
+ $this->position[0]++;
78
+ break;
79
+
80
+ case self::DIRECTION_SOUTH:
81
+ $this->position[1]--;
82
+ break;
83
+
84
+ case self::DIRECTION_WEST:
85
+ $this->position[0]--;
86
+ break;
87
+ }
88
+ return $this;
89
+ }
90
+
91
+
92
+ /**
93
+ * Move the Robot according to instructions: R = Turn Right, L = Turn Left and A = Advance
94
+ */
95
+ public function instructions($instructions)
96
+ {
97
+ if (!preg_match('/^[LAR]+$/', $instructions)) {
98
+ throw new InvalidArgumentException('Malformed instructions');
99
+ }
100
+
101
+ foreach ($this->mapInsructionsToActions($instructions) as $action) {
102
+ $this->$action();
103
+ }
104
+ return $this;
105
+ }
106
+
107
+
108
+ /**
109
+ * List all possible clockwise turn combinations
110
+ * @return array
111
+ */
112
+ public static function listDirectionsClockwize()
113
+ {
114
+ return [
115
+ self::DIRECTION_NORTH => self::DIRECTION_EAST,
116
+ self::DIRECTION_EAST => self::DIRECTION_SOUTH,
117
+ self::DIRECTION_SOUTH => self::DIRECTION_WEST,
118
+ self::DIRECTION_WEST => self::DIRECTION_NORTH,
119
+ ];
120
+ }
121
+
122
+
123
+ /**
124
+ * List all possible counterclockwise turn combinations
125
+ * @return array
126
+ */
127
+ public static function listDirectionsCounterClockwize()
128
+ {
129
+ return array_flip(self::listDirectionsClockwize());
130
+ }
131
+
132
+
133
+ /**
134
+ * Translate instructions string to actions
135
+ * @param string $stringInstructions
136
+ * @return string[]
137
+ */
138
+ protected function mapInsructionsToActions($stringInstructions)
139
+ {
140
+ return array_map(function ($x) {
141
+ return [
142
+ 'L' => 'turnLeft',
143
+ 'R' => 'turnRight',
144
+ 'A' => 'advance',
145
+ ][$x];
146
+ }, str_split($stringInstructions));
147
+ }
148
+ }
@@ -0,0 +1,168 @@
1
+ <?php
2
+
3
+ include_once 'robot-simulator.php';
4
+
5
+ class RobotSimulatorTest extends PHPUnit_Framework_TestCase
6
+ {
7
+
8
+
9
+ /**
10
+ * A robot is created with a position and a direction
11
+ */
12
+ public function testCreate()
13
+ {
14
+ // Robots are created with a position and direction
15
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
16
+ $this->assertEquals([0, 0], $robot->position);
17
+ $this->assertEquals(Robot::DIRECTION_NORTH, $robot->direction);
18
+
19
+ // Negative positions are allowed
20
+ $robot = new Robot([-1, -1], Robot::DIRECTION_SOUTH);
21
+ $this->assertEquals([-1, -1], $robot->position);
22
+ $this->assertEquals(Robot::DIRECTION_SOUTH, $robot->direction);
23
+ }
24
+
25
+
26
+ /**
27
+ * Rotate the robot's direction 90 degrees clockwise
28
+ */
29
+ public function testTurnRight()
30
+ {
31
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
32
+
33
+ // Change the direction from north to east
34
+ $robot->turnRight();
35
+ $this->assertEquals([0, 0], $robot->position);
36
+ $this->assertEquals(Robot::DIRECTION_EAST, $robot->direction);
37
+
38
+ // Change the direction from east to south
39
+ $robot->turnRight();
40
+ $this->assertEquals([0, 0], $robot->position);
41
+ $this->assertEquals(Robot::DIRECTION_SOUTH, $robot->direction);
42
+
43
+ // Change the direction from south to west
44
+ $robot->turnRight();
45
+ $this->assertEquals([0, 0], $robot->position);
46
+ $this->assertEquals(Robot::DIRECTION_WEST, $robot->direction);
47
+
48
+ // Change the direction from west to north
49
+ $robot->turnRight();
50
+ $this->assertEquals([0, 0], $robot->position);
51
+ $this->assertEquals(Robot::DIRECTION_NORTH, $robot->direction);
52
+ }
53
+
54
+ /**
55
+ * Rotate the robot's direction 90 degrees counterclockwise
56
+ */
57
+ public function testTurnLeft()
58
+ {
59
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
60
+
61
+ // Change the direction from north to west
62
+ $robot->turnLeft();
63
+ $this->assertEquals([0, 0], $robot->position);
64
+ $this->assertEquals(Robot::DIRECTION_WEST, $robot->direction);
65
+
66
+ // Change the direction from west to south
67
+ $robot->turnLeft();
68
+ $this->assertEquals([0, 0], $robot->position);
69
+ $this->assertEquals(Robot::DIRECTION_SOUTH, $robot->direction);
70
+
71
+ // Change the direction from south to east
72
+ $robot->turnLeft();
73
+ $this->assertEquals([0, 0], $robot->position);
74
+ $this->assertEquals(Robot::DIRECTION_EAST, $robot->direction);
75
+
76
+ // Change the direction from east to north
77
+ $robot->turnLeft();
78
+ $this->assertEquals([0, 0], $robot->position);
79
+ $this->assertEquals(Robot::DIRECTION_NORTH, $robot->direction);
80
+ }
81
+
82
+
83
+ /**
84
+ * Move the robot forward 1 space in the direction it is pointing
85
+ */
86
+ public function testAdvance()
87
+ {
88
+ // Increases the y coordinate by one when facing north
89
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
90
+ $robot->advance();
91
+ $this->assertEquals([0, 1], $robot->position);
92
+ $this->assertEquals(Robot::DIRECTION_NORTH, $robot->direction);
93
+
94
+ // Decreases the y coordinate by one when facing south
95
+ $robot = new Robot([0, 0], Robot::DIRECTION_SOUTH);
96
+ $robot->advance();
97
+ $this->assertEquals([0, -1], $robot->position);
98
+ $this->assertEquals(Robot::DIRECTION_SOUTH, $robot->direction);
99
+
100
+ // Increases the x coordinate by one when facing east
101
+ $robot = new Robot([0, 0], Robot::DIRECTION_EAST);
102
+ $robot->advance();
103
+ $this->assertEquals([1, 0], $robot->position);
104
+ $this->assertEquals(Robot::DIRECTION_EAST, $robot->direction);
105
+
106
+ // Decreases the x coordinate by one when facing west
107
+ $robot = new Robot([0, 0], Robot::DIRECTION_WEST);
108
+ $robot->advance();
109
+ $this->assertEquals([-1, 0], $robot->position);
110
+ $this->assertEquals(Robot::DIRECTION_WEST, $robot->direction);
111
+ }
112
+
113
+
114
+ /**
115
+ * Where R = Turn Right, L = Turn Left and A = Advance,
116
+ * the robot can follow a series of instructions
117
+ * and end up with the correct position and direction
118
+ */
119
+ public function testInstructions()
120
+ {
121
+ // Instructions to move west and north
122
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
123
+ $robot->instructions('LAAARALA');
124
+ $this->assertEquals([-4, 1], $robot->position);
125
+ $this->assertEquals(Robot::DIRECTION_WEST, $robot->direction);
126
+
127
+ // Instructions to move west and south
128
+ $robot = new Robot([2, -7], Robot::DIRECTION_EAST);
129
+ $robot->instructions('RRAAAAALA');
130
+ $this->assertEquals([-3, -8], $robot->position);
131
+ $this->assertEquals(Robot::DIRECTION_SOUTH, $robot->direction);
132
+
133
+ // Instructions to move east and north
134
+ $robot = new Robot([8, 4], Robot::DIRECTION_SOUTH);
135
+ $robot->instructions('LAAARRRALLLL');
136
+ $this->assertEquals([11, 5], $robot->position);
137
+ $this->assertEquals(Robot::DIRECTION_NORTH, $robot->direction);
138
+ }
139
+
140
+
141
+ /**
142
+ * @expectedException InvalidArgumentException
143
+ */
144
+ public function testMalformedInstructions()
145
+ {
146
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
147
+ $robot->instructions('LARX');
148
+ }
149
+
150
+
151
+ /**
152
+ * Optional instructions chaining
153
+ */
154
+ public function testInstructionsChaining()
155
+ {
156
+ $robot = new Robot([0, 0], Robot::DIRECTION_NORTH);
157
+ $robot->turnLeft()
158
+ ->advance()
159
+ ->advance()
160
+ ->advance()
161
+ ->turnRight()
162
+ ->advance()
163
+ ->turnLeft()
164
+ ->advance();
165
+ $this->assertEquals([-4, 1], $robot->position);
166
+ $this->assertEquals(Robot::DIRECTION_WEST, $robot->direction);
167
+ }
168
+ }
@@ -10,58 +10,67 @@
10
10
  ],
11
11
  "exercises": [
12
12
  {
13
- "difficulty": 1,
14
13
  "slug": "hello-world",
14
+ "difficulty": 1,
15
15
  "topics": [
16
16
  "strings",
17
17
  "default arguments"
18
18
  ]
19
19
  },
20
20
  {
21
- "difficulty": 1,
22
21
  "slug": "difference-of-squares",
22
+ "difficulty": 1,
23
23
  "topics": [
24
24
  "iterators"
25
25
  ]
26
26
  },
27
27
  {
28
- "difficulty": 1,
29
28
  "slug": "bob",
29
+ "difficulty": 1,
30
30
  "topics": [
31
31
  "strings"
32
32
  ]
33
33
  },
34
34
  {
35
- "difficulty": 1,
36
35
  "slug": "hamming",
36
+ "difficulty": 1,
37
37
  "topics": [
38
38
  "errors"
39
39
  ]
40
40
  },
41
41
  {
42
- "difficulty": 1,
43
42
  "slug": "leap",
43
+ "difficulty": 1,
44
44
  "topics": [
45
45
  "math",
46
46
  "booleans"
47
47
  ]
48
48
  },
49
49
  {
50
- "difficulty": 1,
51
50
  "slug": "anagram",
51
+ "difficulty": 1,
52
52
  "topics": [
53
53
  "reference capabilities",
54
54
  "strings"
55
55
  ]
56
56
  },
57
57
  {
58
- "difficulty": 1,
59
58
  "slug": "rna-transcription",
59
+ "difficulty": 1,
60
60
  "topics": [
61
61
  "strings",
62
62
  "errors",
63
63
  "iterators"
64
64
  ]
65
+ },
66
+ {
67
+ "slug": "roman-numerals",
68
+ "difficulty": 2,
69
+ "topics": [
70
+ "strings",
71
+ "errors",
72
+ "math"
73
+ ]
65
74
  }
66
75
  ]
67
76
  }
@@ -0,0 +1,35 @@
1
+ use "collections"
2
+
3
+ primitive RomanNumerals
4
+ fun apply(n: USize): String ? =>
5
+ if n == 0 then
6
+ return ""
7
+ elseif n >= 4000 then
8
+ error
9
+ end
10
+
11
+ let numerals: Array[(USize, String)] = [
12
+ (1000, "M"),
13
+ (900, "CM"),
14
+ (500, "D"),
15
+ (400, "CD"),
16
+ (100, "C"),
17
+ (90, "XC"),
18
+ (50, "L"),
19
+ (40, "XL"),
20
+ (10, "X"),
21
+ (9, "IX"),
22
+ (5, "V"),
23
+ (4, "IV"),
24
+ (1, "I")
25
+ ]
26
+
27
+ let str = recover String end
28
+ var n' = n
29
+ for (arabic, roman) in numerals.values() do
30
+ while n' >= arabic do
31
+ str.append(roman)
32
+ n' = n' - arabic
33
+ end
34
+ end
35
+ str
@@ -0,0 +1,45 @@
1
+ use "ponytest"
2
+
3
+ actor Main is TestList
4
+ new create(env: Env) =>
5
+ PonyTest(env, this)
6
+
7
+ fun tag tests(test: PonyTest) =>
8
+ test(_TestRomanNumerals)
9
+
10
+ class iso _TestRomanNumerals is UnitTest
11
+ fun name(): String => "roman-numerals/RomanNumerals"
12
+
13
+ fun apply(h: TestHelper) =>
14
+ let tests: Array[(USize, String)] = [
15
+ (0, ""),
16
+ (1, "I"),
17
+ (2, "II"),
18
+ (3, "III"),
19
+ (4, "IV"),
20
+ (5, "V"),
21
+ (6, "VI"),
22
+ (9, "IX"),
23
+ (27, "XXVII"),
24
+ (48, "XLVIII"),
25
+ (59, "LIX"),
26
+ (93, "XCIII"),
27
+ (141, "CXLI"),
28
+ (163, "CLXIII"),
29
+ (402, "CDII"),
30
+ (575, "DLXXV"),
31
+ (911, "CMXI"),
32
+ (1024, "MXXIV"),
33
+ (3000, "MMM")
34
+ ]
35
+
36
+ for test in tests.values() do
37
+ try
38
+ h.assert_eq[String](RomanNumerals(test._1), test._2)
39
+ else
40
+ h.fail()
41
+ end
42
+ end
43
+
44
+ h.assert_error({() ? => RomanNumerals(-1)})
45
+ h.assert_error({() ? => RomanNumerals(4000)})
@@ -1,3 +1,3 @@
1
1
  flake8>=3.2,<3.2.99
2
2
  pep8>=1.7,<1.7.99
3
- pyflakes>=1.3,<1.3.99
3
+ pyflakes>=1.5,<1.5.99
@@ -1559,7 +1559,7 @@ Style/SpaceAfterColon:
1559
1559
  Style/SpaceAfterComma:
1560
1560
  Description: Use spaces after commas.
1561
1561
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
1562
- Enabled: false
1562
+ Enabled: true
1563
1563
 
1564
1564
  # Supports --auto-correct
1565
1565
  Style/SpaceAfterControlKeyword: