trackler 2.2.1.56 → 2.2.1.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/TOPICS.txt +2 -2
  4. data/problem-specifications/exercises/zipper/description.md +1 -1
  5. data/tracks/dart/test/exercises_test.dart +9 -9
  6. data/tracks/delphi/exercises/circular-buffer/uCircularBufferExample.pas +3 -3
  7. data/tracks/delphi/exercises/circular-buffer/uCircularBufferTests.pas +160 -86
  8. data/tracks/delphi/exercises/phone-number/README.md +1 -1
  9. data/tracks/erlang/config.json +10 -0
  10. data/tracks/erlang/exercises/isogram/README.md +65 -0
  11. data/tracks/erlang/exercises/isogram/include/exercism.hrl +11 -0
  12. data/tracks/erlang/exercises/isogram/rebar.config +30 -0
  13. data/tracks/erlang/exercises/isogram/src/example.erl +16 -0
  14. data/tracks/erlang/exercises/isogram/src/isogram.app.src +9 -0
  15. data/tracks/erlang/exercises/isogram/src/isogram.erl +9 -0
  16. data/tracks/erlang/exercises/isogram/test/isogram_tests.erl +32 -0
  17. data/tracks/fsharp/exercises/binary-search/BinarySearch.fs +1 -1
  18. data/tracks/fsharp/exercises/binary-search/BinarySearchTest.fs +58 -30
  19. data/tracks/fsharp/exercises/binary-search/Example.fs +1 -1
  20. data/tracks/fsharp/exercises/poker/Example.fs +23 -20
  21. data/tracks/fsharp/exercises/poker/PokerTest.fs +135 -76
  22. data/tracks/fsharp/generators/Generators.fs +21 -0
  23. data/tracks/go/README.md +0 -15
  24. data/tracks/go/bin/run-generators +11 -0
  25. data/tracks/go/config.json +389 -277
  26. data/tracks/go/config/maintainers.json +2 -2
  27. data/tracks/go/docs/TESTS.md +0 -15
  28. data/tracks/go/exercises/accumulate/accumulate_test.go +0 -8
  29. data/tracks/go/exercises/accumulate/example.go +0 -2
  30. data/tracks/go/exercises/acronym/acronym.go +14 -2
  31. data/tracks/go/exercises/acronym/acronym_test.go +0 -8
  32. data/tracks/go/exercises/acronym/cases_test.go +2 -2
  33. data/tracks/go/exercises/acronym/example.go +0 -2
  34. data/tracks/go/exercises/all-your-base/all_your_base_test.go +0 -8
  35. data/tracks/go/exercises/all-your-base/example.go +0 -2
  36. data/tracks/go/exercises/allergies/allergies_test.go +0 -8
  37. data/tracks/go/exercises/allergies/example.go +0 -2
  38. data/tracks/go/exercises/anagram/.meta/gen.go +55 -0
  39. data/tracks/go/exercises/anagram/anagram_test.go +0 -130
  40. data/tracks/go/exercises/anagram/cases_test.go +164 -0
  41. data/tracks/go/exercises/anagram/example.go +0 -2
  42. data/tracks/go/exercises/atbash-cipher/atbash_cipher_test.go +0 -8
  43. data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
  44. data/tracks/go/exercises/atbash-cipher/example.go +0 -2
  45. data/tracks/go/exercises/bank-account/bank_account_test.go +0 -8
  46. data/tracks/go/exercises/bank-account/example.go +0 -2
  47. data/tracks/go/exercises/beer-song/beer_test.go +0 -8
  48. data/tracks/go/exercises/beer-song/example.go +0 -2
  49. data/tracks/go/exercises/binary-search-tree/binary_search_tree_test.go +0 -8
  50. data/tracks/go/exercises/binary-search-tree/example.go +0 -2
  51. data/tracks/go/exercises/binary-search/binary_search_test.go +0 -8
  52. data/tracks/go/exercises/binary-search/example.go +0 -2
  53. data/tracks/go/exercises/binary/binary_test.go +0 -11
  54. data/tracks/go/exercises/binary/example.go +0 -2
  55. data/tracks/go/exercises/bob/bob.go +14 -0
  56. data/tracks/go/exercises/bob/bob_test.go +2 -10
  57. data/tracks/go/exercises/bob/cases_test.go +2 -2
  58. data/tracks/go/exercises/bob/example.go +12 -13
  59. data/tracks/go/exercises/book-store/README.md +92 -0
  60. data/tracks/go/exercises/book-store/book_store_test.go +91 -0
  61. data/tracks/go/exercises/book-store/example.go +52 -0
  62. data/tracks/go/exercises/bowling/bowling_test.go +0 -8
  63. data/tracks/go/exercises/bowling/cases_test.go +2 -2
  64. data/tracks/go/exercises/bowling/example.go +0 -2
  65. data/tracks/go/exercises/bracket-push/bracket_push_test.go +0 -8
  66. data/tracks/go/exercises/bracket-push/cases_test.go +2 -2
  67. data/tracks/go/exercises/bracket-push/example.go +0 -3
  68. data/tracks/go/exercises/change/cases_test.go +10 -3
  69. data/tracks/go/exercises/change/change_test.go +1 -9
  70. data/tracks/go/exercises/change/example.go +0 -2
  71. data/tracks/go/exercises/circular-buffer/circular_buffer_test.go +0 -8
  72. data/tracks/go/exercises/circular-buffer/example.go +0 -2
  73. data/tracks/go/exercises/clock/cases_test.go +2 -2
  74. data/tracks/go/exercises/clock/clock_test.go +2 -9
  75. data/tracks/go/exercises/clock/example.go +0 -2
  76. data/tracks/go/exercises/collatz-conjecture/README.md +51 -0
  77. data/tracks/go/exercises/collatz-conjecture/collatz_conjecture_test.go +77 -0
  78. data/tracks/go/exercises/collatz-conjecture/example.go +24 -0
  79. data/tracks/go/exercises/connect/cases_test.go +2 -2
  80. data/tracks/go/exercises/connect/connect_test.go +0 -8
  81. data/tracks/go/exercises/connect/example.go +0 -2
  82. data/tracks/go/exercises/crypto-square/crypto_square_test.go +0 -8
  83. data/tracks/go/exercises/crypto-square/example.go +0 -2
  84. data/tracks/go/exercises/custom-set/cases_test.go +2 -2
  85. data/tracks/go/exercises/custom-set/custom_set_test.go +0 -8
  86. data/tracks/go/exercises/custom-set/example.go +0 -2
  87. data/tracks/go/exercises/custom-set/example_slice.go +0 -2
  88. data/tracks/go/exercises/diamond/diamond_test.go +0 -8
  89. data/tracks/go/exercises/diamond/example.go +0 -2
  90. data/tracks/go/exercises/difference-of-squares/difference_of_squares_test.go +0 -8
  91. data/tracks/go/exercises/difference-of-squares/example.go +0 -2
  92. data/tracks/go/exercises/diffie-hellman/diffie_hellman_test.go +0 -8
  93. data/tracks/go/exercises/diffie-hellman/example.go +0 -2
  94. data/tracks/go/exercises/error-handling/error_handling_test.go +0 -7
  95. data/tracks/go/exercises/error-handling/example.go +0 -2
  96. data/tracks/go/exercises/etl/etl_test.go +0 -8
  97. data/tracks/go/exercises/etl/example.go +0 -2
  98. data/tracks/go/exercises/flatten-array/.meta/gen.go +52 -0
  99. data/tracks/go/exercises/flatten-array/README.md +35 -0
  100. data/tracks/go/exercises/flatten-array/cases_test.go +42 -0
  101. data/tracks/go/exercises/flatten-array/example.go +25 -0
  102. data/tracks/go/exercises/flatten-array/flatten_test.go +23 -0
  103. data/tracks/go/exercises/food-chain/example.go +0 -2
  104. data/tracks/go/exercises/food-chain/food_chain_test.go +0 -8
  105. data/tracks/go/exercises/forth/cases_test.go +2 -2
  106. data/tracks/go/exercises/forth/example.go +0 -2
  107. data/tracks/go/exercises/forth/forth_test.go +0 -8
  108. data/tracks/go/exercises/gigasecond/cases_test.go +2 -2
  109. data/tracks/go/exercises/gigasecond/example.go +0 -2
  110. data/tracks/go/exercises/gigasecond/gigasecond.go +13 -3
  111. data/tracks/go/exercises/gigasecond/gigasecond_test.go +0 -8
  112. data/tracks/go/exercises/grade-school/example.go +0 -2
  113. data/tracks/go/exercises/grade-school/grade_school_test.go +0 -8
  114. data/tracks/go/exercises/grains/example.go +0 -2
  115. data/tracks/go/exercises/grains/grains_test.go +0 -8
  116. data/tracks/go/exercises/hamming/.meta/hints.md +4 -0
  117. data/tracks/go/exercises/hamming/README.md +6 -0
  118. data/tracks/go/exercises/hamming/example.go +0 -2
  119. data/tracks/go/exercises/hamming/hamming.go +0 -2
  120. data/tracks/go/exercises/hamming/hamming_test.go +0 -8
  121. data/tracks/go/exercises/hello-world/hello_world.go +9 -1
  122. data/tracks/go/exercises/hexadecimal/example.go +0 -2
  123. data/tracks/go/exercises/hexadecimal/hexadecimal_test.go +0 -8
  124. data/tracks/go/exercises/house/example.go +0 -2
  125. data/tracks/go/exercises/house/house_test.go +0 -8
  126. data/tracks/go/exercises/isbn-verifier/README.md +60 -0
  127. data/tracks/go/exercises/isbn-verifier/example.go +57 -0
  128. data/tracks/go/exercises/isbn-verifier/isbn_verifier_test.go +35 -0
  129. data/tracks/go/exercises/isogram/example.go +0 -2
  130. data/tracks/go/exercises/isogram/isogram_test.go +0 -8
  131. data/tracks/go/exercises/kindergarten-garden/example.go +0 -2
  132. data/tracks/go/exercises/kindergarten-garden/kindergarten_garden_test.go +0 -8
  133. data/tracks/go/exercises/largest-series-product/cases_test.go +2 -2
  134. data/tracks/go/exercises/largest-series-product/example.go +0 -2
  135. data/tracks/go/exercises/largest-series-product/largest_series_product_test.go +0 -8
  136. data/tracks/go/exercises/leap/.meta/hints.md +14 -0
  137. data/tracks/go/exercises/leap/README.md +16 -0
  138. data/tracks/go/exercises/leap/cases_test.go +4 -4
  139. data/tracks/go/exercises/leap/example.go +0 -2
  140. data/tracks/go/exercises/leap/leap.go +11 -2
  141. data/tracks/go/exercises/leap/leap_test.go +0 -15
  142. data/tracks/go/exercises/ledger/example.go +0 -2
  143. data/tracks/go/exercises/ledger/ledger.go +0 -2
  144. data/tracks/go/exercises/ledger/ledger_test.go +0 -8
  145. data/tracks/go/exercises/luhn/cases_test.go +2 -2
  146. data/tracks/go/exercises/luhn/example.go +0 -2
  147. data/tracks/go/exercises/luhn/luhn_test.go +0 -8
  148. data/tracks/go/exercises/matrix/example.go +0 -2
  149. data/tracks/go/exercises/matrix/matrix_test.go +0 -8
  150. data/tracks/go/exercises/meetup/cases_test.go +2 -2
  151. data/tracks/go/exercises/meetup/example.go +0 -2
  152. data/tracks/go/exercises/meetup/meetup_test.go +0 -8
  153. data/tracks/go/exercises/minesweeper/example.go +0 -2
  154. data/tracks/go/exercises/minesweeper/minesweeper_test.go +0 -8
  155. data/tracks/go/exercises/nth-prime/example.go +0 -2
  156. data/tracks/go/exercises/nth-prime/nth_prime_test.go +0 -8
  157. data/tracks/go/exercises/nucleotide-count/example.go +0 -2
  158. data/tracks/go/exercises/nucleotide-count/nucleotide_count.go +26 -0
  159. data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +0 -8
  160. data/tracks/go/exercises/ocr-numbers/example.go +0 -2
  161. data/tracks/go/exercises/ocr-numbers/ocr_numbers_test.go +0 -8
  162. data/tracks/go/exercises/octal/example.go +0 -2
  163. data/tracks/go/exercises/octal/octal_test.go +0 -8
  164. data/tracks/go/exercises/paasio/example.go +0 -2
  165. data/tracks/go/exercises/paasio/paasio_test.go +0 -8
  166. data/tracks/go/exercises/palindrome-products/example.go +0 -2
  167. data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +0 -8
  168. data/tracks/go/exercises/pangram/example.go +0 -2
  169. data/tracks/go/exercises/pangram/pangram_test.go +2 -8
  170. data/tracks/go/exercises/parallel-letter-frequency/example.go +0 -2
  171. data/tracks/go/exercises/parallel-letter-frequency/parallel_letter_frequency_test.go +0 -8
  172. data/tracks/go/exercises/pascals-triangle/example.go +0 -2
  173. data/tracks/go/exercises/pascals-triangle/pascals_triangle_test.go +0 -8
  174. data/tracks/go/exercises/perfect-numbers/example.go +0 -2
  175. data/tracks/go/exercises/perfect-numbers/perfect_numbers_test.go +0 -8
  176. data/tracks/go/exercises/phone-number/cases_test.go +2 -2
  177. data/tracks/go/exercises/phone-number/example.go +0 -2
  178. data/tracks/go/exercises/phone-number/phone_number_test.go +0 -8
  179. data/tracks/go/exercises/pig-latin/example.go +0 -2
  180. data/tracks/go/exercises/pig-latin/pig_latin_test.go +0 -8
  181. data/tracks/go/exercises/poker/.meta/hints.md +7 -0
  182. data/tracks/go/exercises/poker/README.md +9 -0
  183. data/tracks/go/exercises/poker/cases_test.go +2 -2
  184. data/tracks/go/exercises/poker/example.go +0 -2
  185. data/tracks/go/exercises/poker/poker_test.go +0 -11
  186. data/tracks/go/exercises/pov/example.go +0 -2
  187. data/tracks/go/exercises/pov/pov_test.go +1 -9
  188. data/tracks/go/exercises/prime-factors/example.go +0 -2
  189. data/tracks/go/exercises/prime-factors/prime_factors_test.go +1 -9
  190. data/tracks/go/exercises/protein-translation/example.go +0 -2
  191. data/tracks/go/exercises/protein-translation/protein_translation_test.go +0 -8
  192. data/tracks/go/exercises/pythagorean-triplet/example.go +0 -2
  193. data/tracks/go/exercises/pythagorean-triplet/pythagorean_triplet_test.go +0 -8
  194. data/tracks/go/exercises/queen-attack/example.go +0 -2
  195. data/tracks/go/exercises/queen-attack/queen_attack_test.go +0 -8
  196. data/tracks/go/exercises/raindrops/.meta/hints.md +7 -0
  197. data/tracks/go/exercises/raindrops/cases_test.go +2 -2
  198. data/tracks/go/exercises/raindrops/example.go +0 -2
  199. data/tracks/go/exercises/raindrops/raindrops_test.go +0 -8
  200. data/tracks/go/exercises/react/example.go +0 -2
  201. data/tracks/go/exercises/react/react_test.go +0 -11
  202. data/tracks/go/exercises/rna-transcription/cases_test.go +2 -2
  203. data/tracks/go/exercises/rna-transcription/example.go +0 -2
  204. data/tracks/go/exercises/rna-transcription/rna_transcription.go +6 -0
  205. data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +0 -8
  206. data/tracks/go/exercises/robot-name/example.go +0 -2
  207. data/tracks/go/exercises/robot-name/robot_name_test.go +0 -8
  208. data/tracks/go/exercises/robot-simulator/example.go +0 -1
  209. data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +0 -8
  210. data/tracks/go/exercises/roman-numerals/cases_test.go +2 -2
  211. data/tracks/go/exercises/roman-numerals/example.go +0 -2
  212. data/tracks/go/exercises/roman-numerals/roman_numerals_test.go +0 -8
  213. data/tracks/go/exercises/rotational-cipher/README.md +56 -0
  214. data/tracks/go/exercises/rotational-cipher/example.go +20 -0
  215. data/tracks/go/exercises/rotational-cipher/rotational_cipher_test.go +86 -0
  216. data/tracks/go/exercises/run-length-encoding/README.md +31 -0
  217. data/tracks/go/exercises/run-length-encoding/example.go +53 -0
  218. data/tracks/go/exercises/run-length-encoding/run_length_encoding_test.go +59 -0
  219. data/tracks/go/exercises/saddle-points/example.go +0 -2
  220. data/tracks/go/exercises/saddle-points/saddle_points_test.go +0 -8
  221. data/tracks/go/exercises/say/.meta/gen.go +70 -0
  222. data/tracks/go/exercises/say/cases_test.go +88 -0
  223. data/tracks/go/exercises/say/example.go +12 -6
  224. data/tracks/go/exercises/say/say_test.go +17 -43
  225. data/tracks/go/exercises/scrabble-score/cases_test.go +2 -2
  226. data/tracks/go/exercises/scrabble-score/example.go +0 -3
  227. data/tracks/go/exercises/scrabble-score/scrabble_score_test.go +0 -8
  228. data/tracks/go/exercises/secret-handshake/cases_test.go +2 -2
  229. data/tracks/go/exercises/secret-handshake/example.go +0 -2
  230. data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +0 -8
  231. data/tracks/go/exercises/series/example.go +0 -2
  232. data/tracks/go/exercises/series/series_test.go +0 -8
  233. data/tracks/go/exercises/sieve/example.go +0 -2
  234. data/tracks/go/exercises/sieve/sieve_test.go +0 -8
  235. data/tracks/go/exercises/simple-cipher/example.go +0 -2
  236. data/tracks/go/exercises/simple-cipher/simple_cipher_test.go +0 -8
  237. data/tracks/go/exercises/space-age/.meta/gen.go +56 -0
  238. data/tracks/go/exercises/space-age/README.md +42 -0
  239. data/tracks/go/exercises/space-age/cases_test.go +61 -0
  240. data/tracks/go/exercises/space-age/example.go +36 -0
  241. data/tracks/go/exercises/space-age/space_age_test.go +22 -0
  242. data/tracks/go/exercises/spiral-matrix/README.md +48 -0
  243. data/tracks/go/exercises/spiral-matrix/example.go +93 -0
  244. data/tracks/go/exercises/spiral-matrix/spiral_matrix_test.go +71 -0
  245. data/tracks/go/exercises/strain/example.go +0 -2
  246. data/tracks/go/exercises/strain/strain_test.go +0 -8
  247. data/tracks/go/exercises/sublist/.meta/gen.go +56 -0
  248. data/tracks/go/exercises/sublist/README.md +39 -0
  249. data/tracks/go/exercises/sublist/cases_test.go +115 -0
  250. data/tracks/go/exercises/sublist/example.go +49 -0
  251. data/tracks/go/exercises/sublist/sublist_test.go +22 -0
  252. data/tracks/go/exercises/sum-of-multiples/cases_test.go +4 -3
  253. data/tracks/go/exercises/sum-of-multiples/example.go +0 -2
  254. data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +0 -8
  255. data/tracks/go/exercises/tournament/example.go +0 -2
  256. data/tracks/go/exercises/tournament/tournament_test.go +0 -11
  257. data/tracks/go/exercises/transpose/cases_test.go +2 -2
  258. data/tracks/go/exercises/transpose/example.go +0 -2
  259. data/tracks/go/exercises/transpose/transpose_test.go +0 -8
  260. data/tracks/go/exercises/tree-building/example.go +0 -2
  261. data/tracks/go/exercises/tree-building/tree_building.go +0 -2
  262. data/tracks/go/exercises/tree-building/tree_test.go +0 -11
  263. data/tracks/go/exercises/triangle/.meta/hints.md +10 -0
  264. data/tracks/go/exercises/triangle/example.go +0 -2
  265. data/tracks/go/exercises/triangle/triangle.go +21 -9
  266. data/tracks/go/exercises/triangle/triangle_test.go +0 -8
  267. data/tracks/go/exercises/trinary/example.go +0 -2
  268. data/tracks/go/exercises/trinary/trinary_test.go +0 -8
  269. data/tracks/go/exercises/twelve-days/example.go +0 -2
  270. data/tracks/go/exercises/twelve-days/twelve_days_test.go +0 -8
  271. data/tracks/go/exercises/two-fer/two_fer.go +2 -2
  272. data/tracks/go/exercises/variable-length-quantity/cases_test.go +2 -2
  273. data/tracks/go/exercises/variable-length-quantity/example.go +0 -2
  274. data/tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go +0 -8
  275. data/tracks/go/exercises/word-count/cases_test.go +2 -2
  276. data/tracks/go/exercises/word-count/example.go +0 -2
  277. data/tracks/go/exercises/word-count/word_count_test.go +4 -7
  278. data/tracks/go/exercises/word-search/.meta/gen.go +96 -0
  279. data/tracks/go/exercises/word-search/cases_test.go +154 -0
  280. data/tracks/go/exercises/word-search/example.go +0 -2
  281. data/tracks/go/exercises/word-search/word_search_test.go +16 -52
  282. data/tracks/go/exercises/wordy/example.go +0 -2
  283. data/tracks/go/exercises/wordy/wordy_test.go +0 -8
  284. data/tracks/go/gen/gen.go +4 -1
  285. data/tracks/java/exercises/phone-number/README.md +1 -1
  286. data/tracks/kotlin/exercises/phone-number/README.md +1 -1
  287. data/tracks/perl6/config.json +50 -0
  288. data/tracks/perl6/exercises/etl/ETL.pm6 +6 -0
  289. data/tracks/perl6/exercises/etl/Example.pm6 +7 -0
  290. data/tracks/perl6/exercises/etl/README.md +72 -0
  291. data/tracks/perl6/exercises/etl/etl.t +139 -0
  292. data/tracks/perl6/exercises/etl/example.yaml +35 -0
  293. data/tracks/perl6/exercises/hamming/Example.pm6 +6 -0
  294. data/tracks/perl6/exercises/hamming/Hamming.pm6 +4 -0
  295. data/tracks/perl6/exercises/hamming/README.md +61 -0
  296. data/tracks/perl6/exercises/hamming/example.yaml +22 -0
  297. data/tracks/perl6/exercises/hamming/hamming.t +175 -0
  298. data/tracks/perl6/exercises/meetup/Example.pm6 +37 -0
  299. data/tracks/perl6/exercises/meetup/Meetup.pm6 +4 -0
  300. data/tracks/perl6/exercises/meetup/README.md +48 -0
  301. data/tracks/perl6/exercises/meetup/example.yaml +48 -0
  302. data/tracks/perl6/exercises/meetup/meetup.t +907 -0
  303. data/tracks/perl6/exercises/pangram/Example.pm6 +5 -0
  304. data/tracks/perl6/exercises/pangram/Pangram.pm6 +4 -0
  305. data/tracks/perl6/exercises/pangram/README.md +34 -0
  306. data/tracks/perl6/exercises/pangram/example.yaml +17 -0
  307. data/tracks/perl6/exercises/pangram/pangram.t +125 -0
  308. data/tracks/perl6/exercises/phone-number/README.md +1 -1
  309. data/tracks/perl6/exercises/two-fer/Example.pm6 +14 -0
  310. data/tracks/perl6/exercises/two-fer/README.md +38 -0
  311. data/tracks/perl6/exercises/two-fer/TwoFer.pm6 +15 -0
  312. data/tracks/perl6/exercises/two-fer/example.yaml +43 -0
  313. data/tracks/perl6/exercises/two-fer/two-fer.t +82 -0
  314. data/tracks/php/config.json +13 -0
  315. data/tracks/php/exercises/rail-fence-cipher/README.md +80 -0
  316. data/tracks/php/exercises/rail-fence-cipher/example.php +61 -0
  317. data/tracks/php/exercises/rail-fence-cipher/rail-fence-cipher_test.php +76 -0
  318. data/tracks/purescript/.travis.yml +1 -1
  319. data/tracks/python/config.json +13 -0
  320. data/tracks/python/exercises/alphametics/example.py +42 -29
  321. data/tracks/python/exercises/crypto-square/crypto_square_test.py +20 -13
  322. data/tracks/python/exercises/crypto-square/example.py +1 -1
  323. data/tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py +15 -2
  324. data/tracks/python/exercises/phone-number/README.md +2 -1
  325. data/tracks/python/exercises/pov/README.md +53 -0
  326. data/tracks/python/exercises/pov/example.py +70 -0
  327. data/tracks/python/exercises/pov/pov.py +25 -0
  328. data/tracks/python/exercises/pov/pov_test.py +200 -0
  329. data/tracks/python/test/check-exercises.py +11 -1
  330. data/tracks/ruby/exercises/meetup/.meta/.version +1 -0
  331. data/tracks/ruby/exercises/meetup/.meta/generator/meetup_case.rb +11 -0
  332. data/tracks/ruby/exercises/meetup/.meta/solutions/meetup.rb +5 -0
  333. data/tracks/ruby/exercises/meetup/meetup_test.rb +48 -4
  334. metadata +90 -8
  335. data/tracks/go/exercises/accumulate/accumulate.go +0 -5
  336. data/tracks/go/exercises/clock/clock.go +0 -19
  337. data/tracks/go/exercises/pangram/pangram.go +0 -5
  338. data/tracks/go/exercises/raindrops/raindrops.go +0 -8
  339. data/tracks/go/exercises/twelve-days/HINTS.md +0 -2
  340. data/tracks/go/exercises/word-count/word_count.go +0 -9
