trackler 2.2.1.128 → 2.2.1.129

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/bracket-push/canonical-data.json +9 -1
  4. data/tracks/bash/config.json +3 -3
  5. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +3 -1
  6. data/tracks/crystal/exercises/difference-of-squares/spec/difference_of_squares_spec.cr +9 -9
  7. data/tracks/csharp/config.json +12 -0
  8. data/tracks/csharp/exercises/Exercises.sln +7 -1
  9. data/tracks/csharp/exercises/yacht/Example.cs +71 -0
  10. data/tracks/csharp/exercises/yacht/README.md +34 -0
  11. data/tracks/csharp/exercises/yacht/Yacht.cs +26 -0
  12. data/tracks/csharp/exercises/yacht/Yacht.csproj +18 -0
  13. data/tracks/csharp/exercises/yacht/YachtTest.cs +162 -0
  14. data/tracks/csharp/generators/Exercises/Yacht.cs +20 -0
  15. data/tracks/dart/exercises/leap/lib/example.dart +4 -8
  16. data/tracks/dart/exercises/leap/lib/leap.dart +1 -1
  17. data/tracks/dart/exercises/leap/test/leap_test.dart +14 -16
  18. data/tracks/delphi/config.json +11 -0
  19. data/tracks/delphi/exercises/bracket-push/BracketPush.dpr +60 -0
  20. data/tracks/delphi/exercises/bracket-push/README.md +31 -0
  21. data/tracks/delphi/exercises/bracket-push/uBracketPushExample.pas +40 -0
  22. data/tracks/delphi/exercises/bracket-push/uBracketPushTest.pas +158 -0
  23. data/tracks/fsharp/config.json +18 -6
  24. data/tracks/fsharp/exercises/Exercises.sln +7 -1
  25. data/tracks/fsharp/exercises/accumulate/Accumulate.fsproj +2 -2
  26. data/tracks/fsharp/exercises/acronym/Acronym.fsproj +2 -2
  27. data/tracks/fsharp/exercises/all-your-base/AllYourBase.fsproj +2 -2
  28. data/tracks/fsharp/exercises/allergies/Allergies.fsproj +2 -2
  29. data/tracks/fsharp/exercises/alphametics/Alphametics.fsproj +2 -2
  30. data/tracks/fsharp/exercises/anagram/Anagram.fsproj +2 -2
  31. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fsproj +2 -2
  32. data/tracks/fsharp/exercises/atbash-cipher/AtbashCipher.fsproj +2 -2
  33. data/tracks/fsharp/exercises/bank-account/BankAccount.fsproj +2 -2
  34. data/tracks/fsharp/exercises/beer-song/BeerSong.fsproj +2 -2
  35. data/tracks/fsharp/exercises/binary/Binary.fsproj +2 -2
  36. data/tracks/fsharp/exercises/binary-search/BinarySearch.fsproj +2 -2
  37. data/tracks/fsharp/exercises/binary-search-tree/BinarySearchTree.fsproj +2 -2
  38. data/tracks/fsharp/exercises/bob/Bob.fsproj +2 -2
  39. data/tracks/fsharp/exercises/book-store/BookStore.fsproj +2 -2
  40. data/tracks/fsharp/exercises/bowling/Bowling.fsproj +2 -2
  41. data/tracks/fsharp/exercises/bowling/BowlingTest.fs +15 -1
  42. data/tracks/fsharp/exercises/bracket-push/BracketPush.fsproj +2 -2
  43. data/tracks/fsharp/exercises/change/Change.fsproj +2 -2
  44. data/tracks/fsharp/exercises/circular-buffer/CircularBuffer.fsproj +2 -2
  45. data/tracks/fsharp/exercises/circular-buffer/CircularBufferTest.fs +1 -1
  46. data/tracks/fsharp/exercises/clock/Clock.fsproj +2 -2
  47. data/tracks/fsharp/exercises/collatz-conjecture/CollatzConjecture.fsproj +2 -2
  48. data/tracks/fsharp/exercises/complex-numbers/ComplexNumbers.fsproj +2 -2
  49. data/tracks/fsharp/exercises/connect/Connect.fsproj +2 -2
  50. data/tracks/fsharp/exercises/crypto-square/CryptoSquare.fsproj +2 -2
  51. data/tracks/fsharp/exercises/custom-set/CustomSet.fsproj +2 -2
  52. data/tracks/fsharp/exercises/diamond/Diamond.fsproj +2 -2
  53. data/tracks/fsharp/exercises/difference-of-squares/DifferenceOfSquares.fsproj +2 -2
  54. data/tracks/fsharp/exercises/diffie-hellman/DiffieHellman.fsproj +2 -2
  55. data/tracks/fsharp/exercises/dominoes/Dominoes.fsproj +2 -2
  56. data/tracks/fsharp/exercises/dot-dsl/DotDsl.fsproj +2 -2
  57. data/tracks/fsharp/exercises/error-handling/ErrorHandling.fsproj +2 -2
  58. data/tracks/fsharp/exercises/etl/Etl.fsproj +2 -2
  59. data/tracks/fsharp/exercises/food-chain/FoodChain.fsproj +2 -2
  60. data/tracks/fsharp/exercises/forth/Forth.fsproj +2 -2
  61. data/tracks/fsharp/exercises/forth/ForthTest.fs +1 -1
  62. data/tracks/fsharp/exercises/gigasecond/Gigasecond.fsproj +2 -2
  63. data/tracks/fsharp/exercises/go-counting/GoCounting.fsproj +2 -2
  64. data/tracks/fsharp/exercises/grade-school/GradeSchool.fsproj +2 -2
  65. data/tracks/fsharp/exercises/grains/Grains.fsproj +2 -2
  66. data/tracks/fsharp/exercises/grains/GrainsTest.fs +1 -1
  67. data/tracks/fsharp/exercises/grep/Grep.fsproj +2 -2
  68. data/tracks/fsharp/exercises/grep/GrepTest.fs +1 -1
  69. data/tracks/fsharp/exercises/hamming/Hamming.fsproj +2 -2
  70. data/tracks/fsharp/exercises/hangman/Hangman.fsproj +2 -2
  71. data/tracks/fsharp/exercises/hello-world/HelloWorld.fsproj +2 -2
  72. data/tracks/fsharp/exercises/hexadecimal/Hexadecimal.fsproj +2 -2
  73. data/tracks/fsharp/exercises/house/Example.fs +2 -2
  74. data/tracks/fsharp/exercises/house/House.fsproj +2 -2
  75. data/tracks/fsharp/exercises/house/HouseTest.fs +28 -211
  76. data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifier.fsproj +2 -2
  77. data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifierTest.fs +2 -2
  78. data/tracks/fsharp/exercises/isogram/Isogram.fsproj +2 -2
  79. data/tracks/fsharp/exercises/isogram/IsogramTest.fs +1 -1
  80. data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGarden.fsproj +2 -2
  81. data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProduct.fsproj +2 -2
  82. data/tracks/fsharp/exercises/leap/Leap.fsproj +2 -2
  83. data/tracks/fsharp/exercises/ledger/Ledger.fsproj +2 -2
  84. data/tracks/fsharp/exercises/lens-person/LensPerson.fsproj +2 -2
  85. data/tracks/fsharp/exercises/linked-list/LinkedList.fsproj +2 -2
  86. data/tracks/fsharp/exercises/list-ops/ListOps.fsproj +2 -2
  87. data/tracks/fsharp/exercises/list-ops/ListOpsTest.fs +1 -1
  88. data/tracks/fsharp/exercises/luhn/Luhn.fsproj +2 -2
  89. data/tracks/fsharp/exercises/markdown/Markdown.fsproj +2 -2
  90. data/tracks/fsharp/exercises/matrix/Matrix.fsproj +2 -2
  91. data/tracks/fsharp/exercises/meetup/Meetup.fsproj +2 -2
  92. data/tracks/fsharp/exercises/minesweeper/Minesweeper.fsproj +2 -2
  93. data/tracks/fsharp/exercises/nth-prime/NthPrime.fsproj +2 -2
  94. data/tracks/fsharp/exercises/nucleotide-count/NucleotideCount.fsproj +2 -2
  95. data/tracks/fsharp/exercises/ocr-numbers/OcrNumbers.fsproj +2 -2
  96. data/tracks/fsharp/exercises/octal/Octal.fsproj +2 -2
  97. data/tracks/fsharp/exercises/palindrome-products/PalindromeProducts.fsproj +2 -2
  98. data/tracks/fsharp/exercises/pangram/Pangram.fsproj +2 -2
  99. data/tracks/fsharp/exercises/parallel-letter-frequency/ParallelLetterFrequency.fsproj +2 -2
  100. data/tracks/fsharp/exercises/pascals-triangle/PascalsTriangle.fsproj +2 -2
  101. data/tracks/fsharp/exercises/perfect-numbers/PerfectNumbers.fsproj +2 -2
  102. data/tracks/fsharp/exercises/phone-number/PhoneNumber.fsproj +2 -2
  103. data/tracks/fsharp/exercises/pig-latin/PigLatin.fsproj +2 -2
  104. data/tracks/fsharp/exercises/poker/Poker.fsproj +2 -2
  105. data/tracks/fsharp/exercises/pov/Pov.fsproj +2 -2
  106. data/tracks/fsharp/exercises/pov/PovTest.fs +2 -2
  107. data/tracks/fsharp/exercises/prime-factors/PrimeFactors.fsproj +2 -2
  108. data/tracks/fsharp/exercises/protein-translation/ProteinTranslation.fsproj +2 -2
  109. data/tracks/fsharp/exercises/proverb/Proverb.fsproj +2 -2
  110. data/tracks/fsharp/exercises/pythagorean-triplet/PythagoreanTriplet.fsproj +2 -2
  111. data/tracks/fsharp/exercises/queen-attack/QueenAttack.fsproj +2 -2
  112. data/tracks/fsharp/exercises/rail-fence-cipher/RailFenceCipher.fsproj +2 -2
  113. data/tracks/fsharp/exercises/raindrops/Raindrops.fsproj +2 -2
  114. data/tracks/fsharp/exercises/rational-numbers/RationalNumbers.fsproj +2 -2
  115. data/tracks/fsharp/exercises/react/Example.fs +1 -1
  116. data/tracks/fsharp/exercises/react/React.fsproj +2 -2
  117. data/tracks/fsharp/exercises/react/ReactTest.fs +14 -1
  118. data/tracks/fsharp/exercises/rectangles/Rectangles.fsproj +2 -2
  119. data/tracks/fsharp/exercises/reverse-string/ReverseString.fsproj +2 -2
  120. data/tracks/fsharp/exercises/rna-transcription/RnaTranscription.fsproj +2 -2
  121. data/tracks/fsharp/exercises/robot-name/RobotName.fsproj +2 -2
  122. data/tracks/fsharp/exercises/robot-simulator/RobotSimulator.fsproj +2 -2
  123. data/tracks/fsharp/exercises/roman-numerals/RomanNumerals.fsproj +2 -2
  124. data/tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fsproj +2 -2
  125. data/tracks/fsharp/exercises/run-length-encoding/RunLengthEncoding.fsproj +2 -2
  126. data/tracks/fsharp/exercises/saddle-points/SaddlePoints.fsproj +2 -2
  127. data/tracks/fsharp/exercises/say/Say.fsproj +2 -2
  128. data/tracks/fsharp/exercises/scale-generator/ScaleGenerator.fsproj +2 -2
  129. data/tracks/fsharp/exercises/scrabble-score/ScrabbleScore.fsproj +2 -2
  130. data/tracks/fsharp/exercises/secret-handshake/SecretHandshake.fsproj +2 -2
  131. data/tracks/fsharp/exercises/series/Series.fsproj +2 -2
  132. data/tracks/fsharp/exercises/sgf-parsing/SgfParsing.fsproj +2 -2
  133. data/tracks/fsharp/exercises/sieve/Sieve.fsproj +2 -2
  134. data/tracks/fsharp/exercises/simple-cipher/SimpleCipher.fsproj +2 -2
  135. data/tracks/fsharp/exercises/simple-linked-list/SimpleLinkedList.fsproj +2 -2
  136. data/tracks/fsharp/exercises/space-age/SpaceAge.fsproj +2 -2
  137. data/tracks/fsharp/exercises/spiral-matrix/SpiralMatrix.fsproj +2 -2
  138. data/tracks/fsharp/exercises/strain/Strain.fsproj +2 -2
  139. data/tracks/fsharp/exercises/sublist/Sublist.fsproj +2 -2
  140. data/tracks/fsharp/exercises/sum-of-multiples/SumOfMultiples.fsproj +2 -2
  141. data/tracks/fsharp/exercises/tournament/Tournament.fsproj +2 -2
  142. data/tracks/fsharp/exercises/transpose/Transpose.fsproj +2 -2
  143. data/tracks/fsharp/exercises/tree-building/TreeBuilding.fsproj +2 -2
  144. data/tracks/fsharp/exercises/triangle/Triangle.fsproj +2 -2
  145. data/tracks/fsharp/exercises/trinary/Trinary.fsproj +2 -2
  146. data/tracks/fsharp/exercises/twelve-days/TwelveDays.fsproj +2 -2
  147. data/tracks/fsharp/exercises/two-bucket/TwoBucket.fsproj +2 -2
  148. data/tracks/fsharp/exercises/two-fer/TwoFer.fsproj +2 -2
  149. data/tracks/fsharp/exercises/variable-length-quantity/VariableLengthQuantity.fsproj +2 -2
  150. data/tracks/fsharp/exercises/word-count/WordCount.fsproj +2 -2
  151. data/tracks/fsharp/exercises/word-search/WordSearch.fsproj +2 -2
  152. data/tracks/fsharp/exercises/word-search/WordSearchTest.fs +1 -1
  153. data/tracks/fsharp/exercises/wordy/Wordy.fsproj +2 -2
  154. data/tracks/fsharp/exercises/yacht/Example.fs +65 -0
  155. data/tracks/fsharp/exercises/yacht/Program.fs +1 -0
  156. data/tracks/fsharp/exercises/yacht/README.md +34 -0
  157. data/tracks/fsharp/exercises/yacht/Yacht.fs +17 -0
  158. data/tracks/fsharp/exercises/yacht/Yacht.fsproj +23 -0
  159. data/tracks/fsharp/exercises/yacht/YachtTest.fs +113 -0
  160. data/tracks/fsharp/exercises/zebra-puzzle/ZebraPuzzle.fsproj +2 -2
  161. data/tracks/fsharp/exercises/zipper/Zipper.fsproj +2 -2
  162. data/tracks/fsharp/generators/CanonicalData.fs +2 -20
  163. data/tracks/fsharp/generators/Common.fs +1 -1
  164. data/tracks/fsharp/generators/Generators.fs +24 -11
  165. data/tracks/fsharp/generators/Generators.fsproj +4 -4
  166. data/tracks/fsharp/generators/Options.fs +1 -1
  167. data/tracks/haskell/exercises/bracket-push/package.yaml +1 -1
  168. data/tracks/haskell/exercises/bracket-push/test/Tests.hs +4 -0
  169. data/tracks/java/config.json +13 -0
  170. data/tracks/java/exercises/dominoes/.meta/src/reference/java/ChainNotFoundException.java +5 -0
  171. data/tracks/java/exercises/dominoes/.meta/src/reference/java/Domino.java +30 -0
  172. data/tracks/java/exercises/dominoes/.meta/src/reference/java/Dominoes.java +67 -0
  173. data/tracks/java/exercises/dominoes/.meta/version +2 -0
  174. data/tracks/java/exercises/dominoes/README.md +29 -0
  175. data/tracks/java/exercises/dominoes/build.gradle +18 -0
  176. data/tracks/java/exercises/dominoes/src/main/java/ChainNotFoundException.java +5 -0
  177. data/tracks/java/exercises/dominoes/src/main/java/Domino.java +30 -0
  178. data/tracks/java/exercises/dominoes/src/test/java/DominoesTest.java +230 -0
  179. data/tracks/java/exercises/settings.gradle +1 -0
  180. data/tracks/javascript/.eslintignore +0 -1
  181. data/tracks/javascript/exercises/simple-cipher/example.js +4 -6
  182. data/tracks/javascript/exercises/simple-cipher/simple-cipher.spec.js +7 -3
  183. data/tracks/php/config.json +7 -7
  184. data/tracks/python/config.json +195 -188
  185. data/tracks/python/exercises/alphametics/alphametics_test.py +1 -0
  186. data/tracks/python/exercises/bank-account/README.md +20 -1
  187. data/tracks/python/exercises/go-counting/README.md +2 -0
  188. data/tracks/python/test/check-exercises.py +1 -1
  189. data/tracks/rust/_test/ensure-stubs-compile.sh +5 -0
  190. data/tracks/rust/config/exercise_readme.go.tmpl +1 -1
  191. data/tracks/rust/config.json +10 -0
  192. data/tracks/rust/exercises/accumulate/README.md +1 -1
  193. data/tracks/rust/exercises/acronym/README.md +1 -1
  194. data/tracks/rust/exercises/all-your-base/README.md +1 -1
  195. data/tracks/rust/exercises/all-your-base/example.rs +15 -5
  196. data/tracks/rust/exercises/all-your-base/src/lib.rs +8 -1
  197. data/tracks/rust/exercises/all-your-base/tests/all-your-base.rs +10 -5
  198. data/tracks/rust/exercises/allergies/README.md +1 -1
  199. data/tracks/rust/exercises/alphametics/README.md +1 -1
  200. data/tracks/rust/exercises/anagram/README.md +1 -1
  201. data/tracks/rust/exercises/armstrong-numbers/.gitignore +3 -0
  202. data/tracks/rust/exercises/armstrong-numbers/Cargo.toml +3 -0
  203. data/tracks/rust/exercises/armstrong-numbers/README.md +51 -0
  204. data/tracks/rust/exercises/armstrong-numbers/example.rs +7 -0
  205. data/tracks/rust/exercises/armstrong-numbers/src/lib.rs +3 -0
  206. data/tracks/rust/exercises/armstrong-numbers/tests/armstrong-numbers.rs +49 -0
  207. data/tracks/rust/exercises/atbash-cipher/README.md +1 -1
  208. data/tracks/rust/exercises/beer-song/README.md +1 -1
  209. data/tracks/rust/exercises/binary-search/README.md +1 -1
  210. data/tracks/rust/exercises/bob/README.md +1 -1
  211. data/tracks/rust/exercises/book-store/README.md +1 -1
  212. data/tracks/rust/exercises/bowling/README.md +1 -1
  213. data/tracks/rust/exercises/bowling/example.rs +13 -8
  214. data/tracks/rust/exercises/bowling/src/lib.rs +22 -0
  215. data/tracks/rust/exercises/bowling/tests/bowling.rs +31 -31
  216. data/tracks/rust/exercises/bracket-push/README.md +1 -1
  217. data/tracks/rust/exercises/circular-buffer/README.md +1 -1
  218. data/tracks/rust/exercises/clock/README.md +1 -1
  219. data/tracks/rust/exercises/collatz-conjecture/README.md +1 -1
  220. data/tracks/rust/exercises/crypto-square/README.md +1 -1
  221. data/tracks/rust/exercises/crypto-square/example.rs +11 -3
  222. data/tracks/rust/exercises/crypto-square/tests/crypto-square.rs +8 -16
  223. data/tracks/rust/exercises/custom-set/README.md +1 -1
  224. data/tracks/rust/exercises/custom-set/example.rs +17 -17
  225. data/tracks/rust/exercises/custom-set/tests/custom-set.rs +84 -84
  226. data/tracks/rust/exercises/decimal/README.md +1 -1
  227. data/tracks/rust/exercises/difference-of-squares/README.md +1 -1
  228. data/tracks/rust/exercises/diffie-hellman/README.md +1 -1
  229. data/tracks/rust/exercises/dominoes/README.md +1 -1
  230. data/tracks/rust/exercises/etl/README.md +1 -1
  231. data/tracks/rust/exercises/forth/README.md +1 -1
  232. data/tracks/rust/exercises/gigasecond/README.md +1 -1
  233. data/tracks/rust/exercises/grade-school/README.md +1 -1
  234. data/tracks/rust/exercises/grains/README.md +1 -1
  235. data/tracks/rust/exercises/hamming/README.md +1 -1
  236. data/tracks/rust/exercises/hello-world/README.md +1 -1
  237. data/tracks/rust/exercises/hexadecimal/README.md +1 -1
  238. data/tracks/rust/exercises/isbn-verifier/README.md +1 -1
  239. data/tracks/rust/exercises/isogram/README.md +1 -1
  240. data/tracks/rust/exercises/largest-series-product/README.md +1 -1
  241. data/tracks/rust/exercises/largest-series-product/example.rs +10 -4
  242. data/tracks/rust/exercises/largest-series-product/src/lib.rs +9 -0
  243. data/tracks/rust/exercises/largest-series-product/tests/largest-series-product.rs +3 -3
  244. data/tracks/rust/exercises/leap/README.md +1 -1
  245. data/tracks/rust/exercises/luhn/README.md +1 -1
  246. data/tracks/rust/exercises/luhn-from/README.md +1 -1
  247. data/tracks/rust/exercises/luhn-trait/README.md +1 -1
  248. data/tracks/rust/exercises/macros/.meta/ALLOWED_TO_NOT_COMPILE +2 -0
  249. data/tracks/rust/exercises/macros/README.md +1 -1
  250. data/tracks/rust/exercises/minesweeper/README.md +1 -1
  251. data/tracks/rust/exercises/nth-prime/README.md +1 -1
  252. data/tracks/rust/exercises/nucleotide-codons/README.md +1 -1
  253. data/tracks/rust/exercises/nucleotide-count/README.md +1 -1
  254. data/tracks/rust/exercises/ocr-numbers/README.md +1 -1
  255. data/tracks/rust/exercises/ocr-numbers/example.rs +14 -6
  256. data/tracks/rust/exercises/ocr-numbers/src/lib.rs +7 -1
  257. data/tracks/rust/exercises/ocr-numbers/tests/ocr-numbers.rs +2 -2
  258. data/tracks/rust/exercises/pangram/README.md +1 -1
  259. data/tracks/rust/exercises/parallel-letter-frequency/README.md +1 -1
  260. data/tracks/rust/exercises/pascals-triangle/README.md +1 -1
  261. data/tracks/rust/exercises/perfect-numbers/README.md +1 -1
  262. data/tracks/rust/exercises/phone-number/README.md +1 -1
  263. data/tracks/rust/exercises/pig-latin/README.md +1 -1
  264. data/tracks/rust/exercises/poker/README.md +1 -1
  265. data/tracks/rust/exercises/prime-factors/README.md +1 -1
  266. data/tracks/rust/exercises/protein-translation/README.md +1 -1
  267. data/tracks/rust/exercises/proverb/README.md +1 -1
  268. data/tracks/rust/exercises/pythagorean-triplet/README.md +1 -1
  269. data/tracks/rust/exercises/queen-attack/README.md +1 -1
  270. data/tracks/rust/exercises/raindrops/README.md +1 -1
  271. data/tracks/rust/exercises/react/README.md +1 -1
  272. data/tracks/rust/exercises/react/example.rs +27 -18
  273. data/tracks/rust/exercises/react/src/lib.rs +25 -10
  274. data/tracks/rust/exercises/react/tests/react.rs +113 -83
  275. data/tracks/rust/exercises/rectangles/README.md +1 -1
  276. data/tracks/rust/exercises/reverse-string/README.md +1 -1
  277. data/tracks/rust/exercises/rna-transcription/README.md +1 -1
  278. data/tracks/rust/exercises/robot-name/README.md +1 -1
  279. data/tracks/rust/exercises/robot-simulator/README.md +1 -1
  280. data/tracks/rust/exercises/roman-numerals/README.md +1 -1
  281. data/tracks/rust/exercises/rotational-cipher/README.md +1 -1
  282. data/tracks/rust/exercises/run-length-encoding/README.md +1 -1
  283. data/tracks/rust/exercises/saddle-points/README.md +1 -1
  284. data/tracks/rust/exercises/say/README.md +1 -1
  285. data/tracks/rust/exercises/scrabble-score/README.md +1 -1
  286. data/tracks/rust/exercises/series/README.md +1 -1
  287. data/tracks/rust/exercises/sieve/README.md +1 -1
  288. data/tracks/rust/exercises/simple-linked-list/README.md +1 -1
  289. data/tracks/rust/exercises/space-age/README.md +1 -1
  290. data/tracks/rust/exercises/sublist/README.md +1 -1
  291. data/tracks/rust/exercises/sum-of-multiples/README.md +1 -1
  292. data/tracks/rust/exercises/tournament/README.md +1 -1
  293. data/tracks/rust/exercises/triangle/README.md +1 -1
  294. data/tracks/rust/exercises/two-bucket/README.md +1 -1
  295. data/tracks/rust/exercises/variable-length-quantity/README.md +1 -1
  296. data/tracks/rust/exercises/word-count/README.md +1 -1
  297. data/tracks/rust/exercises/wordy/README.md +1 -1
  298. data/tracks/typescript/config.json +11 -0
  299. data/tracks/typescript/exercises/list-ops/README.md +35 -0
  300. data/tracks/typescript/exercises/list-ops/list-ops.example.ts +80 -0
  301. data/tracks/typescript/exercises/list-ops/list-ops.test.ts +117 -0
  302. data/tracks/typescript/exercises/list-ops/list-ops.ts +0 -0
  303. data/tracks/typescript/exercises/list-ops/package.json +36 -0
  304. data/tracks/typescript/exercises/list-ops/tsconfig.json +22 -0
  305. data/tracks/typescript/exercises/list-ops/tslint.json +127 -0
  306. data/tracks/typescript/exercises/list-ops/yarn.lock +2624 -0
  307. metadata +42 -3
  308. data/tracks/dart/exercises/leap/pubspec.lock +0 -293
