trackler 2.2.1.116 → 2.2.1.117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/config.json +25 -0
- data/tracks/c/exercises/acronym/makefile +1 -1
- data/tracks/c/exercises/all-your-base/makefile +1 -1
- data/tracks/c/exercises/allergies/makefile +1 -1
- data/tracks/c/exercises/anagram/makefile +1 -1
- data/tracks/c/exercises/atbash-cipher/makefile +1 -1
- data/tracks/c/exercises/beer-song/makefile +1 -1
- data/tracks/c/exercises/binary-search-tree/README.md +53 -0
- data/tracks/c/exercises/binary-search-tree/makefile +25 -0
- data/tracks/c/exercises/binary-search-tree/src/example.c +102 -0
- data/tracks/c/exercises/binary-search-tree/src/example.h +16 -0
- data/tracks/c/exercises/binary-search-tree/test/test_binary_search_tree.c +217 -0
- data/tracks/c/exercises/binary-search-tree/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/binary-search-tree/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/binary-search-tree/test/vendor/unity_internals.h +701 -0
- data/tracks/c/exercises/binary-search/makefile +1 -1
- data/tracks/c/exercises/binary/makefile +1 -1
- data/tracks/c/exercises/bob/makefile +1 -1
- data/tracks/c/exercises/bracket-push/makefile +1 -1
- data/tracks/c/exercises/clock/makefile +1 -1
- data/tracks/c/exercises/collatz-conjecture/makefile +1 -1
- data/tracks/c/exercises/complex-numbers/makefile +1 -1
- data/tracks/c/exercises/crypto-square/makefile +1 -1
- data/tracks/c/exercises/diamond/README.md +52 -0
- data/tracks/c/exercises/diamond/makefile +25 -0
- data/tracks/c/exercises/diamond/src/example.c +47 -0
- data/tracks/c/exercises/diamond/src/example.h +6 -0
- data/tracks/c/exercises/diamond/test/test_diamond.c +158 -0
- data/tracks/c/exercises/diamond/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/diamond/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/diamond/test/vendor/unity_internals.h +701 -0
- data/tracks/c/exercises/difference-of-squares/makefile +1 -1
- data/tracks/c/exercises/etl/makefile +1 -1
- data/tracks/c/exercises/gigasecond/makefile +1 -1
- data/tracks/c/exercises/grains/makefile +1 -1
- data/tracks/c/exercises/hamming/makefile +1 -1
- data/tracks/c/exercises/hello-world/makefile +1 -1
- data/tracks/c/exercises/isogram/makefile +1 -1
- data/tracks/c/exercises/largest-series-product/makefile +1 -1
- data/tracks/c/exercises/leap/makefile +1 -1
- data/tracks/c/exercises/luhn/makefile +1 -1
- data/tracks/c/exercises/meetup/makefile +1 -1
- data/tracks/c/exercises/minesweeper/makefile +1 -1
- data/tracks/c/exercises/nth-prime/makefile +1 -1
- data/tracks/c/exercises/nucleotide-count/makefile +1 -1
- data/tracks/c/exercises/palindrome-products/makefile +1 -1
- data/tracks/c/exercises/pangram/makefile +1 -1
- data/tracks/c/exercises/pascals-triangle/makefile +1 -1
- data/tracks/c/exercises/perfect-numbers/makefile +1 -1
- data/tracks/c/exercises/phone-number/makefile +1 -1
- data/tracks/c/exercises/pig-latin/makefile +1 -1
- data/tracks/c/exercises/prime-factors/makefile +1 -1
- data/tracks/c/exercises/queen-attack/makefile +1 -1
- data/tracks/c/exercises/raindrops/makefile +1 -1
- data/tracks/c/exercises/react/makefile +1 -1
- data/tracks/c/exercises/rna-transcription/makefile +1 -1
- data/tracks/c/exercises/robot-simulator/makefile +1 -1
- data/tracks/c/exercises/roman-numerals/makefile +1 -1
- data/tracks/c/exercises/run-length-encoding/makefile +1 -1
- data/tracks/c/exercises/say/makefile +1 -1
- data/tracks/c/exercises/scrabble-score/makefile +1 -1
- data/tracks/c/exercises/secret-handshake/makefile +1 -1
- data/tracks/c/exercises/series/makefile +1 -1
- data/tracks/c/exercises/sieve/makefile +1 -1
- data/tracks/c/exercises/space-age/makefile +1 -1
- data/tracks/c/exercises/sublist/makefile +1 -1
- data/tracks/c/exercises/sum-of-multiples/makefile +1 -1
- data/tracks/c/exercises/triangle/makefile +1 -1
- data/tracks/c/exercises/two-fer/makefile +1 -1
- data/tracks/c/exercises/word-count/makefile +1 -1
- data/tracks/c/exercises/wordy/makefile +1 -1
- data/tracks/ceylon/.travis.yml +9 -0
- data/tracks/ceylon/README.md +5 -6
- data/tracks/ceylon/exercises/anagram/example/Anagram.ceylon +6 -6
- data/tracks/ceylon/exercises/anagram/source/anagram/Anagram.ceylon +1 -1
- data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +34 -31
- data/tracks/ceylon/exercises/anagram/source/anagram/module.ceylon +1 -1
- data/tracks/ceylon/exercises/bracket-push/example/Brackets.ceylon +14 -12
- data/tracks/ceylon/exercises/bracket-push/example/module.ceylon +2 -2
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/Brackets.ceylon +1 -1
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +34 -31
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/module.ceylon +1 -1
- data/tracks/ceylon/exercises/hamming/example/Hamming.ceylon +4 -4
- data/tracks/ceylon/exercises/hamming/source/hamming/Hamming.ceylon +1 -1
- data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +41 -38
- data/tracks/ceylon/exercises/hamming/source/hamming/module.ceylon +1 -1
- data/tracks/ceylon/exercises/largest-series-product/example/Series.ceylon +9 -9
- data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/Series.ceylon +1 -1
- data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon +41 -38
- data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/module.ceylon +1 -1
- data/tracks/ceylon/exercises/leap/example/Leap.ceylon +1 -1
- data/tracks/ceylon/exercises/leap/source/leap/Leap.ceylon +1 -1
- data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +7 -4
- data/tracks/ceylon/exercises/leap/source/leap/module.ceylon +1 -1
- data/tracks/ceylon/exercises/react/example/Reactor.ceylon +90 -87
- data/tracks/ceylon/exercises/react/example/module.ceylon +2 -2
- data/tracks/ceylon/exercises/react/source/react/Reactor.ceylon +24 -24
- data/tracks/ceylon/exercises/react/source/react/ReactorTest.ceylon +159 -138
- data/tracks/ceylon/exercises/react/source/react/module.ceylon +1 -1
- data/tracks/ceylon/exercises/rna-transcription/example/RNA.ceylon +11 -9
- data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNA.ceylon +1 -1
- data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon +28 -25
- data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/module.ceylon +1 -1
- data/tracks/ceylon/exercises/sieve/example/Sieve.ceylon +21 -19
- data/tracks/ceylon/exercises/sieve/example/module.ceylon +2 -2
- data/tracks/ceylon/exercises/sieve/source/sieve/Sieve.ceylon +1 -1
- data/tracks/ceylon/exercises/sieve/source/sieve/SieveTest.ceylon +18 -15
- data/tracks/ceylon/exercises/sieve/source/sieve/module.ceylon +1 -1
- data/tracks/csharp/exercises/clock/README.md +0 -6
- data/tracks/fsharp/config.json +2 -2
- data/tracks/go/config.json +27 -12
- data/tracks/go/exercises/all-your-base/cases_test.go +3 -3
- data/tracks/go/exercises/dominoes/.meta/gen.go +6 -6
- data/tracks/go/exercises/dominoes/.meta/hints.md +5 -5
- data/tracks/go/exercises/dominoes/README.md +5 -5
- data/tracks/go/exercises/dominoes/cases_test.go +13 -13
- data/tracks/go/exercises/dominoes/dominoes_test.go +5 -5
- data/tracks/go/exercises/dominoes/example.go +25 -25
- data/tracks/go/exercises/pig-latin/README.md +4 -4
- data/tracks/go/exercises/rectangles/README.md +0 -1
- data/tracks/go/exercises/two-bucket/README.md +1 -1
- data/tracks/go/exercises/word-count/cases_test.go +2 -2
- data/tracks/go/exercises/yacht/.meta/description.md +34 -0
- data/tracks/go/exercises/yacht/.meta/gen.go +58 -0
- data/tracks/go/exercises/yacht/.meta/metadata.yml +5 -0
- data/tracks/go/exercises/yacht/README.md +61 -0
- data/tracks/go/exercises/yacht/cases_test.go +169 -0
- data/tracks/go/exercises/yacht/example.go +74 -0
- data/tracks/go/exercises/yacht/yacht_test.go +25 -0
- data/tracks/haskell/config.json +10 -0
- data/tracks/haskell/exercises/go-counting/README.md +2 -0
- data/tracks/haskell/exercises/go-counting/package.yaml +1 -1
- data/tracks/haskell/exercises/go-counting/test/Tests.hs +15 -19
- data/tracks/haskell/exercises/poker/README.md +66 -0
- data/tracks/haskell/exercises/poker/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/poker/examples/success-standard/src/Poker.hs +49 -0
- data/tracks/haskell/exercises/poker/package.yaml +20 -0
- data/tracks/haskell/exercises/poker/src/Poker.hs +4 -0
- data/tracks/haskell/exercises/poker/stack.yaml +1 -0
- data/tracks/haskell/exercises/poker/test/Tests.hs +174 -0
- data/tracks/java/exercises/clock/.meta/version +1 -1
- data/tracks/java/exercises/complex-numbers/.meta/version +1 -1
- data/tracks/java/exercises/complex-numbers/src/test/java/ComplexNumberTest.java +56 -48
- data/tracks/java/exercises/crypto-square/.meta/version +1 -1
- data/tracks/java/exercises/markdown/.meta/version +1 -1
- data/tracks/javascript/.eslintignore +0 -2
- data/tracks/javascript/exercises/linked-list/example.js +6 -6
- data/tracks/javascript/exercises/saddle-points/example.js +32 -53
- data/tracks/lua/README.md +1 -1
- data/tracks/lua/bin/test-all +1 -1
- data/tracks/lua/config/exercise_readme.go.tmpl +1 -1
- data/tracks/lua/docs/INSTALLATION.md +3 -3
- data/tracks/lua/docs/TESTS.md +1 -1
- data/tracks/lua/exercises/accumulate/.busted +5 -0
- data/tracks/lua/exercises/accumulate/README.md +1 -1
- data/tracks/lua/exercises/acronym/.busted +5 -0
- data/tracks/lua/exercises/acronym/README.md +1 -1
- data/tracks/lua/exercises/all-your-base/.busted +5 -0
- data/tracks/lua/exercises/all-your-base/README.md +1 -1
- data/tracks/lua/exercises/allergies/.busted +5 -0
- data/tracks/lua/exercises/allergies/README.md +1 -1
- data/tracks/lua/exercises/alphametics/.busted +5 -0
- data/tracks/lua/exercises/alphametics/README.md +1 -1
- data/tracks/lua/exercises/anagram/.busted +5 -0
- data/tracks/lua/exercises/anagram/README.md +1 -1
- data/tracks/lua/exercises/atbash-cipher/.busted +5 -0
- data/tracks/lua/exercises/atbash-cipher/README.md +1 -1
- data/tracks/lua/exercises/bank-account/.busted +5 -0
- data/tracks/lua/exercises/bank-account/README.md +1 -1
- data/tracks/lua/exercises/beer-song/.busted +5 -0
- data/tracks/lua/exercises/beer-song/README.md +1 -1
- data/tracks/lua/exercises/binary-search-tree/.busted +5 -0
- data/tracks/lua/exercises/binary-search-tree/README.md +1 -1
- data/tracks/lua/exercises/binary-search/.busted +5 -0
- data/tracks/lua/exercises/binary-search/README.md +1 -1
- data/tracks/lua/exercises/binary/.busted +5 -0
- data/tracks/lua/exercises/binary/README.md +1 -1
- data/tracks/lua/exercises/bob/.busted +5 -0
- data/tracks/lua/exercises/bob/README.md +1 -1
- data/tracks/lua/exercises/bowling/.busted +5 -0
- data/tracks/lua/exercises/bowling/README.md +1 -1
- data/tracks/lua/exercises/bracket-push/.busted +5 -0
- data/tracks/lua/exercises/bracket-push/README.md +1 -1
- data/tracks/lua/exercises/change/.busted +5 -0
- data/tracks/lua/exercises/change/README.md +1 -1
- data/tracks/lua/exercises/circular-buffer/.busted +5 -0
- data/tracks/lua/exercises/circular-buffer/README.md +1 -1
- data/tracks/lua/exercises/clock/.busted +5 -0
- data/tracks/lua/exercises/clock/README.md +1 -1
- data/tracks/lua/exercises/collatz-conjecture/.busted +5 -0
- data/tracks/lua/exercises/collatz-conjecture/README.md +1 -1
- data/tracks/lua/exercises/crypto-square/.busted +5 -0
- data/tracks/lua/exercises/crypto-square/README.md +1 -1
- data/tracks/lua/exercises/custom-set/.busted +5 -0
- data/tracks/lua/exercises/custom-set/README.md +1 -1
- data/tracks/lua/exercises/diamond/.busted +5 -0
- data/tracks/lua/exercises/diamond/README.md +1 -1
- data/tracks/lua/exercises/difference-of-squares/.busted +5 -0
- data/tracks/lua/exercises/difference-of-squares/README.md +1 -1
- data/tracks/lua/exercises/etl/.busted +5 -0
- data/tracks/lua/exercises/etl/README.md +1 -1
- data/tracks/lua/exercises/flatten-array/.busted +5 -0
- data/tracks/lua/exercises/flatten-array/README.md +1 -1
- data/tracks/lua/exercises/food-chain/.busted +5 -0
- data/tracks/lua/exercises/food-chain/README.md +1 -1
- data/tracks/lua/exercises/gigasecond/.busted +5 -0
- data/tracks/lua/exercises/gigasecond/README.md +1 -1
- data/tracks/lua/exercises/grade-school/.busted +5 -0
- data/tracks/lua/exercises/grade-school/README.md +1 -1
- data/tracks/lua/exercises/grains/.busted +5 -0
- data/tracks/lua/exercises/grains/README.md +1 -1
- data/tracks/lua/exercises/hamming/.busted +5 -0
- data/tracks/lua/exercises/hamming/README.md +1 -1
- data/tracks/lua/exercises/hello-world/.busted +5 -0
- data/tracks/lua/exercises/hello-world/README.md +1 -1
- data/tracks/lua/exercises/house/.busted +5 -0
- data/tracks/lua/exercises/house/README.md +1 -1
- data/tracks/lua/exercises/isbn-verifier/.busted +5 -0
- data/tracks/lua/exercises/isbn-verifier/README.md +1 -1
- data/tracks/lua/exercises/isogram/.busted +5 -0
- data/tracks/lua/exercises/isogram/README.md +1 -1
- data/tracks/lua/exercises/kindergarten-garden/.busted +5 -0
- data/tracks/lua/exercises/kindergarten-garden/README.md +1 -1
- data/tracks/lua/exercises/largest-series-product/.busted +5 -0
- data/tracks/lua/exercises/largest-series-product/README.md +1 -1
- data/tracks/lua/exercises/leap/.busted +5 -0
- data/tracks/lua/exercises/leap/README.md +1 -1
- data/tracks/lua/exercises/linked-list/.busted +5 -0
- data/tracks/lua/exercises/linked-list/README.md +1 -1
- data/tracks/lua/exercises/list-ops/.busted +5 -0
- data/tracks/lua/exercises/list-ops/README.md +1 -1
- data/tracks/lua/exercises/luhn/.busted +5 -0
- data/tracks/lua/exercises/luhn/README.md +1 -1
- data/tracks/lua/exercises/matrix/.busted +5 -0
- data/tracks/lua/exercises/matrix/README.md +1 -1
- data/tracks/lua/exercises/meetup/.busted +5 -0
- data/tracks/lua/exercises/meetup/README.md +1 -1
- data/tracks/lua/exercises/minesweeper/.busted +5 -0
- data/tracks/lua/exercises/minesweeper/README.md +1 -1
- data/tracks/lua/exercises/nth-prime/.busted +5 -0
- data/tracks/lua/exercises/nth-prime/README.md +1 -1
- data/tracks/lua/exercises/nucleotide-count/.busted +5 -0
- data/tracks/lua/exercises/nucleotide-count/README.md +1 -1
- data/tracks/lua/exercises/ocr-numbers/.busted +5 -0
- data/tracks/lua/exercises/ocr-numbers/README.md +1 -1
- data/tracks/lua/exercises/octal/.busted +5 -0
- data/tracks/lua/exercises/octal/README.md +1 -1
- data/tracks/lua/exercises/pangram/.busted +5 -0
- data/tracks/lua/exercises/pangram/README.md +1 -1
- data/tracks/lua/exercises/pascals-triangle/.busted +5 -0
- data/tracks/lua/exercises/pascals-triangle/README.md +1 -1
- data/tracks/lua/exercises/perfect-numbers/.busted +5 -0
- data/tracks/lua/exercises/perfect-numbers/README.md +1 -1
- data/tracks/lua/exercises/phone-number/.busted +5 -0
- data/tracks/lua/exercises/phone-number/README.md +1 -1
- data/tracks/lua/exercises/pig-latin/.busted +5 -0
- data/tracks/lua/exercises/pig-latin/README.md +1 -1
- data/tracks/lua/exercises/pov/.busted +5 -0
- data/tracks/lua/exercises/pov/README.md +1 -1
- data/tracks/lua/exercises/prime-factors/.busted +5 -0
- data/tracks/lua/exercises/prime-factors/README.md +1 -1
- data/tracks/lua/exercises/protein-translation/.busted +5 -0
- data/tracks/lua/exercises/protein-translation/README.md +1 -1
- data/tracks/lua/exercises/pythagorean-triplet/.busted +5 -0
- data/tracks/lua/exercises/pythagorean-triplet/README.md +1 -1
- data/tracks/lua/exercises/queen-attack/.busted +5 -0
- data/tracks/lua/exercises/queen-attack/README.md +1 -1
- data/tracks/lua/exercises/rail-fence-cipher/.busted +5 -0
- data/tracks/lua/exercises/rail-fence-cipher/README.md +1 -1
- data/tracks/lua/exercises/raindrops/.busted +5 -0
- data/tracks/lua/exercises/raindrops/README.md +1 -1
- data/tracks/lua/exercises/react/.busted +5 -0
- data/tracks/lua/exercises/react/README.md +1 -1
- data/tracks/lua/exercises/rectangles/.busted +5 -0
- data/tracks/lua/exercises/rectangles/README.md +1 -1
- data/tracks/lua/exercises/reverse-string/.busted +5 -0
- data/tracks/lua/exercises/reverse-string/README.md +1 -1
- data/tracks/lua/exercises/reverse-string/reverse-string_spec.lua +0 -1
- data/tracks/lua/exercises/rna-transcription/.busted +5 -0
- data/tracks/lua/exercises/rna-transcription/README.md +1 -1
- data/tracks/lua/exercises/robot-name/.busted +5 -0
- data/tracks/lua/exercises/robot-name/README.md +1 -1
- data/tracks/lua/exercises/robot-simulator/.busted +5 -0
- data/tracks/lua/exercises/robot-simulator/README.md +1 -1
- data/tracks/lua/exercises/roman-numerals/.busted +5 -0
- data/tracks/lua/exercises/roman-numerals/README.md +1 -1
- data/tracks/lua/exercises/run-length-encoding/.busted +5 -0
- data/tracks/lua/exercises/run-length-encoding/README.md +1 -1
- data/tracks/lua/exercises/say/.busted +5 -0
- data/tracks/lua/exercises/say/README.md +1 -1
- data/tracks/lua/exercises/scrabble-score/.busted +5 -0
- data/tracks/lua/exercises/scrabble-score/README.md +1 -1
- data/tracks/lua/exercises/secret-handshake/.busted +5 -0
- data/tracks/lua/exercises/secret-handshake/README.md +1 -1
- data/tracks/lua/exercises/series/.busted +5 -0
- data/tracks/lua/exercises/series/README.md +1 -1
- data/tracks/lua/exercises/sieve/.busted +5 -0
- data/tracks/lua/exercises/sieve/README.md +1 -1
- data/tracks/lua/exercises/space-age/.busted +5 -0
- data/tracks/lua/exercises/space-age/README.md +1 -1
- data/tracks/lua/exercises/sublist/.busted +5 -0
- data/tracks/lua/exercises/sublist/README.md +1 -1
- data/tracks/lua/exercises/sum-of-multiples/.busted +5 -0
- data/tracks/lua/exercises/sum-of-multiples/README.md +1 -1
- data/tracks/lua/exercises/tournament/.busted +5 -0
- data/tracks/lua/exercises/tournament/README.md +1 -1
- data/tracks/lua/exercises/transpose/.busted +5 -0
- data/tracks/lua/exercises/transpose/README.md +1 -1
- data/tracks/lua/exercises/triangle/.busted +5 -0
- data/tracks/lua/exercises/triangle/README.md +1 -1
- data/tracks/lua/exercises/variable-length-quantity/.busted +5 -0
- data/tracks/lua/exercises/variable-length-quantity/README.md +1 -1
- data/tracks/lua/exercises/word-count/.busted +5 -0
- data/tracks/lua/exercises/word-count/README.md +1 -1
- data/tracks/lua/exercises/word-search/.busted +5 -0
- data/tracks/lua/exercises/word-search/README.md +1 -1
- data/tracks/ocaml/.gitignore +1 -1
- data/tracks/ocaml/exercises/space-age/test.ml +0 -1
- data/tracks/ocaml/tools/test-generator/Makefile +13 -3
- data/tracks/ocaml/tools/test-generator/jbuild +3 -0
- data/tracks/ocaml/tools/test-generator/templates/ocaml/acronym/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/all-your-base/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/atbash-cipher/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/beer-song/test.ml +3 -3
- data/tracks/ocaml/tools/test-generator/templates/ocaml/binary-search/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/bracket-push/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/change/test.ml +2 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/connect/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/difference-of-squares/test.ml +0 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/dominoes/test.ml +9 -4
- data/tracks/ocaml/tools/test-generator/templates/ocaml/etl/test.ml +1 -3
- data/tracks/ocaml/tools/test-generator/templates/ocaml/forth/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/hamming/test.ml +6 -6
- data/tracks/ocaml/tools/test-generator/templates/ocaml/hello-world/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/leap/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/luhn/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/minesweeper/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/pangram/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/phone-number/test.ml +2 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/prime-factors/test.ml +2 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/raindrops/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/rectangles/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/roman-numerals/test.ml +1 -2
- data/tracks/ocaml/tools/test-generator/templates/ocaml/run-length-encoding/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/say/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/space-age/test.ml +2 -3
- data/tracks/ocaml/tools/test-generator/templates/ocaml/triangle/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/word-count/test.ml +1 -1
- data/tracks/perl5/exercises/largest-series-product/series_product.t +2 -2
- data/tracks/r/config.json +3 -3
- data/tracks/rust/exercises/alphametics/src/lib.rs +2 -2
- data/tracks/rust/exercises/book-store/src/lib.rs +2 -2
- data/tracks/rust/exercises/crypto-square/src/lib.rs +2 -2
- data/tracks/rust/exercises/decimal/src/lib.rs +2 -2
- data/tracks/rust/exercises/diffie-hellman/src/lib.rs +6 -6
- data/tracks/rust/exercises/isbn-verifier/src/lib.rs +2 -2
- data/tracks/rust/exercises/pig-latin/README.md +4 -4
- data/tracks/rust/exercises/poker/src/lib.rs +2 -2
- data/tracks/rust/exercises/series/src/lib.rs +2 -2
- data/tracks/scala/exercises/triangle/src/test/scala/TriangleTest.scala +2 -2
- data/tracks/scala/exercises/variable-length-quantity/src/test/scala/VariableLengthQuantityTest.scala +1 -1
- data/tracks/scala/exercises/word-count/example.scala +1 -1
- data/tracks/scala/exercises/word-count/src/test/scala/WordCountTest.scala +17 -11
- data/tracks/scala/exercises/wordy/src/test/scala/WordyTest.scala +19 -18
- data/tracks/scala/testgen/src/main/scala/TriangleTestGenerator.scala +6 -6
- data/tracks/scala/testgen/src/main/scala/VariableLengthQuantityTestGenerator.scala +6 -7
- data/tracks/scala/testgen/src/main/scala/WordCountTestGenerator.scala +5 -9
- data/tracks/scala/testgen/src/main/scala/WordyTestGenerator.scala +3 -3
- data/tracks/typescript/circle.yml +17 -0
- data/tracks/typescript/config.json +55 -0
- data/tracks/typescript/exercises/flatten-array/README.md +43 -0
- data/tracks/typescript/exercises/flatten-array/flatten-array.example.ts +14 -0
- data/tracks/typescript/exercises/flatten-array/flatten-array.test.ts +33 -0
- data/tracks/typescript/exercises/flatten-array/flatten-array.ts +0 -0
- data/tracks/typescript/exercises/flatten-array/package.json +36 -0
- data/tracks/typescript/exercises/flatten-array/tsconfig.json +22 -0
- data/tracks/typescript/exercises/flatten-array/tslint.json +127 -0
- data/tracks/typescript/exercises/flatten-array/yarn.lock +2624 -0
- data/tracks/typescript/exercises/grains/README.md +59 -0
- data/tracks/typescript/exercises/grains/grains.example.ts +21 -0
- data/tracks/typescript/exercises/grains/grains.test.ts +60 -0
- data/tracks/typescript/exercises/grains/grains.ts +0 -0
- data/tracks/typescript/exercises/grains/package.json +36 -0
- data/tracks/typescript/exercises/grains/tsconfig.json +22 -0
- data/tracks/typescript/exercises/grains/tslint.json +127 -0
- data/tracks/typescript/exercises/grains/yarn.lock +2624 -0
- data/tracks/typescript/exercises/luhn/README.md +97 -0
- data/tracks/typescript/exercises/luhn/luhn.example.ts +30 -0
- data/tracks/typescript/exercises/luhn/luhn.test.ts +47 -0
- data/tracks/typescript/exercises/luhn/luhn.ts +0 -0
- data/tracks/typescript/exercises/luhn/package.json +36 -0
- data/tracks/typescript/exercises/luhn/tsconfig.json +22 -0
- data/tracks/typescript/exercises/luhn/tslint.json +127 -0
- data/tracks/typescript/exercises/luhn/yarn.lock +2624 -0
- data/tracks/typescript/exercises/pig-latin/README.md +50 -0
- data/tracks/typescript/exercises/pig-latin/package.json +36 -0
- data/tracks/typescript/exercises/pig-latin/pig-latin.example.ts +22 -0
- data/tracks/typescript/exercises/pig-latin/pig-latin.test.ts +106 -0
- data/tracks/typescript/exercises/pig-latin/pig-latin.ts +0 -0
- data/tracks/typescript/exercises/pig-latin/tsconfig.json +22 -0
- data/tracks/typescript/exercises/pig-latin/tslint.json +127 -0
- data/tracks/typescript/exercises/pig-latin/yarn.lock +2624 -0
- metadata +146 -2
@@ -0,0 +1,74 @@
|
|
1
|
+
//Package yacht is a sample solution to the yacht exercise for go
|
2
|
+
package yacht
|
3
|
+
|
4
|
+
import (
|
5
|
+
"sort"
|
6
|
+
)
|
7
|
+
|
8
|
+
//scoreN calculates the score of the lower categories
|
9
|
+
//It returns the total of those dice that equal n
|
10
|
+
func scoreN(dice []int, n int) int {
|
11
|
+
score := 0
|
12
|
+
for _, d := range dice {
|
13
|
+
if d == n {
|
14
|
+
score += n
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return score
|
18
|
+
}
|
19
|
+
|
20
|
+
//scoreAll adds up and returns the total of the five dice
|
21
|
+
func scoreAll(dice []int) int {
|
22
|
+
return dice[0] + dice[1] + dice[2] + dice[3] + dice[4]
|
23
|
+
}
|
24
|
+
|
25
|
+
var diceValueMap = map[string]int{
|
26
|
+
"ones": 1, "twos": 2, "threes": 3, "fours": 4, "fives": 5, "sixes": 6,
|
27
|
+
}
|
28
|
+
|
29
|
+
//Score returns the total score of a hand of Yacht dice in a given category.
|
30
|
+
func Score(dice []int, category string) int {
|
31
|
+
sort.Ints(dice)
|
32
|
+
switch category {
|
33
|
+
case "ones", "twos", "threes", "fours", "fives", "sixes":
|
34
|
+
return scoreN(dice, diceValueMap[category])
|
35
|
+
case "full house":
|
36
|
+
//Note, a yacht scores zero as a full house
|
37
|
+
if dice[0] == dice[1] && dice[2] == dice[3] && dice[3] == dice[4] && dice[1] != dice[2] {
|
38
|
+
return scoreAll(dice)
|
39
|
+
}
|
40
|
+
if dice[0] == dice[1] && dice[1] == dice[2] && dice[3] == dice[4] && dice[2] != dice[3] {
|
41
|
+
return scoreAll(dice)
|
42
|
+
}
|
43
|
+
return 0
|
44
|
+
case "four of a kind":
|
45
|
+
//Note, a yacht can score as four of a kind, but only 4 dice are counted
|
46
|
+
if dice[0] == dice[1] && dice[1] == dice[2] && dice[2] == dice[3] {
|
47
|
+
return dice[0] * 4
|
48
|
+
}
|
49
|
+
if dice[1] == dice[2] && dice[2] == dice[3] && dice[3] == dice[4] {
|
50
|
+
return dice[1] * 4
|
51
|
+
}
|
52
|
+
return 0
|
53
|
+
case "little straight":
|
54
|
+
if dice[0] == 1 && dice[1] == 2 && dice[2] == 3 && dice[3] == 4 && dice[4] == 5 {
|
55
|
+
return 30
|
56
|
+
}
|
57
|
+
return 0
|
58
|
+
case "big straight":
|
59
|
+
if dice[0] == 2 && dice[1] == 3 && dice[2] == 4 && dice[3] == 5 && dice[4] == 6 {
|
60
|
+
return 30
|
61
|
+
}
|
62
|
+
return 0
|
63
|
+
case "choice":
|
64
|
+
return scoreAll(dice)
|
65
|
+
case "yacht":
|
66
|
+
if dice[0] == dice[1] && dice[1] == dice[2] && dice[2] == dice[3] && dice[3] == dice[4] {
|
67
|
+
return 50
|
68
|
+
}
|
69
|
+
return 0
|
70
|
+
default:
|
71
|
+
//This can't happen, so panic is appropriate
|
72
|
+
panic("Unknown category")
|
73
|
+
}
|
74
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
package yacht
|
2
|
+
|
3
|
+
import (
|
4
|
+
"testing"
|
5
|
+
)
|
6
|
+
|
7
|
+
func TestScore(t *testing.T) {
|
8
|
+
for _, testCase := range testCases {
|
9
|
+
score := Score(testCase.dice, testCase.category)
|
10
|
+
if testCase.expected != score {
|
11
|
+
t.Fatalf("FAIL: %s\nScore %v as %s. expected %d, got %d",
|
12
|
+
testCase.description, testCase.dice, testCase.category,
|
13
|
+
testCase.expected, score)
|
14
|
+
}
|
15
|
+
t.Logf("PASS: %s", testCase.description)
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
func BenchmarkScore(b *testing.B) {
|
20
|
+
for i := 0; i < b.N; i++ {
|
21
|
+
for _, testCase := range testCases {
|
22
|
+
Score(testCase.dice, testCase.category)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
data/tracks/haskell/config.json
CHANGED
@@ -791,6 +791,16 @@
|
|
791
791
|
"Either"
|
792
792
|
]
|
793
793
|
},
|
794
|
+
{
|
795
|
+
"uuid": "35bf659b-b139-4d09-bdae-326319160a27",
|
796
|
+
"slug": "poker",
|
797
|
+
"core": false,
|
798
|
+
"unlocked_by": null,
|
799
|
+
"difficulty": 7,
|
800
|
+
"topics": [
|
801
|
+
"Maybe"
|
802
|
+
]
|
803
|
+
},
|
794
804
|
{
|
795
805
|
"uuid": "2c009c74-fbf2-49f7-b626-0d9da10c18ea",
|
796
806
|
"slug": "connect",
|
@@ -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
|
@@ -19,16 +19,6 @@ specs = do
|
|
19
19
|
, " W W "
|
20
20
|
, " W " ]
|
21
21
|
|
22
|
-
board9x9 = [ " B B "
|
23
|
-
, "B B B"
|
24
|
-
, "WBBBWBBBW"
|
25
|
-
, "W W W W W"
|
26
|
-
, " "
|
27
|
-
, " W W W W "
|
28
|
-
, "B B B B"
|
29
|
-
, " W BBB W "
|
30
|
-
, " B B " ]
|
31
|
-
|
32
22
|
shouldHaveTerritories = shouldMatchList
|
33
23
|
. map (first toAscList)
|
34
24
|
. territories
|
@@ -54,20 +44,24 @@ specs = do
|
|
54
44
|
, ([ (4, 1)
|
55
45
|
, (4, 2) ], Just White) ]
|
56
46
|
|
47
|
+
it "two territories of same player, rectangular board" $
|
48
|
+
[ " B " ] `shouldHaveTerritories` [ ([ (1, 1) ], Just Black)
|
49
|
+
, ([ (3, 1) ], Just Black) ]
|
50
|
+
|
57
51
|
it "5x5 score" $
|
58
52
|
board5x5 `shouldScore` [ (Nothing , 9)
|
59
53
|
, (Just Black, 6)
|
60
54
|
, (Just White, 1) ]
|
61
55
|
|
62
|
-
it "5x5 territory for black" $
|
56
|
+
it "5x5 territory for black bordering edge" $
|
63
57
|
territoryIn board5x5 (1, 2) `shouldBe` Just ([ (1, 1)
|
64
58
|
, (1, 2)
|
65
59
|
, (2, 1) ], Just Black)
|
66
60
|
|
67
|
-
it "5x5 territory for white" $
|
61
|
+
it "5x5 territory for white not bordering edge" $
|
68
62
|
territoryIn board5x5 (3, 4) `shouldBe` Just ([ (3, 4) ], Just White)
|
69
63
|
|
70
|
-
it "5x5 open territory" $
|
64
|
+
it "5x5 open territory bordering edge" $
|
71
65
|
territoryIn board5x5 (2, 5) `shouldBe` Just ([ (1, 4)
|
72
66
|
, (1, 5)
|
73
67
|
, (2, 5) ], Nothing)
|
@@ -75,12 +69,14 @@ specs = do
|
|
75
69
|
it "5x5 non-territory (stone)" $
|
76
70
|
territoryIn board5x5 (2, 2) `shouldBe` Nothing
|
77
71
|
|
78
|
-
it "5x5 non-territory (too low
|
72
|
+
it "5x5 non-territory (X too low)" $
|
79
73
|
territoryIn board5x5 (0, 2) `shouldBe` Nothing
|
80
74
|
|
81
|
-
it "5x5 non-territory (too high
|
82
|
-
territoryIn board5x5 (
|
75
|
+
it "5x5 non-territory (X too high)" $
|
76
|
+
territoryIn board5x5 (6, 2) `shouldBe` Nothing
|
83
77
|
|
84
|
-
it "
|
85
|
-
|
86
|
-
|
78
|
+
it "5x5 non-territory (Y too low)" $
|
79
|
+
territoryIn board5x5 (2, 0) `shouldBe` Nothing
|
80
|
+
|
81
|
+
it "5x5 non-territory (Y too high)" $
|
82
|
+
territoryIn board5x5 (2, 6) `shouldBe` Nothing
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Poker
|
2
|
+
|
3
|
+
Pick the best hand(s) from a list of poker hands.
|
4
|
+
|
5
|
+
See [wikipedia](https://en.wikipedia.org/wiki/List_of_poker_hands) for an
|
6
|
+
overview of poker hands.
|
7
|
+
|
8
|
+
|
9
|
+
## Getting Started
|
10
|
+
|
11
|
+
For installation and learning resources, refer to the
|
12
|
+
[exercism help page](http://exercism.io/languages/haskell).
|
13
|
+
|
14
|
+
## Running the tests
|
15
|
+
|
16
|
+
To run the test suite, execute the following command:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
stack test
|
20
|
+
```
|
21
|
+
|
22
|
+
#### If you get an error message like this...
|
23
|
+
|
24
|
+
```
|
25
|
+
No .cabal file found in directory
|
26
|
+
```
|
27
|
+
|
28
|
+
You are probably running an old stack version and need
|
29
|
+
to upgrade it.
|
30
|
+
|
31
|
+
#### Otherwise, if you get an error message like this...
|
32
|
+
|
33
|
+
```
|
34
|
+
No compiler found, expected minor version match with...
|
35
|
+
Try running "stack setup" to install the correct GHC...
|
36
|
+
```
|
37
|
+
|
38
|
+
Just do as it says and it will download and install
|
39
|
+
the correct compiler version:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
stack setup
|
43
|
+
```
|
44
|
+
|
45
|
+
## Running *GHCi*
|
46
|
+
|
47
|
+
If you want to play with your solution in GHCi, just run the command:
|
48
|
+
|
49
|
+
```bash
|
50
|
+
stack ghci
|
51
|
+
```
|
52
|
+
|
53
|
+
## Feedback, Issues, Pull Requests
|
54
|
+
|
55
|
+
The [exercism/haskell](https://github.com/exercism/haskell) repository on
|
56
|
+
GitHub is the home for all of the Haskell exercises.
|
57
|
+
|
58
|
+
If you have feedback about an exercise, or want to help implementing a new
|
59
|
+
one, head over there and create an issue. We'll do our best to help you!
|
60
|
+
|
61
|
+
## Source
|
62
|
+
|
63
|
+
Inspired by the training course from Udacity. [https://www.udacity.com/course/viewer#!/c-cs212/](https://www.udacity.com/course/viewer#!/c-cs212/)
|
64
|
+
|
65
|
+
## Submitting Incomplete Solutions
|
66
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Poker (bestHands) where
|
2
|
+
|
3
|
+
import Data.Maybe (fromJust)
|
4
|
+
import Data.List (nub, elemIndex, sortBy)
|
5
|
+
|
6
|
+
validHand :: [String] -> Bool
|
7
|
+
validHand h = and [ length h == 5
|
8
|
+
, all (`elem` "A23456789TJQK") (head <$> h)
|
9
|
+
, all (`elem` "HSDC") (last <$> h)
|
10
|
+
, all ((==2) . length) h]
|
11
|
+
|
12
|
+
parseHand :: String -> [String]
|
13
|
+
parseHand = map f . words
|
14
|
+
where
|
15
|
+
f ('1':'0':xs) = 'T' : xs
|
16
|
+
f xs = xs
|
17
|
+
|
18
|
+
rankHand :: [String] -> (Int, [Int])
|
19
|
+
rankHand h | counts == [5] = (9, ranks')
|
20
|
+
| straight && flush = (8, ranks')
|
21
|
+
| counts == [4,1] = (7, ranks')
|
22
|
+
| counts == [3,2] = (6, ranks')
|
23
|
+
| flush = (5, ranks')
|
24
|
+
| straight = (4, ranks')
|
25
|
+
| counts == [3,1,1] = (3, ranks')
|
26
|
+
| counts == [2,2,1] = (2, ranks')
|
27
|
+
| counts == [2,1,1,1] = (1, ranks')
|
28
|
+
| otherwise = (0, ranks')
|
29
|
+
where
|
30
|
+
r = fromJust . flip elemIndex "..23456789TJQKA" . head <$> h
|
31
|
+
groups = let x = nub r in sortBy (flip compare) (zip (times r <$> x) x)
|
32
|
+
counts = fst <$> groups
|
33
|
+
ranks = snd <$> groups
|
34
|
+
ranks' = if ranks == [14,5,4,3,2] then [5,4,3,2,1] else ranks
|
35
|
+
straight = length counts == 5 && (maximum ranks' - minimum ranks') == 4
|
36
|
+
flush = length (nub (last <$> h)) == 1
|
37
|
+
times xs x = length $ filter (==x) xs
|
38
|
+
|
39
|
+
bestHands :: [String] -> Maybe [String]
|
40
|
+
bestHands hands | not (all validHand hands') = Nothing
|
41
|
+
| otherwise = Just $ f (0,[]) [] (zip hands hands')
|
42
|
+
where
|
43
|
+
hands' = parseHand <$> hands
|
44
|
+
f _ r [] = r
|
45
|
+
f m r ((x,y):xs) | null r || rank > m = f rank [x] xs
|
46
|
+
| rank == m = f m (x : r) xs
|
47
|
+
| otherwise = f m r xs
|
48
|
+
where
|
49
|
+
rank = rankHand y
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: poker
|
2
|
+
version: 1.1.0.1
|
3
|
+
|
4
|
+
dependencies:
|
5
|
+
- base
|
6
|
+
|
7
|
+
library:
|
8
|
+
exposed-modules: Poker
|
9
|
+
source-dirs: src
|
10
|
+
dependencies:
|
11
|
+
# - foo # List here the packages you
|
12
|
+
# - bar # want to use in your solution.
|
13
|
+
|
14
|
+
tests:
|
15
|
+
test:
|
16
|
+
main: Tests.hs
|
17
|
+
source-dirs: test
|
18
|
+
dependencies:
|
19
|
+
- poker
|
20
|
+
- hspec
|
@@ -0,0 +1 @@
|
|
1
|
+
resolver: lts-10.2
|
@@ -0,0 +1,174 @@
|
|
1
|
+
{-# LANGUAGE RecordWildCards #-}
|
2
|
+
|
3
|
+
import Data.Foldable (for_)
|
4
|
+
import Data.List (sort)
|
5
|
+
import Test.Hspec (Spec, describe, it, shouldBe)
|
6
|
+
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
|
7
|
+
|
8
|
+
import Poker (bestHands)
|
9
|
+
|
10
|
+
main :: IO ()
|
11
|
+
main = hspecWith defaultConfig {configFastFail = True} specs
|
12
|
+
|
13
|
+
specs :: Spec
|
14
|
+
specs = describe "bestHands" $ for_ cases test
|
15
|
+
where
|
16
|
+
|
17
|
+
test Case{..} = it description assertion
|
18
|
+
where
|
19
|
+
assertion = (sort <$> bestHands input) `shouldBe` (sort <$> expected)
|
20
|
+
|
21
|
+
data Case = Case { description :: String
|
22
|
+
, input :: [String]
|
23
|
+
, expected :: Maybe [String]
|
24
|
+
}
|
25
|
+
|
26
|
+
cases :: [Case]
|
27
|
+
cases = [ Case { description = "single hand always wins"
|
28
|
+
, input = ["4S 5S 7H 8D JC"]
|
29
|
+
, expected = Just ["4S 5S 7H 8D JC"]
|
30
|
+
}
|
31
|
+
, Case { description = "highest card out of all hands win"
|
32
|
+
, input = [ "4D 5S 6S 8D 3C"
|
33
|
+
, "2S 4C 7S 9H 10H"
|
34
|
+
, "3S 4S 5D 6H JH"]
|
35
|
+
, expected = Just ["3S 4S 5D 6H JH"]
|
36
|
+
}
|
37
|
+
, Case { description = "a tie has multiple winners"
|
38
|
+
, input = [ "4D 5S 6S 8D 3C"
|
39
|
+
, "2S 4C 7S 9H 10H"
|
40
|
+
, "3S 4S 5D 6H JH"
|
41
|
+
, "3H 4H 5C 6C JD"]
|
42
|
+
, expected = Just [ "3S 4S 5D 6H JH"
|
43
|
+
, "3H 4H 5C 6C JD"]
|
44
|
+
}
|
45
|
+
, Case { description = "multiple hands with the same high cards, tie compares next highest ranked, down to last card"
|
46
|
+
, input = [ "3S 5H 6S 8D 7H"
|
47
|
+
, "2S 5D 6D 8C 7S"]
|
48
|
+
, expected = Just ["3S 5H 6S 8D 7H"]
|
49
|
+
}
|
50
|
+
, Case { description = "one pair beats high card"
|
51
|
+
, input = [ "4S 5H 6C 8D KH"
|
52
|
+
, "2S 4H 6S 4D JH"]
|
53
|
+
, expected = Just ["2S 4H 6S 4D JH"]
|
54
|
+
}
|
55
|
+
, Case { description = "highest pair wins"
|
56
|
+
, input = [ "4S 2H 6S 2D JH"
|
57
|
+
, "2S 4H 6C 4D JD"]
|
58
|
+
, expected = Just ["2S 4H 6C 4D JD"]
|
59
|
+
}
|
60
|
+
, Case { description = "two pairs beats one pair"
|
61
|
+
, input = [ "2S 8H 6S 8D JH"
|
62
|
+
, "4S 5H 4C 8C 5C"]
|
63
|
+
, expected = Just ["4S 5H 4C 8C 5C"]
|
64
|
+
}
|
65
|
+
, Case { description = "both hands have two pairs, highest ranked pair wins"
|
66
|
+
, input = [ "2S 8H 2D 8D 3H"
|
67
|
+
, "4S 5H 4C 8S 5D"]
|
68
|
+
, expected = Just ["2S 8H 2D 8D 3H"]
|
69
|
+
}
|
70
|
+
, Case { description = "both hands have two pairs, with the same highest ranked pair, tie goes to low pair"
|
71
|
+
, input = [ "2S QS 2C QD JH"
|
72
|
+
, "JD QH JS 8D QC"]
|
73
|
+
, expected = Just ["JD QH JS 8D QC"]
|
74
|
+
}
|
75
|
+
, Case { description = "both hands have two identically ranked pairs, tie goes to remaining card (kicker)"
|
76
|
+
, input = [ "JD QH JS 8D QC"
|
77
|
+
, "JS QS JC 2D QD"]
|
78
|
+
, expected = Just ["JD QH JS 8D QC"]
|
79
|
+
}
|
80
|
+
, Case { description = "three of a kind beats two pair"
|
81
|
+
, input = [ "2S 8H 2H 8D JH"
|
82
|
+
, "4S 5H 4C 8S 4H"]
|
83
|
+
, expected = Just ["4S 5H 4C 8S 4H"]
|
84
|
+
}
|
85
|
+
, Case { description = "both hands have three of a kind, tie goes to highest ranked triplet"
|
86
|
+
, input = [ "2S 2H 2C 8D JH"
|
87
|
+
, "4S AH AS 8C AD"]
|
88
|
+
, expected = Just ["4S AH AS 8C AD"]
|
89
|
+
}
|
90
|
+
, Case { description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards"
|
91
|
+
, input = [ "4S AH AS 7C AD"
|
92
|
+
, "4S AH AS 8C AD"]
|
93
|
+
, expected = Just ["4S AH AS 8C AD"]
|
94
|
+
}
|
95
|
+
, Case { description = "a straight beats three of a kind"
|
96
|
+
, input = [ "4S 5H 4C 8D 4H"
|
97
|
+
, "3S 4D 2S 6D 5C"]
|
98
|
+
, expected = Just ["3S 4D 2S 6D 5C"]
|
99
|
+
}
|
100
|
+
, Case { description = "aces can end a straight (10 J Q K A)"
|
101
|
+
, input = [ "4S 5H 4C 8D 4H"
|
102
|
+
, "10D JH QS KD AC"]
|
103
|
+
, expected = Just ["10D JH QS KD AC"]
|
104
|
+
}
|
105
|
+
, Case { description = "aces can start a straight (A 2 3 4 5)"
|
106
|
+
, input = [ "4S 5H 4C 8D 4H"
|
107
|
+
, "4D AH 3S 2D 5C"]
|
108
|
+
, expected = Just ["4D AH 3S 2D 5C"]
|
109
|
+
}
|
110
|
+
, Case { description = "both hands with a straight, tie goes to highest ranked card"
|
111
|
+
, input = [ "4S 6C 7S 8D 5H"
|
112
|
+
, "5S 7H 8S 9D 6H"]
|
113
|
+
, expected = Just ["5S 7H 8S 9D 6H"]
|
114
|
+
}
|
115
|
+
, Case { description = "even though an ace is usually high, a 5-high straight is the lowest-scoring straight"
|
116
|
+
, input = [ "2H 3C 4D 5D 6H"
|
117
|
+
, "4S AH 3S 2D 5H"]
|
118
|
+
, expected = Just ["2H 3C 4D 5D 6H"]
|
119
|
+
}
|
120
|
+
, Case { description = "flush beats a straight"
|
121
|
+
, input = [ "4C 6H 7D 8D 5H"
|
122
|
+
, "2S 4S 5S 6S 7S"]
|
123
|
+
, expected = Just ["2S 4S 5S 6S 7S"]
|
124
|
+
}
|
125
|
+
, Case { description = "both hands have a flush, tie goes to high card, down to the last one if necessary"
|
126
|
+
, input = [ "4H 7H 8H 9H 6H"
|
127
|
+
, "2S 4S 5S 6S 7S"]
|
128
|
+
, expected = Just ["4H 7H 8H 9H 6H"]
|
129
|
+
}
|
130
|
+
, Case { description = "full house beats a flush"
|
131
|
+
, input = [ "3H 6H 7H 8H 5H"
|
132
|
+
, "4S 5H 4C 5D 4H"]
|
133
|
+
, expected = Just ["4S 5H 4C 5D 4H"]
|
134
|
+
}
|
135
|
+
, Case { description = "both hands have a full house, tie goes to highest-ranked triplet"
|
136
|
+
, input = [ "4H 4S 4D 9S 9D"
|
137
|
+
, "5H 5S 5D 8S 8D"]
|
138
|
+
, expected = Just ["5H 5S 5D 8S 8D"]
|
139
|
+
}
|
140
|
+
, Case { description = "with multiple decks, both hands have a full house with the same triplet, tie goes to the pair"
|
141
|
+
, input = [ "5H 5S 5D 9S 9D"
|
142
|
+
, "5H 5S 5D 8S 8D"]
|
143
|
+
, expected = Just ["5H 5S 5D 9S 9D"]
|
144
|
+
}
|
145
|
+
, Case { description = "four of a kind beats a full house"
|
146
|
+
, input = [ "4S 5H 4D 5D 4H"
|
147
|
+
, "3S 3H 2S 3D 3C"]
|
148
|
+
, expected = Just ["3S 3H 2S 3D 3C"]
|
149
|
+
}
|
150
|
+
, Case { description = "both hands have four of a kind, tie goes to high quad"
|
151
|
+
, input = [ "2S 2H 2C 8D 2D"
|
152
|
+
, "4S 5H 5S 5D 5C"]
|
153
|
+
, expected = Just ["4S 5H 5S 5D 5C"]
|
154
|
+
}
|
155
|
+
, Case { description = "with multiple decks, both hands with identical four of a kind, tie determined by kicker"
|
156
|
+
, input = [ "3S 3H 2S 3D 3C"
|
157
|
+
, "3S 3H 4S 3D 3C"]
|
158
|
+
, expected = Just ["3S 3H 4S 3D 3C"]
|
159
|
+
}
|
160
|
+
, Case { description = "straight flush beats four of a kind"
|
161
|
+
, input = [ "4S 5H 5S 5D 5C"
|
162
|
+
, "7S 8S 9S 6S 10S"]
|
163
|
+
, expected = Just ["7S 8S 9S 6S 10S"]
|
164
|
+
}
|
165
|
+
, Case { description = "both hands have straight flush, tie goes to highest-ranked card"
|
166
|
+
, input = [ "4H 6H 7H 8H 5H"
|
167
|
+
, "5S 7S 8S 9S 6S"]
|
168
|
+
, expected = Just ["5S 7S 8S 9S 6S"]
|
169
|
+
}
|
170
|
+
, Case { description = "no winner if a hand is invalid"
|
171
|
+
, input = [ "2H 2S 2D 2C 10XXXXXXH" ]
|
172
|
+
, expected = Nothing
|
173
|
+
}
|
174
|
+
]
|