@@ -14,7 +14,7 @@ The format is usually represented as
14
14
 
15
15
  where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
16
16
 
17
- Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present.
17
+ Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
18
18
 
19
19
  For example, the inputs
20
20
  - `+1 (613)-995-0253`
@@ -102,6 +102,16 @@
102
102
 
103
103
  ]
104
104
  },
105
+ {
106
+ "uuid": "97f3c252-09c1-b380-5f5f-45b6eebec416e2a0830",
107
+ "slug": "isogram",
108
+ "core": false,
109
+ "unlocked_by": null,
110
+ "difficulty": 2,
111
+ "topics": [
112
+
113
+ ]
114
+ },
105
115
  {
106
116
  "uuid": "d3cbfc9a-a495-4bf2-87d0-811d5f71fda6",
107
117
  "slug": "nucleotide-count",
@@ -0,0 +1,65 @@
1
+ # Isogram
2
+
3
+ Determine if a word or phrase is an isogram.
4
+
5
+ An isogram (also known as a "nonpattern word") is a word or phrase without a
6
+ repeating letter, however spaces and hyphens are allowed to appear multiple times.
7
+
8
+ Examples of isograms:
9
+
10
+ - lumberjacks
11
+ - background
12
+ - downstream
13
+ - six-year-old
14
+
15
+ The word *isograms*, however, is not an isogram, because the s repeats.
16
+
17
+ ## Source
18
+
19
+ Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram)
20
+
21
+ ## Running tests
22
+
23
+ In order to run the tests, issue the following command from the exercise
24
+ directory:
25
+
26
+ For running the tests provided, `rebar3` is used as it is the official build and
27
+ dependency management tool for erlang now. Please refer to [the tracks installation
28
+ instructions](http://exercism.io/languages/erlang/installation) on how to do that.
29
+
30
+ In order to run the tests, you can issue the following command from the exercise
31
+ directory.
32
+
33
+ ```bash
34
+ $ rebar3 eunit
35
+ ```
36
+
37
+ ### Test versioning
38
+
39
+ Each problem defines a macro `TEST_VERSION` in the test file and
40
+ verifies that the solution defines and exports a function `test_version`
41
+ returning that same value.
42
+
43
+ To make tests pass, add the following to your solution:
44
+
45
+ ```erlang
46
+ -export([test_version/0]).
47
+
48
+ test_version() ->
49
+ 1.
50
+ ```
51
+
52
+ The benefit of this is that reviewers can see against which test version
53
+ an iteration was written if, for example, a previously posted solution
54
+ does not solve the current problem or passes current tests.
55
+
56
+ ## Questions?
57
+
58
+ For detailed information about the Erlang track, please refer to the
59
+ [help page](http://exercism.io/languages/erlang) on the Exercism site.
60
+ This covers the basic information on setting up the development
61
+ environment expected by the exercises.
62
+
63
+ ## Submitting Incomplete Solutions
64
+
65
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,11 @@
1
+ -include_lib("eunit/include/eunit.hrl").
2
+
3
+ sut(Module) ->
4
+ {ok, Files} = file:list_dir("./src"),
5
+ case lists:member("example.erl", Files) of
6
+ true -> example;
7
+ false -> Module
8
+ end.
9
+
10
+ version_test() ->
11
+ ?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
@@ -0,0 +1,30 @@
1
+ %% Erlang compiler options
2
+ {erl_opts, [debug_info]}.
3
+
4
+ {deps, []}.
5
+
6
+ {dialyzer, [
7
+ {warnings, [underspecs, no_return]},
8
+ {get_warnings, true},
9
+ {plt_apps, top_level_deps}, % top_level_deps | all_deps
10
+ {plt_extra_apps, []},
11
+ {plt_location, local}, % local | "/my/file/name"
12
+ {plt_prefix, "rebar3"},
13
+ {base_plt_apps, [stdlib, kernel, crypto]},
14
+ {base_plt_location, global}, % global | "/my/file/name"
15
+ {base_plt_prefix, "rebar3"}
16
+ ]}.
17
+
18
+ %% eunit:test(Tests)
19
+ {eunit_tests, []}.
20
+ %% Options for eunit:test(Tests, Opts)
21
+ {eunit_opts, [verbose]}.
22
+
23
+ %% == xref ==
24
+
25
+ {xref_warnings, true}.
26
+
27
+ %% xref checks to run
28
+ {xref_checks, [undefined_function_calls, undefined_functions,
29
+ locals_not_used, exports_not_used,
30
+ deprecated_function_calls, deprecated_functions]}.
@@ -0,0 +1,16 @@
1
+ -module(example).
2
+
3
+ -export([is_isogram/1, test_version/0]).
4
+
5
+ is_isogram(String) ->
6
+ check_isogram([C || C <- string:to_lower(String), ($a =< C), (C =< $z)]).
7
+
8
+ check_isogram("") ->
9
+ true;
10
+ check_isogram([H|T]) ->
11
+ is_not_found_in(H, T) andalso check_isogram(T).
12
+
13
+ is_not_found_in(C, S) ->
14
+ lists:all(fun(X) -> X /= C end, S).
15
+
16
+ test_version() -> 1.
@@ -0,0 +1,9 @@
1
+ {application, isogram,
2
+ [{description, "exercism.io - isogram"},
3
+ {vsn, "0.0.1"},
4
+ {modules, []},
5
+ {registered, []},
6
+ {applications, [kernel,
7
+ stdlib]},
8
+ {env, []}
9
+ ]}.
@@ -0,0 +1,9 @@
1
+ -module(isogram).
2
+
3
+ -export([is_isogram/1, test_version/0]).
4
+
5
+ is_isogram(String) ->
6
+ undefined.
7
+
8
+ test_version() ->
9
+ 1.
@@ -0,0 +1,32 @@
1
+ -module(isogram_tests).
2
+
3
+ -define(TESTED_MODULE, (sut(isogram))).
4
+ -define(TEST_VERSION, 1).
5
+ -include("exercism.hrl").
6
+
7
+ empty_string_test() ->
8
+ ?assert(?TESTED_MODULE:is_isogram("")).
9
+
10
+ isogram_with_only_lower_case_characters_test() ->
11
+ ?assert(?TESTED_MODULE:is_isogram("isogram")).
12
+
13
+ word_with_one_duplicated_character_test() ->
14
+ ?assertNot(?TESTED_MODULE:is_isogram("eleven")).
15
+
16
+ longest_reported_english_isogram_test() ->
17
+ ?assert(?TESTED_MODULE:is_isogram("subdermatoglyphic")).
18
+
19
+ word_with_duplicated_character_in_mixed_case_test() ->
20
+ ?assertNot(?TESTED_MODULE:is_isogram("Alphabet")).
21
+
22
+ hypothetical_isogrammic_word_with_hyphen_test() ->
23
+ ?assert(?TESTED_MODULE:is_isogram("thumbscrew-japingly")).
24
+
25
+ isogram_with_duplicated_hyphen_test() ->
26
+ ?assert(?TESTED_MODULE:is_isogram("six-year-old")).
27
+
28
+ made_up_name_that_is_an_isogram_test() ->
29
+ ?assert(?TESTED_MODULE:is_isogram("Emily Jung Schwartzkopf")).
30
+
31
+ duplicated_character_in_the_middle_test() ->
32
+ ?assertNot(?TESTED_MODULE:is_isogram("accentor")).
@@ -1,3 +1,3 @@
1
1
  module BinarySearch
2
2
 
3
- let binarySearch input value = failwith "You need to implement this function."
3
+ let find input value = failwith "You need to implement this function."
@@ -1,51 +1,79 @@
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
1
3
  module BinarySearchTest
2
4
 
3
- open Xunit
4
5
  open FsUnit.Xunit
6
+ open Xunit
5
7
 
6
8
  open BinarySearch
7
9
 
8
10
  [<Fact>]
9
- let ``Should return None when an empty array is searched`` () =
10
- let input = [||]
11
- binarySearch input 6 |> should equal None
11
+ let ``Finds a value in an array with one element`` () =
12
+ let array = [|6|]
13
+ let value = 6
14
+ let expected = Some 0
15
+ find array value |> should equal expected
16
+
17
+ [<Fact(Skip = "Remove to run test")>]
18
+ let ``Finds a value in the middle of an array`` () =
19
+ let array = [|1; 3; 4; 6; 8; 9; 11|]
20
+ let value = 6
21
+ let expected = Some 3
22
+ find array value |> should equal expected
12
23
 
13
24
  [<Fact(Skip = "Remove to run test")>]
14
- let ``Should be able to find a value in a single element array with one access`` () =
15
- let input = [|6|]
16
- binarySearch input 6 |> should equal <| Some 0
17
-
25
+ let ``Finds a value at the beginning of an array`` () =
26
+ let array = [|1; 3; 4; 6; 8; 9; 11|]
27
+ let value = 1
28
+ let expected = Some 0
29
+ find array value |> should equal expected
30
+
18
31
  [<Fact(Skip = "Remove to run test")>]
19
- let ``Should return None if a value is less than the element in a single element array`` () =
20
- let input = [|94|]
21
- binarySearch input 6 |> should equal None
22
-
32
+ let ``Finds a value at the end of an array`` () =
33
+ let array = [|1; 3; 4; 6; 8; 9; 11|]
34
+ let value = 11
35
+ let expected = Some 6
36
+ find array value |> should equal expected
37
+
23
38
  [<Fact(Skip = "Remove to run test")>]
24
- let ``Should return None if a value is greater than the element in a single element array`` () =
25
- let input = [|94|]
26
- binarySearch input 602 |> should equal None
39
+ let ``Finds a value in an array of odd length`` () =
40
+ let array = [|1; 3; 5; 8; 13; 21; 34; 55; 89; 144; 233; 377; 634|]
41
+ let value = 144
42
+ let expected = Some 9
43
+ find array value |> should equal expected
27
44
 
28
45
  [<Fact(Skip = "Remove to run test")>]
29
- let ``Should find an element in a longer array`` () =
30
- let input = [|6; 67; 123; 345; 456; 457; 490; 2002; 54321; 54322|]
31
- binarySearch input 2002 |> should equal <| Some 7
46
+ let ``Finds a value in an array of even length`` () =
47
+ let array = [|1; 3; 5; 8; 13; 21; 34; 55; 89; 144; 233; 377|]
48
+ let value = 21
49
+ let expected = Some 5
50
+ find array value |> should equal expected
32
51
 
33
52
  [<Fact(Skip = "Remove to run test")>]
34
- let ``Should find elements at the beginning of an array`` () =
35
- let input = [|6; 67; 123; 345; 456; 457; 490; 2002; 54321; 54322|]
36
- binarySearch input 6 |> should equal <| Some 0
53
+ let ``Identifies that a value is not included in the array`` () =
54
+ let array = [|1; 3; 4; 6; 8; 9; 11|]
55
+ let value = 7
56
+ let expected = None
57
+ find array value |> should equal expected
37
58
 
38
59
  [<Fact(Skip = "Remove to run test")>]
39
- let ``Should find elements at the end of an array`` () =
40
- let input = [|6; 67; 123; 345; 456; 457; 490; 2002; 54321; 54322|]
41
- binarySearch input 54322 |> should equal <| Some 9
60
+ let ``A value smaller than the array's smallest value is not included`` () =
61
+ let array = [|1; 3; 4; 6; 8; 9; 11|]
62
+ let value = 0
63
+ let expected = None
64
+ find array value |> should equal expected
42
65
 
43
66
  [<Fact(Skip = "Remove to run test")>]
44
- let ``Should return None if a value is less than all elements in a long array`` () =
45
- let input = [|6; 67; 123; 345; 456; 457; 490; 2002; 54321; 54322|]
46
- binarySearch input 2 |> should equal None
67
+ let ``A value larger than the array's largest value is not included`` () =
68
+ let array = [|1; 3; 4; 6; 8; 9; 11|]
69
+ let value = 13
70
+ let expected = None
71
+ find array value |> should equal expected
47
72
 
48
73
  [<Fact(Skip = "Remove to run test")>]
49
- let ``Should return None if a value is greater than all elements in a long array`` () =
50
- let input = [|6; 67; 123; 345; 456; 457; 490; 2002; 54321; 54322|]
51
- binarySearch input 54323 |> should equal None
74
+ let ``Nothing is included in an empty array`` () =
75
+ let array = [||]
76
+ let value = 1
77
+ let expected = None
78
+ find array value |> should equal expected
79
+
@@ -12,6 +12,6 @@ let rec binarySearchAux index value =
12
12
  elif value > middleValue then binarySearchAux (index + middle + 1) value input.[middle + 1 ..]
13
13
  else Some (index + middle)
14
14
 
15
- let binarySearch input value =
15
+ let find input value =
16
16
  if Array.sort input <> input then failwith "The input must be an ordered lists"
17
17
  else binarySearchAux 0 value input
@@ -28,11 +28,11 @@ type PokerHand =
28
28
  | HighCard of Rank * Rank * Rank * Rank * Rank
29
29
  | OnePair of Rank * Rank * Rank * Rank
30
30
  | TwoPair of Rank * Rank * Rank
31
- | ThreeOfAKind of Rank
31
+ | ThreeOfAKind of Rank * Rank * Rank
32
32
  | Straight of Rank
33
33
  | Flush of Rank * Rank * Rank * Rank * Rank
34
34
  | FullHouse of Rank * Rank
35
- | FourOfAKind of Rank
35
+ | FourOfAKind of Rank * Rank
36
36
  | StraightFlush of Rank
37
37
 
38
38
  let tuple5ToList = function (one, two, three, four, five) -> [one; two; three; four; five]
@@ -74,23 +74,27 @@ let parseSuit =
74
74
 
75
75
  let parseRank =
76
76
  function
77
- | '2' -> Two
78
- | '3' -> Three
79
- | '4' -> Four
80
- | '5' -> Five
81
- | '6' -> Six
82
- | '7' -> Seven
83
- | '8' -> Eight
84
- | '9' -> Nine
85
- | 'T' -> Ten
86
- | 'J' -> Jack
87
- | 'Q' -> Queen
88
- | 'K' -> King
89
- | 'A' -> Ace
77
+ | "2" -> Two
78
+ | "3" -> Three
79
+ | "4" -> Four
80
+ | "5" -> Five
81
+ | "6" -> Six
82
+ | "7" -> Seven
83
+ | "8" -> Eight
84
+ | "9" -> Nine
85
+ | "10" -> Ten
86
+ | "J" -> Jack
87
+ | "Q" -> Queen
88
+ | "K" -> King
89
+ | "A" -> Ace
90
90
  | _ -> failwith "Invalid rank"
91
91
 
92
- let parseCard (input: string) = parseRank input.[0], parseSuit input.[1]
93
-
92
+ let parseCard (input: string) =
93
+ if input.Length = 2 then
94
+ parseRank input.[0..0], parseSuit input.[1]
95
+ else
96
+ parseRank input.[0..1], parseSuit input.[2]
97
+
94
98
  let parseHand (input: string) =
95
99
  input.Split(' ')
96
100
  |> List.ofArray
@@ -125,12 +129,12 @@ let (|StraightFlush|_|) hand =
125
129
 
126
130
  let (|FourOfAKind|_|) hand =
127
131
  match ranksWithCount hand with
128
- | (rank1, 4)::_ -> PokerHand.FourOfAKind rank1 |> Some
132
+ | (rank1, 4)::(rank2, 1)::[] -> PokerHand.FourOfAKind (rank1, rank2) |> Some
129
133
  | _ -> None
130
134
 
131
135
  let (|ThreeOfAKind|_|) hand =
132
136
  match ranksWithCount hand with
133
- | (rank1, 3)::_ -> PokerHand.ThreeOfAKind rank1 |> Some
137
+ | (rank1, 3)::(rank2, 1)::(rank3, 1)::[] -> PokerHand.ThreeOfAKind (rank1, rank2, rank3) |> Some
134
138
  | _ -> None
135
139
 
136
140
  let (|TwoPair|_|) hand =
@@ -166,7 +170,6 @@ let parsePokerHand (input: string) =
166
170
  let bestHands hands =
167
171
  let pokerHands = List.map (fun hand -> hand, parsePokerHand hand) hands
168
172
  let bestHand = pokerHands |> List.map snd |> List.max
169
-
170
173
  pokerHands
171
174
  |> List.filter (snd >> (=) bestHand)
172
175
  |> List.map fst
@@ -1,118 +1,177 @@
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
1
3
  module PokerTest
2
4
 
3
- open Xunit
4
5
  open FsUnit.Xunit
6
+ open Xunit
5
7
 
6
8
  open Poker
7
9
 
8
10
  [<Fact>]
9
- let ``One hand`` () =
10
- let hand = "4S 5S 7H 8D JC"
11
- bestHands [hand] |> should equal [hand]
11
+ let ``Single hand always wins`` () =
12
+ let input = ["4S 5S 7H 8D JC"]
13
+ let expected = ["4S 5S 7H 8D JC"]
14
+ bestHands input |> should equal expected
15
+
16
+ [<Fact(Skip = "Remove to run test")>]
17
+ let ``Highest card out of all hands wins`` () =
18
+ let input = ["4D 5S 6S 8D 3C"; "2S 4C 7S 9H 10H"; "3S 4S 5D 6H JH"]
19
+ let expected = ["3S 4S 5D 6H JH"]
20
+ bestHands input |> should equal expected
21
+
22
+ [<Fact(Skip = "Remove to run test")>]
23
+ let ``A tie has multiple winners`` () =
24
+ let input = ["4D 5S 6S 8D 3C"; "2S 4C 7S 9H 10H"; "3S 4S 5D 6H JH"; "3H 4H 5C 6C JD"]
25
+ let expected = ["3S 4S 5D 6H JH"; "3H 4H 5C 6C JD"]
26
+ bestHands input |> should equal expected
27
+
28
+ [<Fact(Skip = "Remove to run test")>]
29
+ let ``Multiple hands with the same high cards, tie compares next highest ranked, down to last card`` () =
30
+ let input = ["3S 5H 6S 8D 7H"; "2S 5D 6D 8C 7S"]
31
+ let expected = ["3S 5H 6S 8D 7H"]
32
+ bestHands input |> should equal expected
12
33
 
13
34
  [<Fact(Skip = "Remove to run test")>]
14
- let ``Nothing vs one pair`` () =
15
- let nothing = "4S 5H 6S 8D JH"
16
- let pairOf4 = "2S 4H 6S 4D JH"
17
- bestHands [nothing; pairOf4] |> should equal [pairOf4]
35
+ let ``One pair beats high card`` () =
36
+ let input = ["4S 5H 6C 8D KH"; "2S 4H 6S 4D JH"]
37
+ let expected = ["2S 4H 6S 4D JH"]
38
+ bestHands input |> should equal expected
18
39
 
19
40
  [<Fact(Skip = "Remove to run test")>]
20
- let ``Two pairs`` () =
21
- let pairOf2 = "4S 2H 6S 2D JH"
22
- let pairOf4 = "2S 4H 6S 4D JH"
23
- bestHands [pairOf2; pairOf4] |> should equal [pairOf4]
41
+ let ``Highest pair wins`` () =
42
+ let input = ["4S 2H 6S 2D JH"; "2S 4H 6C 4D JD"]
43
+ let expected = ["2S 4H 6C 4D JD"]
44
+ bestHands input |> should equal expected
24
45
 
25
46
  [<Fact(Skip = "Remove to run test")>]
26
- let ``One pair vs double pair`` () =
27
- let pairOf8 = "2S 8H 6S 8D JH"
28
- let doublePair = "4S 5H 4S 8D 5H"
29
- bestHands [pairOf8; doublePair] |> should equal [doublePair]
47
+ let ``Two pairs beats one pair`` () =
48
+ let input = ["2S 8H 6S 8D JH"; "4S 5H 4C 8C 5C"]
49
+ let expected = ["4S 5H 4C 8C 5C"]
50
+ bestHands input |> should equal expected
30
51
 
31
52
  [<Fact(Skip = "Remove to run test")>]
32
- let ``Two double pairs`` () =
33
- let doublePair2and8 = "2S 8H 2S 8D JH"
34
- let doublePair4and5 = "4S 5H 4S 8D 5H"
35
- bestHands [doublePair2and8; doublePair4and5] |> should equal [doublePair2and8]
53
+ let ``Both hands have two pairs, highest ranked pair wins`` () =
54
+ let input = ["2S 8H 2D 8D 3H"; "4S 5H 4C 8S 5D"]
55
+ let expected = ["2S 8H 2D 8D 3H"]
56
+ bestHands input |> should equal expected
36
57
 
37
58
  [<Fact(Skip = "Remove to run test")>]
38
- let ``Double pair vs three`` () =
39
- let doublePair2and8 = "2S 8H 2S 8D JH"
40
- let threeOf4 = "4S 5H 4S 8D 4H"
41
- bestHands [doublePair2and8; threeOf4] |> should equal [threeOf4]
59
+ let ``Both hands have two pairs, with the same highest ranked pair, tie goes to low pair`` () =
60
+ let input = ["2S QS 2C QD JH"; "JD QH JS 8D QC"]
61
+ let expected = ["JD QH JS 8D QC"]
62
+ bestHands input |> should equal expected
42
63
 
43
64
  [<Fact(Skip = "Remove to run test")>]
44
- let ``Two threes`` () =
45
- let threeOf2 = "2S 2H 2S 8D JH"
46
- let threeOf1 = "4S AH AS 8D AH"
47
- bestHands [threeOf2; threeOf1] |> should equal [threeOf1]
65
+ let ``Both hands have two identically ranked pairs, tie goes to remaining card (kicker)`` () =
66
+ let input = ["JD QH JS 8D QC"; "JS QS JC 2D QD"]
67
+ let expected = ["JD QH JS 8D QC"]
68
+ bestHands input |> should equal expected
48
69
 
49
70
  [<Fact(Skip = "Remove to run test")>]
50
- let ``Three vs straight`` () =
51
- let threeOf4 = "4S 5H 4S 8D 4H"
52
- let straight = "3S 4H 2S 6D 5H"
53
- bestHands [threeOf4; straight] |> should equal [straight]
71
+ let ``Three of a kind beats two pair`` () =
72
+ let input = ["2S 8H 2H 8D JH"; "4S 5H 4C 8S 4H"]
73
+ let expected = ["4S 5H 4C 8S 4H"]
74
+ bestHands input |> should equal expected
54
75
 
55
76
  [<Fact(Skip = "Remove to run test")>]
56
- let ``Two straights`` () =
57
- let straightTo8 = "4S 6H 7S 8D 5H"
58
- let straightTo9 = "5S 7H 8S 9D 6H"
59
- bestHands [straightTo8; straightTo9] |> should equal [straightTo9]
77
+ let ``Both hands have three of a kind, tie goes to highest ranked triplet`` () =
78
+ let input = ["2S 2H 2C 8D JH"; "4S AH AS 8C AD"]
79
+ let expected = ["4S AH AS 8C AD"]
80
+ bestHands input |> should equal expected
60
81
 
61
- let straightTo1 = "AS QH KS TD JH"
62
- let straightTo5 = "4S AH 3S 2D 5H"
63
- bestHands [straightTo1; straightTo5] |> should equal [straightTo1]
82
+ [<Fact(Skip = "Remove to run test")>]
83
+ let ``With multiple decks, two players can have same three of a kind, ties go to highest remaining cards`` () =
84
+ let input = ["4S AH AS 7C AD"; "4S AH AS 8C AD"]
85
+ let expected = ["4S AH AS 8C AD"]
86
+ bestHands input |> should equal expected
87
+
88
+ [<Fact(Skip = "Remove to run test")>]
89
+ let ``A straight beats three of a kind`` () =
90
+ let input = ["4S 5H 4C 8D 4H"; "3S 4D 2S 6D 5C"]
91
+ let expected = ["3S 4D 2S 6D 5C"]
92
+ bestHands input |> should equal expected
64
93
 
65
94
  [<Fact(Skip = "Remove to run test")>]
66
- let ``Straight vs flush`` () =
67
- let straightTo8 = "4S 6H 7S 8D 5H"
68
- let flushTo7 = "2S 4S 5S 6S 7S"
69
- bestHands [straightTo8; flushTo7] |> should equal [flushTo7]
95
+ let ``Aces can end a straight (10 J Q K A)`` () =
96
+ let input = ["4S 5H 4C 8D 4H"; "10D JH QS KD AC"]
97
+ let expected = ["10D JH QS KD AC"]
98
+ bestHands input |> should equal expected
70
99
 
71
100
  [<Fact(Skip = "Remove to run test")>]
72
- let ``Two flushes`` () =
73
- let flushTo8 = "3H 6H 7H 8H 5H"
74
- let flushTo7 = "2S 4S 5S 6S 7S"
75
- bestHands [flushTo8; flushTo7] |> should equal [flushTo8]
101
+ let ``Aces can start a straight (A 2 3 4 5)`` () =
102
+ let input = ["4S 5H 4C 8D 4H"; "4D AH 3S 2D 5C"]
103
+ let expected = ["4D AH 3S 2D 5C"]
104
+ bestHands input |> should equal expected
76
105
 
77
106
  [<Fact(Skip = "Remove to run test")>]
78
- let ``Flush vs full`` () =
79
- let flushTo8 = "3H 6H 7H 8H 5H"
80
- let full = "4S 5H 4S 5D 4H"
81
- bestHands [full; flushTo8] |> should equal [full]
107
+ let ``Both hands with a straight, tie goes to highest ranked card`` () =
108
+ let input = ["4S 6C 7S 8D 5H"; "5S 7H 8S 9D 6H"]
109
+ let expected = ["5S 7H 8S 9D 6H"]
110
+ bestHands input |> should equal expected
82
111
 
83
112
  [<Fact(Skip = "Remove to run test")>]
84
- let ``Two fulls`` () =
85
- let fullOf4by9 = "4H 4S 4D 9S 9D"
86
- let fullOf5by8 = "5H 5S 5D 8S 8D"
87
- bestHands [fullOf4by9; fullOf5by8] |> should equal [fullOf5by8]
113
+ let ``Even though an ace is usually high, a 5-high straight is the lowest-scoring straight`` () =
114
+ let input = ["2H 3C 4D 5D 6H"; "4S AH 3S 2D 5H"]
115
+ let expected = ["2H 3C 4D 5D 6H"]
116
+ bestHands input |> should equal expected
88
117
 
89
118
  [<Fact(Skip = "Remove to run test")>]
90
- let ``Full vs square`` () =
91
- let full = "4S 5H 4S 5D 4H"
92
- let squareOf3 = "3S 3H 2S 3D 3H"
93
- bestHands [full; squareOf3] |> should equal [squareOf3]
119
+ let ``Flush beats a straight`` () =
120
+ let input = ["4C 6H 7D 8D 5H"; "2S 4S 5S 6S 7S"]
121
+ let expected = ["2S 4S 5S 6S 7S"]
122
+ bestHands input |> should equal expected
94
123
 
95
124
  [<Fact(Skip = "Remove to run test")>]
96
- let ``Two squares`` () =
97
- let squareOf2 = "2S 2H 2S 8D 2H"
98
- let squareOf5 = "4S 5H 5S 5D 5H"
99
- bestHands [squareOf2; squareOf5] |> should equal [squareOf5]
125
+ let ``Both hands have a flush, tie goes to high card, down to the last one if necessary`` () =
126
+ let input = ["4H 7H 8H 9H 6H"; "2S 4S 5S 6S 7S"]
127
+ let expected = ["4H 7H 8H 9H 6H"]
128
+ bestHands input |> should equal expected
100
129
 
101
130
  [<Fact(Skip = "Remove to run test")>]
102
- let ``Square vs straight flush`` () =
103
- let squareOf5 = "4S 5H 5S 5D 5H"
104
- let straightFlushTo9 = "5S 7S 8S 9S 6S"
105
- bestHands [squareOf5; straightFlushTo9] |> should equal [straightFlushTo9]
131
+ let ``Full house beats a flush`` () =
132
+ let input = ["3H 6H 7H 8H 5H"; "4S 5H 4C 5D 4H"]
133
+ let expected = ["4S 5H 4C 5D 4H"]
134
+ bestHands input |> should equal expected
106
135
 
107
136
  [<Fact(Skip = "Remove to run test")>]
108
- let ``Two straight flushes`` () =
109
- let straightFlushTo8 = "4H 6H 7H 8H 5H"
110
- let straightFlushTo9 = "5S 7S 8S 9S 6S"
111
- bestHands [straightFlushTo8; straightFlushTo9] |> should equal [straightFlushTo9]
137
+ let ``Both hands have a full house, tie goes to highest-ranked triplet`` () =
138
+ let input = ["4H 4S 4D 9S 9D"; "5H 5S 5D 8S 8D"]
139
+ let expected = ["5H 5S 5D 8S 8D"]
140
+ bestHands input |> should equal expected
112
141
 
113
142
  [<Fact(Skip = "Remove to run test")>]
114
- let ``Three hand with tie`` () =
115
- let spadeStraightTo9 = "9S 8S 7S 6S 5S"
116
- let diamondStraightTo9 = "9D 8D 7D 6D 5D"
117
- let threeOf4 = "4D 4S 4H QS KS"
118
- bestHands [spadeStraightTo9; diamondStraightTo9; threeOf4] |> should equal [spadeStraightTo9; diamondStraightTo9]
143
+ let ``With multiple decks, both hands have a full house with the same triplet, tie goes to the pair`` () =
144
+ let input = ["5H 5S 5D 9S 9D"; "5H 5S 5D 8S 8D"]
145
+ let expected = ["5H 5S 5D 9S 9D"]
146
+ bestHands input |> should equal expected
147
+
148
+ [<Fact(Skip = "Remove to run test")>]
149
+ let ``Four of a kind beats a full house`` () =
150
+ let input = ["4S 5H 4D 5D 4H"; "3S 3H 2S 3D 3C"]
151
+ let expected = ["3S 3H 2S 3D 3C"]
152
+ bestHands input |> should equal expected
153
+
154
+ [<Fact(Skip = "Remove to run test")>]
155
+ let ``Both hands have four of a kind, tie goes to high quad`` () =
156
+ let input = ["2S 2H 2C 8D 2D"; "4S 5H 5S 5D 5C"]
157
+ let expected = ["4S 5H 5S 5D 5C"]
158
+ bestHands input |> should equal expected
159
+
160
+ [<Fact(Skip = "Remove to run test")>]
161
+ let ``With multiple decks, both hands with identical four of a kind, tie determined by kicker`` () =
162
+ let input = ["3S 3H 2S 3D 3C"; "3S 3H 4S 3D 3C"]
163
+ let expected = ["3S 3H 4S 3D 3C"]
164
+ bestHands input |> should equal expected
165
+
166
+ [<Fact(Skip = "Remove to run test")>]
167
+ let ``Straight flush beats four of a kind`` () =
168
+ let input = ["4S 5H 5S 5D 5C"; "7S 8S 9S 6S 10S"]
169
+ let expected = ["7S 8S 9S 6S 10S"]
170
+ bestHands input |> should equal expected
171
+
172
+ [<Fact(Skip = "Remove to run test")>]
173
+ let ``Both hands have straight flush, tie goes to highest-ranked card`` () =
174
+ let input = ["4H 6H 7H 8H 5H"; "5S 7S 8S 9S 6S"]
175
+ let expected = ["5S 7S 8S 9S 6S"]
176
+ bestHands input |> should equal expected
177
+