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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/TOPICS.txt +2 -2
- data/problem-specifications/exercises/zipper/description.md +1 -1
- data/tracks/dart/test/exercises_test.dart +9 -9
- data/tracks/delphi/exercises/circular-buffer/uCircularBufferExample.pas +3 -3
- data/tracks/delphi/exercises/circular-buffer/uCircularBufferTests.pas +160 -86
- data/tracks/delphi/exercises/phone-number/README.md +1 -1
- data/tracks/erlang/config.json +10 -0
- data/tracks/erlang/exercises/isogram/README.md +65 -0
- data/tracks/erlang/exercises/isogram/include/exercism.hrl +11 -0
- data/tracks/erlang/exercises/isogram/rebar.config +30 -0
- data/tracks/erlang/exercises/isogram/src/example.erl +16 -0
- data/tracks/erlang/exercises/isogram/src/isogram.app.src +9 -0
- data/tracks/erlang/exercises/isogram/src/isogram.erl +9 -0
- data/tracks/erlang/exercises/isogram/test/isogram_tests.erl +32 -0
- data/tracks/fsharp/exercises/binary-search/BinarySearch.fs +1 -1
- data/tracks/fsharp/exercises/binary-search/BinarySearchTest.fs +58 -30
- data/tracks/fsharp/exercises/binary-search/Example.fs +1 -1
- data/tracks/fsharp/exercises/poker/Example.fs +23 -20
- data/tracks/fsharp/exercises/poker/PokerTest.fs +135 -76
- data/tracks/fsharp/generators/Generators.fs +21 -0
- data/tracks/go/README.md +0 -15
- data/tracks/go/bin/run-generators +11 -0
- data/tracks/go/config.json +389 -277
- data/tracks/go/config/maintainers.json +2 -2
- data/tracks/go/docs/TESTS.md +0 -15
- data/tracks/go/exercises/accumulate/accumulate_test.go +0 -8
- data/tracks/go/exercises/accumulate/example.go +0 -2
- data/tracks/go/exercises/acronym/acronym.go +14 -2
- data/tracks/go/exercises/acronym/acronym_test.go +0 -8
- data/tracks/go/exercises/acronym/cases_test.go +2 -2
- data/tracks/go/exercises/acronym/example.go +0 -2
- data/tracks/go/exercises/all-your-base/all_your_base_test.go +0 -8
- data/tracks/go/exercises/all-your-base/example.go +0 -2
- data/tracks/go/exercises/allergies/allergies_test.go +0 -8
- data/tracks/go/exercises/allergies/example.go +0 -2
- data/tracks/go/exercises/anagram/.meta/gen.go +55 -0
- data/tracks/go/exercises/anagram/anagram_test.go +0 -130
- data/tracks/go/exercises/anagram/cases_test.go +164 -0
- data/tracks/go/exercises/anagram/example.go +0 -2
- data/tracks/go/exercises/atbash-cipher/atbash_cipher_test.go +0 -8
- data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/atbash-cipher/example.go +0 -2
- data/tracks/go/exercises/bank-account/bank_account_test.go +0 -8
- data/tracks/go/exercises/bank-account/example.go +0 -2
- data/tracks/go/exercises/beer-song/beer_test.go +0 -8
- data/tracks/go/exercises/beer-song/example.go +0 -2
- data/tracks/go/exercises/binary-search-tree/binary_search_tree_test.go +0 -8
- data/tracks/go/exercises/binary-search-tree/example.go +0 -2
- data/tracks/go/exercises/binary-search/binary_search_test.go +0 -8
- data/tracks/go/exercises/binary-search/example.go +0 -2
- data/tracks/go/exercises/binary/binary_test.go +0 -11
- data/tracks/go/exercises/binary/example.go +0 -2
- data/tracks/go/exercises/bob/bob.go +14 -0
- data/tracks/go/exercises/bob/bob_test.go +2 -10
- data/tracks/go/exercises/bob/cases_test.go +2 -2
- data/tracks/go/exercises/bob/example.go +12 -13
- data/tracks/go/exercises/book-store/README.md +92 -0
- data/tracks/go/exercises/book-store/book_store_test.go +91 -0
- data/tracks/go/exercises/book-store/example.go +52 -0
- data/tracks/go/exercises/bowling/bowling_test.go +0 -8
- data/tracks/go/exercises/bowling/cases_test.go +2 -2
- data/tracks/go/exercises/bowling/example.go +0 -2
- data/tracks/go/exercises/bracket-push/bracket_push_test.go +0 -8
- data/tracks/go/exercises/bracket-push/cases_test.go +2 -2
- data/tracks/go/exercises/bracket-push/example.go +0 -3
- data/tracks/go/exercises/change/cases_test.go +10 -3
- data/tracks/go/exercises/change/change_test.go +1 -9
- data/tracks/go/exercises/change/example.go +0 -2
- data/tracks/go/exercises/circular-buffer/circular_buffer_test.go +0 -8
- data/tracks/go/exercises/circular-buffer/example.go +0 -2
- data/tracks/go/exercises/clock/cases_test.go +2 -2
- data/tracks/go/exercises/clock/clock_test.go +2 -9
- data/tracks/go/exercises/clock/example.go +0 -2
- data/tracks/go/exercises/collatz-conjecture/README.md +51 -0
- data/tracks/go/exercises/collatz-conjecture/collatz_conjecture_test.go +77 -0
- data/tracks/go/exercises/collatz-conjecture/example.go +24 -0
- data/tracks/go/exercises/connect/cases_test.go +2 -2
- data/tracks/go/exercises/connect/connect_test.go +0 -8
- data/tracks/go/exercises/connect/example.go +0 -2
- data/tracks/go/exercises/crypto-square/crypto_square_test.go +0 -8
- data/tracks/go/exercises/crypto-square/example.go +0 -2
- data/tracks/go/exercises/custom-set/cases_test.go +2 -2
- data/tracks/go/exercises/custom-set/custom_set_test.go +0 -8
- data/tracks/go/exercises/custom-set/example.go +0 -2
- data/tracks/go/exercises/custom-set/example_slice.go +0 -2
- data/tracks/go/exercises/diamond/diamond_test.go +0 -8
- data/tracks/go/exercises/diamond/example.go +0 -2
- data/tracks/go/exercises/difference-of-squares/difference_of_squares_test.go +0 -8
- data/tracks/go/exercises/difference-of-squares/example.go +0 -2
- data/tracks/go/exercises/diffie-hellman/diffie_hellman_test.go +0 -8
- data/tracks/go/exercises/diffie-hellman/example.go +0 -2
- data/tracks/go/exercises/error-handling/error_handling_test.go +0 -7
- data/tracks/go/exercises/error-handling/example.go +0 -2
- data/tracks/go/exercises/etl/etl_test.go +0 -8
- data/tracks/go/exercises/etl/example.go +0 -2
- data/tracks/go/exercises/flatten-array/.meta/gen.go +52 -0
- data/tracks/go/exercises/flatten-array/README.md +35 -0
- data/tracks/go/exercises/flatten-array/cases_test.go +42 -0
- data/tracks/go/exercises/flatten-array/example.go +25 -0
- data/tracks/go/exercises/flatten-array/flatten_test.go +23 -0
- data/tracks/go/exercises/food-chain/example.go +0 -2
- data/tracks/go/exercises/food-chain/food_chain_test.go +0 -8
- data/tracks/go/exercises/forth/cases_test.go +2 -2
- data/tracks/go/exercises/forth/example.go +0 -2
- data/tracks/go/exercises/forth/forth_test.go +0 -8
- data/tracks/go/exercises/gigasecond/cases_test.go +2 -2
- data/tracks/go/exercises/gigasecond/example.go +0 -2
- data/tracks/go/exercises/gigasecond/gigasecond.go +13 -3
- data/tracks/go/exercises/gigasecond/gigasecond_test.go +0 -8
- data/tracks/go/exercises/grade-school/example.go +0 -2
- data/tracks/go/exercises/grade-school/grade_school_test.go +0 -8
- data/tracks/go/exercises/grains/example.go +0 -2
- data/tracks/go/exercises/grains/grains_test.go +0 -8
- data/tracks/go/exercises/hamming/.meta/hints.md +4 -0
- data/tracks/go/exercises/hamming/README.md +6 -0
- data/tracks/go/exercises/hamming/example.go +0 -2
- data/tracks/go/exercises/hamming/hamming.go +0 -2
- data/tracks/go/exercises/hamming/hamming_test.go +0 -8
- data/tracks/go/exercises/hello-world/hello_world.go +9 -1
- data/tracks/go/exercises/hexadecimal/example.go +0 -2
- data/tracks/go/exercises/hexadecimal/hexadecimal_test.go +0 -8
- data/tracks/go/exercises/house/example.go +0 -2
- data/tracks/go/exercises/house/house_test.go +0 -8
- data/tracks/go/exercises/isbn-verifier/README.md +60 -0
- data/tracks/go/exercises/isbn-verifier/example.go +57 -0
- data/tracks/go/exercises/isbn-verifier/isbn_verifier_test.go +35 -0
- data/tracks/go/exercises/isogram/example.go +0 -2
- data/tracks/go/exercises/isogram/isogram_test.go +0 -8
- data/tracks/go/exercises/kindergarten-garden/example.go +0 -2
- data/tracks/go/exercises/kindergarten-garden/kindergarten_garden_test.go +0 -8
- data/tracks/go/exercises/largest-series-product/cases_test.go +2 -2
- data/tracks/go/exercises/largest-series-product/example.go +0 -2
- data/tracks/go/exercises/largest-series-product/largest_series_product_test.go +0 -8
- data/tracks/go/exercises/leap/.meta/hints.md +14 -0
- data/tracks/go/exercises/leap/README.md +16 -0
- data/tracks/go/exercises/leap/cases_test.go +4 -4
- data/tracks/go/exercises/leap/example.go +0 -2
- data/tracks/go/exercises/leap/leap.go +11 -2
- data/tracks/go/exercises/leap/leap_test.go +0 -15
- data/tracks/go/exercises/ledger/example.go +0 -2
- data/tracks/go/exercises/ledger/ledger.go +0 -2
- data/tracks/go/exercises/ledger/ledger_test.go +0 -8
- data/tracks/go/exercises/luhn/cases_test.go +2 -2
- data/tracks/go/exercises/luhn/example.go +0 -2
- data/tracks/go/exercises/luhn/luhn_test.go +0 -8
- data/tracks/go/exercises/matrix/example.go +0 -2
- data/tracks/go/exercises/matrix/matrix_test.go +0 -8
- data/tracks/go/exercises/meetup/cases_test.go +2 -2
- data/tracks/go/exercises/meetup/example.go +0 -2
- data/tracks/go/exercises/meetup/meetup_test.go +0 -8
- data/tracks/go/exercises/minesweeper/example.go +0 -2
- data/tracks/go/exercises/minesweeper/minesweeper_test.go +0 -8
- data/tracks/go/exercises/nth-prime/example.go +0 -2
- data/tracks/go/exercises/nth-prime/nth_prime_test.go +0 -8
- data/tracks/go/exercises/nucleotide-count/example.go +0 -2
- data/tracks/go/exercises/nucleotide-count/nucleotide_count.go +26 -0
- data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +0 -8
- data/tracks/go/exercises/ocr-numbers/example.go +0 -2
- data/tracks/go/exercises/ocr-numbers/ocr_numbers_test.go +0 -8
- data/tracks/go/exercises/octal/example.go +0 -2
- data/tracks/go/exercises/octal/octal_test.go +0 -8
- data/tracks/go/exercises/paasio/example.go +0 -2
- data/tracks/go/exercises/paasio/paasio_test.go +0 -8
- data/tracks/go/exercises/palindrome-products/example.go +0 -2
- data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +0 -8
- data/tracks/go/exercises/pangram/example.go +0 -2
- data/tracks/go/exercises/pangram/pangram_test.go +2 -8
- data/tracks/go/exercises/parallel-letter-frequency/example.go +0 -2
- data/tracks/go/exercises/parallel-letter-frequency/parallel_letter_frequency_test.go +0 -8
- data/tracks/go/exercises/pascals-triangle/example.go +0 -2
- data/tracks/go/exercises/pascals-triangle/pascals_triangle_test.go +0 -8
- data/tracks/go/exercises/perfect-numbers/example.go +0 -2
- data/tracks/go/exercises/perfect-numbers/perfect_numbers_test.go +0 -8
- data/tracks/go/exercises/phone-number/cases_test.go +2 -2
- data/tracks/go/exercises/phone-number/example.go +0 -2
- data/tracks/go/exercises/phone-number/phone_number_test.go +0 -8
- data/tracks/go/exercises/pig-latin/example.go +0 -2
- data/tracks/go/exercises/pig-latin/pig_latin_test.go +0 -8
- data/tracks/go/exercises/poker/.meta/hints.md +7 -0
- data/tracks/go/exercises/poker/README.md +9 -0
- data/tracks/go/exercises/poker/cases_test.go +2 -2
- data/tracks/go/exercises/poker/example.go +0 -2
- data/tracks/go/exercises/poker/poker_test.go +0 -11
- data/tracks/go/exercises/pov/example.go +0 -2
- data/tracks/go/exercises/pov/pov_test.go +1 -9
- data/tracks/go/exercises/prime-factors/example.go +0 -2
- data/tracks/go/exercises/prime-factors/prime_factors_test.go +1 -9
- data/tracks/go/exercises/protein-translation/example.go +0 -2
- data/tracks/go/exercises/protein-translation/protein_translation_test.go +0 -8
- data/tracks/go/exercises/pythagorean-triplet/example.go +0 -2
- data/tracks/go/exercises/pythagorean-triplet/pythagorean_triplet_test.go +0 -8
- data/tracks/go/exercises/queen-attack/example.go +0 -2
- data/tracks/go/exercises/queen-attack/queen_attack_test.go +0 -8
- data/tracks/go/exercises/raindrops/.meta/hints.md +7 -0
- data/tracks/go/exercises/raindrops/cases_test.go +2 -2
- data/tracks/go/exercises/raindrops/example.go +0 -2
- data/tracks/go/exercises/raindrops/raindrops_test.go +0 -8
- data/tracks/go/exercises/react/example.go +0 -2
- data/tracks/go/exercises/react/react_test.go +0 -11
- data/tracks/go/exercises/rna-transcription/cases_test.go +2 -2
- data/tracks/go/exercises/rna-transcription/example.go +0 -2
- data/tracks/go/exercises/rna-transcription/rna_transcription.go +6 -0
- data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +0 -8
- data/tracks/go/exercises/robot-name/example.go +0 -2
- data/tracks/go/exercises/robot-name/robot_name_test.go +0 -8
- data/tracks/go/exercises/robot-simulator/example.go +0 -1
- data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +0 -8
- data/tracks/go/exercises/roman-numerals/cases_test.go +2 -2
- data/tracks/go/exercises/roman-numerals/example.go +0 -2
- data/tracks/go/exercises/roman-numerals/roman_numerals_test.go +0 -8
- data/tracks/go/exercises/rotational-cipher/README.md +56 -0
- data/tracks/go/exercises/rotational-cipher/example.go +20 -0
- data/tracks/go/exercises/rotational-cipher/rotational_cipher_test.go +86 -0
- data/tracks/go/exercises/run-length-encoding/README.md +31 -0
- data/tracks/go/exercises/run-length-encoding/example.go +53 -0
- data/tracks/go/exercises/run-length-encoding/run_length_encoding_test.go +59 -0
- data/tracks/go/exercises/saddle-points/example.go +0 -2
- data/tracks/go/exercises/saddle-points/saddle_points_test.go +0 -8
- data/tracks/go/exercises/say/.meta/gen.go +70 -0
- data/tracks/go/exercises/say/cases_test.go +88 -0
- data/tracks/go/exercises/say/example.go +12 -6
- data/tracks/go/exercises/say/say_test.go +17 -43
- data/tracks/go/exercises/scrabble-score/cases_test.go +2 -2
- data/tracks/go/exercises/scrabble-score/example.go +0 -3
- data/tracks/go/exercises/scrabble-score/scrabble_score_test.go +0 -8
- data/tracks/go/exercises/secret-handshake/cases_test.go +2 -2
- data/tracks/go/exercises/secret-handshake/example.go +0 -2
- data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +0 -8
- data/tracks/go/exercises/series/example.go +0 -2
- data/tracks/go/exercises/series/series_test.go +0 -8
- data/tracks/go/exercises/sieve/example.go +0 -2
- data/tracks/go/exercises/sieve/sieve_test.go +0 -8
- data/tracks/go/exercises/simple-cipher/example.go +0 -2
- data/tracks/go/exercises/simple-cipher/simple_cipher_test.go +0 -8
- data/tracks/go/exercises/space-age/.meta/gen.go +56 -0
- data/tracks/go/exercises/space-age/README.md +42 -0
- data/tracks/go/exercises/space-age/cases_test.go +61 -0
- data/tracks/go/exercises/space-age/example.go +36 -0
- data/tracks/go/exercises/space-age/space_age_test.go +22 -0
- data/tracks/go/exercises/spiral-matrix/README.md +48 -0
- data/tracks/go/exercises/spiral-matrix/example.go +93 -0
- data/tracks/go/exercises/spiral-matrix/spiral_matrix_test.go +71 -0
- data/tracks/go/exercises/strain/example.go +0 -2
- data/tracks/go/exercises/strain/strain_test.go +0 -8
- data/tracks/go/exercises/sublist/.meta/gen.go +56 -0
- data/tracks/go/exercises/sublist/README.md +39 -0
- data/tracks/go/exercises/sublist/cases_test.go +115 -0
- data/tracks/go/exercises/sublist/example.go +49 -0
- data/tracks/go/exercises/sublist/sublist_test.go +22 -0
- data/tracks/go/exercises/sum-of-multiples/cases_test.go +4 -3
- data/tracks/go/exercises/sum-of-multiples/example.go +0 -2
- data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +0 -8
- data/tracks/go/exercises/tournament/example.go +0 -2
- data/tracks/go/exercises/tournament/tournament_test.go +0 -11
- data/tracks/go/exercises/transpose/cases_test.go +2 -2
- data/tracks/go/exercises/transpose/example.go +0 -2
- data/tracks/go/exercises/transpose/transpose_test.go +0 -8
- data/tracks/go/exercises/tree-building/example.go +0 -2
- data/tracks/go/exercises/tree-building/tree_building.go +0 -2
- data/tracks/go/exercises/tree-building/tree_test.go +0 -11
- data/tracks/go/exercises/triangle/.meta/hints.md +10 -0
- data/tracks/go/exercises/triangle/example.go +0 -2
- data/tracks/go/exercises/triangle/triangle.go +21 -9
- data/tracks/go/exercises/triangle/triangle_test.go +0 -8
- data/tracks/go/exercises/trinary/example.go +0 -2
- data/tracks/go/exercises/trinary/trinary_test.go +0 -8
- data/tracks/go/exercises/twelve-days/example.go +0 -2
- data/tracks/go/exercises/twelve-days/twelve_days_test.go +0 -8
- data/tracks/go/exercises/two-fer/two_fer.go +2 -2
- data/tracks/go/exercises/variable-length-quantity/cases_test.go +2 -2
- data/tracks/go/exercises/variable-length-quantity/example.go +0 -2
- data/tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go +0 -8
- data/tracks/go/exercises/word-count/cases_test.go +2 -2
- data/tracks/go/exercises/word-count/example.go +0 -2
- data/tracks/go/exercises/word-count/word_count_test.go +4 -7
- data/tracks/go/exercises/word-search/.meta/gen.go +96 -0
- data/tracks/go/exercises/word-search/cases_test.go +154 -0
- data/tracks/go/exercises/word-search/example.go +0 -2
- data/tracks/go/exercises/word-search/word_search_test.go +16 -52
- data/tracks/go/exercises/wordy/example.go +0 -2
- data/tracks/go/exercises/wordy/wordy_test.go +0 -8
- data/tracks/go/gen/gen.go +4 -1
- data/tracks/java/exercises/phone-number/README.md +1 -1
- data/tracks/kotlin/exercises/phone-number/README.md +1 -1
- data/tracks/perl6/config.json +50 -0
- data/tracks/perl6/exercises/etl/ETL.pm6 +6 -0
- data/tracks/perl6/exercises/etl/Example.pm6 +7 -0
- data/tracks/perl6/exercises/etl/README.md +72 -0
- data/tracks/perl6/exercises/etl/etl.t +139 -0
- data/tracks/perl6/exercises/etl/example.yaml +35 -0
- data/tracks/perl6/exercises/hamming/Example.pm6 +6 -0
- data/tracks/perl6/exercises/hamming/Hamming.pm6 +4 -0
- data/tracks/perl6/exercises/hamming/README.md +61 -0
- data/tracks/perl6/exercises/hamming/example.yaml +22 -0
- data/tracks/perl6/exercises/hamming/hamming.t +175 -0
- data/tracks/perl6/exercises/meetup/Example.pm6 +37 -0
- data/tracks/perl6/exercises/meetup/Meetup.pm6 +4 -0
- data/tracks/perl6/exercises/meetup/README.md +48 -0
- data/tracks/perl6/exercises/meetup/example.yaml +48 -0
- data/tracks/perl6/exercises/meetup/meetup.t +907 -0
- data/tracks/perl6/exercises/pangram/Example.pm6 +5 -0
- data/tracks/perl6/exercises/pangram/Pangram.pm6 +4 -0
- data/tracks/perl6/exercises/pangram/README.md +34 -0
- data/tracks/perl6/exercises/pangram/example.yaml +17 -0
- data/tracks/perl6/exercises/pangram/pangram.t +125 -0
- data/tracks/perl6/exercises/phone-number/README.md +1 -1
- data/tracks/perl6/exercises/two-fer/Example.pm6 +14 -0
- data/tracks/perl6/exercises/two-fer/README.md +38 -0
- data/tracks/perl6/exercises/two-fer/TwoFer.pm6 +15 -0
- data/tracks/perl6/exercises/two-fer/example.yaml +43 -0
- data/tracks/perl6/exercises/two-fer/two-fer.t +82 -0
- data/tracks/php/config.json +13 -0
- data/tracks/php/exercises/rail-fence-cipher/README.md +80 -0
- data/tracks/php/exercises/rail-fence-cipher/example.php +61 -0
- data/tracks/php/exercises/rail-fence-cipher/rail-fence-cipher_test.php +76 -0
- data/tracks/purescript/.travis.yml +1 -1
- data/tracks/python/config.json +13 -0
- data/tracks/python/exercises/alphametics/example.py +42 -29
- data/tracks/python/exercises/crypto-square/crypto_square_test.py +20 -13
- data/tracks/python/exercises/crypto-square/example.py +1 -1
- data/tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py +15 -2
- data/tracks/python/exercises/phone-number/README.md +2 -1
- data/tracks/python/exercises/pov/README.md +53 -0
- data/tracks/python/exercises/pov/example.py +70 -0
- data/tracks/python/exercises/pov/pov.py +25 -0
- data/tracks/python/exercises/pov/pov_test.py +200 -0
- data/tracks/python/test/check-exercises.py +11 -1
- data/tracks/ruby/exercises/meetup/.meta/.version +1 -0
- data/tracks/ruby/exercises/meetup/.meta/generator/meetup_case.rb +11 -0
- data/tracks/ruby/exercises/meetup/.meta/solutions/meetup.rb +5 -0
- data/tracks/ruby/exercises/meetup/meetup_test.rb +48 -4
- metadata +90 -8
- data/tracks/go/exercises/accumulate/accumulate.go +0 -5
- data/tracks/go/exercises/clock/clock.go +0 -19
- data/tracks/go/exercises/pangram/pangram.go +0 -5
- data/tracks/go/exercises/raindrops/raindrops.go +0 -8
- data/tracks/go/exercises/twelve-days/HINTS.md +0 -2
- 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
|
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`
|
data/tracks/erlang/config.json
CHANGED
@@ -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,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,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 ``
|
10
|
-
let
|
11
|
-
|
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 ``
|
15
|
-
let
|
16
|
-
|
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 ``
|
20
|
-
let
|
21
|
-
|
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 ``
|
25
|
-
let
|
26
|
-
|
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 ``
|
30
|
-
let
|
31
|
-
|
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 ``
|
35
|
-
let
|
36
|
-
|
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 ``
|
40
|
-
let
|
41
|
-
|
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 ``
|
45
|
-
let
|
46
|
-
|
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 ``
|
50
|
-
let
|
51
|
-
|
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
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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) =
|
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)::
|
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)::
|
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 ``
|
10
|
-
let
|
11
|
-
|
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 ``
|
15
|
-
let
|
16
|
-
let
|
17
|
-
bestHands
|
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 ``
|
21
|
-
let
|
22
|
-
let
|
23
|
-
bestHands
|
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 ``
|
27
|
-
let
|
28
|
-
let
|
29
|
-
bestHands
|
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 ``
|
33
|
-
let
|
34
|
-
let
|
35
|
-
bestHands
|
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 ``
|
39
|
-
let
|
40
|
-
let
|
41
|
-
bestHands
|
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 ``
|
45
|
-
let
|
46
|
-
let
|
47
|
-
bestHands
|
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
|
51
|
-
let
|
52
|
-
let
|
53
|
-
bestHands
|
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 ``
|
57
|
-
let
|
58
|
-
let
|
59
|
-
bestHands
|
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
|
-
|
62
|
-
|
63
|
-
|
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 ``
|
67
|
-
let
|
68
|
-
let
|
69
|
-
bestHands
|
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 ``
|
73
|
-
let
|
74
|
-
let
|
75
|
-
bestHands
|
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 ``
|
79
|
-
let
|
80
|
-
let
|
81
|
-
bestHands
|
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 ``
|
85
|
-
let
|
86
|
-
let
|
87
|
-
bestHands
|
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 ``
|
91
|
-
let
|
92
|
-
let
|
93
|
-
bestHands
|
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 ``
|
97
|
-
let
|
98
|
-
let
|
99
|
-
bestHands
|
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 ``
|
103
|
-
let
|
104
|
-
let
|
105
|
-
bestHands
|
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 ``
|
109
|
-
let
|
110
|
-
let
|
111
|
-
bestHands
|
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 ``
|
115
|
-
let
|
116
|
-
let
|
117
|
-
|
118
|
-
|
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
|
+
|