@@ -66,6 +66,7 @@ class TestAlphametics(unittest.TestCase):
66
66
  "S": 6,
67
67
  "T": 9})
68
68
 
69
+ @unittest.skip("extra-credit")
69
70
  def test_puzzle_with_ten_letters_and_199_addends(self):
70
71
  self.assertEqual(
71
72
  solve(
@@ -34,12 +34,30 @@ every exercise will require you to raise an exception, but for those that do, th
34
34
  a message.
35
35
 
36
36
  To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
37
- `raise Exception`, you shold write:
37
+ `raise Exception`, you should write:
38
38
 
39
39
  ```python
40
40
  raise Exception("Meaningful message indicating the source of the error")
41
41
  ```
42
42
 
43
+ ## Running the tests
44
+
45
+ To run the tests, run the appropriate command below ([why they are different](https://github.com/pytest-dev/pytest/issues/1629#issue-161422224)):
46
+
47
+ - Python 2.7: `py.test bank_account_test.py`
48
+ - Python 3.3+: `pytest bank_account_test.py`
49
+
50
+ Alternatively, you can tell Python to run the pytest module (allowing the same command to be used regardless of Python version):
51
+ `python -m pytest bank_account_test.py`
52
+
53
+ ### Common `pytest` options
54
+
55
+ - `-v` : enable verbose output
56
+ - `-x` : stop running tests on first failure
57
+ - `--ff` : run failures from previous test before running other test cases
58
+
59
+ For other options, see `python -m pytest -h`
60
+
43
61
  ## Submitting Exercises
44
62
 
45
63
  Note that, when trying to submit an exercise, make sure the solution is in the `$EXERCISM_WORKSPACE/python/bank-account` directory.
@@ -50,4 +68,5 @@ For more detailed information about running tests, code style and linting,
50
68
  please see the [help page](http://exercism.io/languages/python).
51
69
 
52
70
  ## Submitting Incomplete Solutions
71
+
53
72
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -11,6 +11,8 @@ Write a function that determines the territory of each player. You may
11
11
  assume that any stones that have been stranded in enemy territory have
12
12
  already been taken off the board.
13
13
 
14
+ Write a function that determines the territory which includes a specified coordinate.
15
+
14
16
  Multiple empty intersections may be encircled at once and for encircling
15
17
  only horizontal and vertical neighbours count. In the following diagram
16
18
  the stones which matter are marked "O" and the stones that don't are
@@ -10,7 +10,7 @@ import tempfile
10
10
  import json
11
11
 
12
12
  # Allow high-performance tests to be skipped
13
- ALLOW_SKIP = ['largest-series-product']
13
+ ALLOW_SKIP = ['alphametics', 'largest-series-product']
14
14
 
15
15
 
16
16
  def python_executable_name():
@@ -11,6 +11,11 @@ for dir in $repo/exercises/*/; do
11
11
  # it probably contains function signatures, and these should compile.
12
12
  if grep -v '^//' $dir/src/lib.rs | grep '\S' > /dev/null; then
13
13
  allowed_file=$dir/.meta/ALLOWED_TO_NOT_COMPILE
14
+
15
+ # In Travis CI, we may have already compiled using the example solution.
16
+ # Touch the src/lib.rs file so that we surely recompile using the stub.
17
+ touch $dir/src/lib.rs
18
+
14
19
  if [ -f $allowed_file ]; then
15
20
  echo "$exercise's stub is allowed to not compile"
16
21
  elif ! (cd $dir && cargo test --quiet --no-run); then
@@ -28,7 +28,7 @@ haven't already, it will help you with organizing your files.
28
28
 
29
29
  ## Feedback, Issues, Pull Requests
30
30
 
31
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
31
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
32
32
 
33
33
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
34
34
 
@@ -165,6 +165,16 @@
165
165
  "strings"
166
166
  ]
167
167
  },
168
+ {
169
+ "uuid": "e652139e-ff3f-4e03-9810-d21f8b0c9e60",
170
+ "slug": "armstrong-numbers",
171
+ "core": false,
172
+ "unlocked_by": null,
173
+ "difficulty": 1,
174
+ "topics": [
175
+ "mathematics"
176
+ ]
177
+ },
168
178
  {
169
179
  "uuid": "f9afd650-8103-4373-a284-fa4ecfee7207",
170
180
  "slug": "collatz-conjecture",
@@ -61,7 +61,7 @@ haven't already, it will help you with organizing your files.
61
61
 
62
62
  ## Feedback, Issues, Pull Requests
63
63
 
64
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
64
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
65
65
 
66
66
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
67
67
 
@@ -31,7 +31,7 @@ haven't already, it will help you with organizing your files.
31
31
 
32
32
  ## Feedback, Issues, Pull Requests
33
33
 
34
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
34
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
35
35
 
36
36
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
37
37
 
@@ -55,7 +55,7 @@ haven't already, it will help you with organizing your files.
55
55
 
56
56
  ## Feedback, Issues, Pull Requests
57
57
 
58
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
58
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
59
59
 
60
60
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
61
61
 
@@ -1,5 +1,12 @@
1
1
  pub type Digit = u32;
2
2
 
3
+ #[derive(Debug, PartialEq)]
4
+ pub enum Error {
5
+ InvalidInputBase,
6
+ InvalidOutputBase,
7
+ InvalidDigit(Digit),
8
+ }
9
+
3
10
  ///
4
11
  /// Convert a number between two bases.
5
12
  ///
@@ -31,15 +38,18 @@ pub type Digit = u32;
31
38
  /// * Never output leading 0 digits. However, your function must be able to
32
39
  /// process input with leading 0 digits.
33
40
  ///
34
- pub fn convert<P: AsRef<[Digit]>>(digits: P, from_base: Digit, to_base: Digit) -> Result<Vec<Digit>, &'static str> {
41
+ pub fn convert<P: AsRef<[Digit]>>(digits: P, from_base: Digit, to_base: Digit) -> Result<Vec<Digit>, Error> {
35
42
  // check that both bases are in the correct range
36
- if from_base < 2 || to_base < 2 {
37
- return Err("Invalid base");
43
+ if from_base < 2 {
44
+ return Err(Error::InvalidInputBase);
45
+ }
46
+ if to_base < 2 {
47
+ return Err(Error::InvalidOutputBase);
38
48
  }
39
49
 
40
50
  // check that all digits are in the correct range specified by the base
41
- if digits.as_ref().iter().any(|&num| num >= from_base) {
42
- return Err("Digits invalid for input base");
51
+ if let Some(&invalid) = digits.as_ref().iter().find(|&num| *num >= from_base) {
52
+ return Err(Error::InvalidDigit(invalid));
43
53
  }
44
54
 
45
55
  // convert all digits into a single large number
@@ -1,3 +1,10 @@
1
+ #[derive(Debug, PartialEq)]
2
+ pub enum Error {
3
+ InvalidInputBase,
4
+ InvalidOutputBase,
5
+ InvalidDigit(u32),
6
+ }
7
+
1
8
  ///
2
9
  /// Convert a number between two bases.
3
10
  ///
@@ -30,6 +37,6 @@
30
37
  /// process input with leading 0 digits.
31
38
  ///
32
39
  #[allow(unused_variables)]
33
- pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result<Vec<u32>, ()> {
40
+ pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result<Vec<u32>, Error> {
34
41
  unimplemented!()
35
42
  }
@@ -137,7 +137,8 @@ fn invalid_positive_digit() {
137
137
  let input_base = 2;
138
138
  let input_digits = &[1, 2, 1, 0, 1, 0];
139
139
  let output_base = 10;
140
- assert!(ayb::convert(input_digits, input_base, output_base).is_err());
140
+ assert_eq!(ayb::convert(input_digits, input_base, output_base),
141
+ Err(ayb::Error::InvalidDigit(2)));
141
142
  }
142
143
 
143
144
  #[test]
@@ -146,7 +147,8 @@ fn input_base_is_one() {
146
147
  let input_base = 1;
147
148
  let input_digits = &[];
148
149
  let output_base = 10;
149
- assert!(ayb::convert(input_digits, input_base, output_base).is_err());
150
+ assert_eq!(ayb::convert(input_digits, input_base, output_base),
151
+ Err(ayb::Error::InvalidInputBase));
150
152
  }
151
153
 
152
154
  #[test]
@@ -155,7 +157,8 @@ fn output_base_is_one() {
155
157
  let input_base = 2;
156
158
  let input_digits = &[1, 0, 1, 0, 1, 0];
157
159
  let output_base = 1;
158
- assert!(ayb::convert(input_digits, input_base, output_base).is_err());
160
+ assert_eq!(ayb::convert(input_digits, input_base, output_base),
161
+ Err(ayb::Error::InvalidOutputBase));
159
162
  }
160
163
 
161
164
  #[test]
@@ -164,7 +167,8 @@ fn input_base_is_zero() {
164
167
  let input_base = 0;
165
168
  let input_digits = &[];
166
169
  let output_base = 10;
167
- assert!(ayb::convert(input_digits, input_base, output_base).is_err());
170
+ assert_eq!(ayb::convert(input_digits, input_base, output_base),
171
+ Err(ayb::Error::InvalidInputBase));
168
172
  }
169
173
 
170
174
  #[test]
@@ -173,5 +177,6 @@ fn output_base_is_zero() {
173
177
  let input_base = 10;
174
178
  let input_digits = &[7];
175
179
  let output_base = 0;
176
- assert!(ayb::convert(input_digits, input_base, output_base).is_err());
180
+ assert_eq!(ayb::convert(input_digits, input_base, output_base),
181
+ Err(ayb::Error::InvalidOutputBase));
177
182
  }
@@ -53,7 +53,7 @@ haven't already, it will help you with organizing your files.
53
53
 
54
54
  ## Feedback, Issues, Pull Requests
55
55
 
56
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
56
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
57
57
 
58
58
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
59
59
 
@@ -55,7 +55,7 @@ haven't already, it will help you with organizing your files.
55
55
 
56
56
  ## Feedback, Issues, Pull Requests
57
57
 
58
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
58
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
59
59
 
60
60
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
61
61
 
@@ -30,7 +30,7 @@ haven't already, it will help you with organizing your files.
30
30
 
31
31
  ## Feedback, Issues, Pull Requests
32
32
 
33
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
33
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
34
34
 
35
35
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
36
36
 
@@ -0,0 +1,3 @@
1
+ # Ignore Cargo.lock if creating a library
2
+ # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
3
+ Cargo.lock
@@ -0,0 +1,3 @@
1
+ [package]
2
+ name = "armstrong_numbers"
3
+ version = "1.0.0"
@@ -0,0 +1,51 @@
1
+ # Armstrong Numbers
2
+
3
+ An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
4
+
5
+ For example:
6
+
7
+ - 9 is an Armstrong number, because `9 = 9^1 = 9`
8
+ - 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 2`
9
+ - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
10
+ - 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
11
+
12
+ Write some code to determine whether a number is an Armstrong number.
13
+
14
+ ## Rust Installation
15
+
16
+ Refer to the [exercism help page][help-page] for Rust installation and learning
17
+ resources.
18
+
19
+ ## Writing the Code
20
+
21
+ Execute the tests with:
22
+
23
+ ```bash
24
+ $ cargo test
25
+ ```
26
+
27
+ All but the first test have been ignored. After you get the first test to
28
+ pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
29
+ to pass again. The test file is located in the `tests` directory. You can
30
+ also remove the ignore flag from all the tests to get them to run all at once
31
+ if you wish.
32
+
33
+ Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
34
+ haven't already, it will help you with organizing your files.
35
+
36
+ ## Feedback, Issues, Pull Requests
37
+
38
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
39
+
40
+ If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
41
+
42
+ [help-page]: http://exercism.io/languages/rust
43
+ [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
44
+ [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
45
+
46
+ ## Source
47
+
48
+ Wikipedia [https://en.wikipedia.org/wiki/Narcissistic_number](https://en.wikipedia.org/wiki/Narcissistic_number)
49
+
50
+ ## Submitting Incomplete Solutions
51
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,7 @@
1
+ pub fn is_armstrong_number(num: u32) -> bool {
2
+ let s = format!("{}", num);
3
+ let l = s.len();
4
+ s.chars()
5
+ .map(|c| c.to_digit(10).unwrap().pow(l as u32))
6
+ .sum::<u32>() == num
7
+ }
@@ -0,0 +1,3 @@
1
+ pub fn is_armstrong_number(_num: u32) -> bool {
2
+ unimplemented!()
3
+ }
@@ -0,0 +1,49 @@
1
+ extern crate armstrong_numbers;
2
+ use armstrong_numbers::*;
3
+
4
+ #[test]
5
+ fn test_single_digit_numbers_are_armstrong_numbers() {
6
+ assert!(is_armstrong_number(5))
7
+ }
8
+
9
+ #[test]
10
+ #[ignore]
11
+ fn test_there_are_no_2_digit_armstring_numbers() {
12
+ assert!(!is_armstrong_number(10))
13
+ }
14
+
15
+ #[test]
16
+ #[ignore]
17
+ fn test_three_digit_armstrong_number() {
18
+ assert!(is_armstrong_number(153))
19
+ }
20
+
21
+ #[test]
22
+ #[ignore]
23
+ fn test_three_digit_non_armstrong_number() {
24
+ assert!(!is_armstrong_number(100))
25
+ }
26
+
27
+ #[test]
28
+ #[ignore]
29
+ fn test_four_digit_armstrong_number() {
30
+ assert!(is_armstrong_number(9474))
31
+ }
32
+
33
+ #[test]
34
+ #[ignore]
35
+ fn test_four_digit_non_armstrong_number() {
36
+ assert!(!is_armstrong_number(9475))
37
+ }
38
+
39
+ #[test]
40
+ #[ignore]
41
+ fn test_seven_digit_armstrong_number() {
42
+ assert!(is_armstrong_number(9926315))
43
+ }
44
+
45
+ #[test]
46
+ #[ignore]
47
+ fn test_seven_digit_non_armstrong_number() {
48
+ assert!(!is_armstrong_number(9926316))
49
+ }
@@ -52,7 +52,7 @@ haven't already, it will help you with organizing your files.
52
52
 
53
53
  ## Feedback, Issues, Pull Requests
54
54
 
55
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
55
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
56
56
 
57
57
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
58
58
 
@@ -344,7 +344,7 @@ haven't already, it will help you with organizing your files.
344
344
 
345
345
  ## Feedback, Issues, Pull Requests
346
346
 
347
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
347
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
348
348
 
349
349
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
350
350
 
@@ -98,7 +98,7 @@ haven't already, it will help you with organizing your files.
98
98
 
99
99
  ## Feedback, Issues, Pull Requests
100
100
 
101
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
101
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
102
102
 
103
103
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
104
104
 
@@ -37,7 +37,7 @@ haven't already, it will help you with organizing your files.
37
37
 
38
38
  ## Feedback, Issues, Pull Requests
39
39
 
40
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
40
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
41
41
 
42
42
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
43
43
 
@@ -91,7 +91,7 @@ haven't already, it will help you with organizing your files.
91
91
 
92
92
  ## Feedback, Issues, Pull Requests
93
93
 
94
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
94
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
95
95
 
96
96
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
97
97
 
@@ -84,7 +84,7 @@ haven't already, it will help you with organizing your files.
84
84
 
85
85
  ## Feedback, Issues, Pull Requests
86
86
 
87
- The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
87
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
88
88
 
89
89
  If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
90
90
 
@@ -1,3 +1,8 @@
1
+ #[derive(Debug, PartialEq)]
2
+ pub enum Error {
3
+ NotEnoughPinsLeft,
4
+ GameComplete,
5
+ }
1
6
 
2
7
  pub struct BowlingGame {
3
8
  frames: Vec<Frame>,
@@ -96,12 +101,12 @@ impl BowlingGame {
96
101
  BowlingGame { frames: vec![Frame::new()] }
97
102
  }
98
103
 
99
- pub fn roll(&mut self, pins: u16) -> Result<(), &'static str> {
104
+ pub fn roll(&mut self, pins: u16) -> Result<(), Error> {
100
105
  if pins > 10 {
101
- Err("Greater than 10 pins")
106
+ Err(Error::NotEnoughPinsLeft)
102
107
  } else {
103
- if self.score().is_ok() {
104
- return Err("Game Finished. No more rolls.");
108
+ if self.score().is_some() {
109
+ return Err(Error::GameComplete);
105
110
  }
106
111
 
107
112
  for frame in self.frames.iter_mut() {
@@ -109,7 +114,7 @@ impl BowlingGame {
109
114
  }
110
115
 
111
116
  if self.frames.iter().any(|f| !f.is_valid()) {
112
- return Err("Invalid Roll");
117
+ return Err(Error::NotEnoughPinsLeft);
113
118
  }
114
119
 
115
120
  if self.frames.iter().last().unwrap().rolls_done() && self.frames.len() < 10 {
@@ -120,11 +125,11 @@ impl BowlingGame {
120
125
  }
121
126
  }
122
127
 
123
- pub fn score(&self) -> Result<u16, &'static str> {
128
+ pub fn score(&self) -> Option<u16> {
124
129
  if !self.is_done() {
125
- Err("Game Incomplete")
130
+ None
126
131
  } else {
127
- Ok(self.frames.iter().fold(0, |acc, r| acc + r.score()))
132
+ Some(self.frames.iter().fold(0, |acc, r| acc + r.score()))
128
133
  }
129
134
  }
130
135
 
@@ -0,0 +1,22 @@
1
+ #[derive(Debug, PartialEq)]
2
+ pub enum Error {
3
+ NotEnoughPinsLeft,
4
+ GameComplete,
5
+ }
6
+
7
+ pub struct BowlingGame {
8
+ }
9
+
10
+ impl BowlingGame {
11
+ pub fn new() -> Self {
12
+ unimplemented!();
13
+ }
14
+
15
+ pub fn roll(&mut self, pins: u16) -> Result<(), Error> {
16
+ unimplemented!("Record that {} pins have been scored", pins);
17
+ }
18
+
19
+ pub fn score(&self) -> Option<u16> {
20
+ unimplemented!("Return the score if the game is complete, or None if not.");
21
+ }
22
+ }