rora 0.0.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +59 -15
- data/Rakefile +0 -1
- data/lib/rora.rb +4 -0
- data/lib/rora/{hands.csv → 5-card-hands.csv} +0 -0
- data/lib/rora/7-card-hands.csv +323765 -0
- data/lib/rora/cards.csv +52 -0
- data/lib/rora/flushes.csv +40 -0
- data/lib/rora/model/board.rb +2 -2
- data/lib/rora/model/card.rb +17 -14
- data/lib/rora/model/deck.rb +23 -0
- data/lib/rora/model/equity.rb +18 -0
- data/lib/rora/model/hand.rb +12 -27
- data/lib/rora/model/hand_type.rb +1 -1
- data/lib/rora/model/pot.rb +1 -1
- data/lib/rora/model/rank.rb +34 -16
- data/lib/rora/model/starting_hand.rb +22 -18
- data/lib/rora/model/suit.rb +26 -11
- data/lib/rora/model/table.rb +0 -3
- data/lib/rora/repository/card_repository.rb +17 -0
- data/lib/rora/repository/hand_repository.rb +60 -20
- data/lib/rora/repository/starting_hand_repository.rb +2 -1
- data/lib/rora/utils/equity_calculator.rb +47 -0
- data/lib/rora/utils/hand_ranking_generator.rb +135 -0
- data/test/rora/model/board_test.rb +19 -20
- data/test/rora/model/card_test.rb +45 -15
- data/test/rora/model/deck_test.rb +24 -0
- data/test/rora/model/hand_test.rb +5 -29
- data/test/rora/model/hand_type_test.rb +3 -3
- data/test/rora/model/pot_test.rb +2 -2
- data/test/rora/model/rank_test.rb +10 -2
- data/test/rora/model/seat_test.rb +1 -1
- data/test/rora/model/starting_hand_test.rb +8 -16
- data/test/rora/model/suit_test.rb +3 -3
- data/test/rora/model/table_test.rb +8 -8
- data/test/rora/repository/hand_repository_test.rb +14 -16
- data/test/rora/utils/equity_calculator_test.rb +53 -0
- data/test/rora_test.rb +1 -1
- metadata +13 -6
- data/test/rora/model/game_test.rb +0 -23
@@ -1,11 +1,45 @@
|
|
1
1
|
require File.expand_path("../../rora_test", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class CardTest < ActiveSupport::TestCase
|
4
|
-
|
5
4
|
def setup
|
6
5
|
@card = Card.new("AS")
|
7
6
|
end
|
8
7
|
|
8
|
+
test "should be able to sort cards by rank" do
|
9
|
+
cards = Card.to_cards "2H,4D,QS,JC,7D,TC,AH,KD,6H,9D,3S,5C,8C"
|
10
|
+
cards.sort!
|
11
|
+
|
12
|
+
assert_equal "Ace of Hearts", cards[0].value
|
13
|
+
assert_equal "King of Diamonds", cards[1].value
|
14
|
+
assert_equal "Queen of Spades", cards[2].value
|
15
|
+
assert_equal "Jack of Clubs", cards[3].value
|
16
|
+
assert_equal "Ten of Clubs", cards[4].value
|
17
|
+
assert_equal "Nine of Diamonds", cards[5].value
|
18
|
+
assert_equal "Eight of Clubs", cards[6].value
|
19
|
+
assert_equal "Seven of Diamonds", cards[7].value
|
20
|
+
assert_equal "Six of Hearts", cards[8].value
|
21
|
+
assert_equal "Five of Clubs", cards[9].value
|
22
|
+
assert_equal "Four of Diamonds", cards[10].value
|
23
|
+
assert_equal "Three of Spades", cards[11].value
|
24
|
+
assert_equal "Two of Hearts", cards[12].value
|
25
|
+
end
|
26
|
+
|
27
|
+
test "should be able to sort cards by suit" do
|
28
|
+
cards = Card.to_cards "AS,AH,AD,AC"
|
29
|
+
cards.sort!
|
30
|
+
|
31
|
+
assert_equal "Ace of Hearts", cards[0].value
|
32
|
+
assert_equal "Ace of Diamonds", cards[1].value
|
33
|
+
assert_equal "Ace of Spades", cards[2].value
|
34
|
+
assert_equal "Ace of Clubs", cards[3].value
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
test "should be able to identify duplicate cards" do
|
39
|
+
cards = Card.to_cards("AS,AS,KS,KS")
|
40
|
+
assert_equal 2, cards.uniq.size
|
41
|
+
end
|
42
|
+
|
9
43
|
test "should be able to create a card with the specified rank and suit" do
|
10
44
|
card = Card.new(Rank::ACE, Suit::SPADE)
|
11
45
|
assert_equal card.rank, Rank::ACE
|
@@ -18,37 +52,33 @@ class CardTest < ActiveSupport::TestCase
|
|
18
52
|
assert_equal card.suit, Suit::SPADE
|
19
53
|
end
|
20
54
|
|
55
|
+
test "should have an id" do
|
56
|
+
assert_equal 103, @card.uid
|
57
|
+
end
|
58
|
+
|
21
59
|
test "should raise an exception when attempting to create a card with an invalid string value" do
|
22
|
-
|
60
|
+
assert_raise_message "A is an invalid card sequence", ArgumentError do
|
23
61
|
card = Card.new("A")
|
24
62
|
end
|
25
|
-
|
63
|
+
assert_raise_message "ASK is an invalid card sequence", ArgumentError do
|
26
64
|
card = Card.new("ASK")
|
27
65
|
end
|
28
66
|
end
|
29
67
|
|
30
|
-
test "a card should have an id" do
|
31
|
-
assert_equal 1927, @card.id
|
32
|
-
end
|
33
|
-
|
34
|
-
test "a card id should be equal to the product of the card suit id and rank id" do
|
35
|
-
assert_equal @card.id, (Rank::ACE.id * Suit::SPADE.id)
|
36
|
-
end
|
37
|
-
|
38
68
|
test "a card should have a key" do
|
39
69
|
assert_equal "AS", @card.key
|
40
70
|
end
|
41
71
|
|
42
|
-
test "a card key should be equal to the concatenation of the
|
72
|
+
test "a card key should be equal to the concatenation of the cards' suit key and rank key" do
|
43
73
|
assert_equal "AS", (Rank::ACE.key + Suit::SPADE.key)
|
44
74
|
end
|
45
75
|
|
46
|
-
test "a card should have a
|
47
|
-
assert_equal "Ace of Spades", Card.new("AS").
|
76
|
+
test "a card should have a value" do
|
77
|
+
assert_equal "Ace of Spades", Card.new("AS").value
|
48
78
|
end
|
49
79
|
|
50
80
|
test "should generate a readable string representation" do
|
51
|
-
assert_equal "
|
81
|
+
assert_equal "Ace of Spades", Card.new("AS").to_s
|
52
82
|
end
|
53
83
|
|
54
84
|
test "should convert an arbitrarily long string of characters into an array of cards" do
|
@@ -111,4 +111,28 @@ class DeckTest < ActiveSupport::TestCase
|
|
111
111
|
assert_equal true, @deck.contains_any?("AH,KH,QH,JH,KS")
|
112
112
|
end
|
113
113
|
|
114
|
+
test "should remove all spades from the deck" do
|
115
|
+
@deck.remove_all(Suit::SPADE)
|
116
|
+
assert_equal 39, @deck.cards.size
|
117
|
+
assert_equal 0, @deck.count_cards_with_suit(Suit::SPADE)
|
118
|
+
end
|
119
|
+
|
120
|
+
test "should remove all kings from the deck" do
|
121
|
+
@deck.remove_all(Rank::KING)
|
122
|
+
assert_equal 48, @deck.cards.size
|
123
|
+
assert_equal 0, @deck.count_cards_with_rank(Rank::KING)
|
124
|
+
end
|
125
|
+
|
126
|
+
test "should retain all spades in the deck" do
|
127
|
+
@deck.retain_all(Suit::SPADE)
|
128
|
+
assert_equal 13, @deck.cards.size
|
129
|
+
assert_equal 13, @deck.count_cards_with_suit(Suit::SPADE)
|
130
|
+
end
|
131
|
+
|
132
|
+
test "should retain all kings in the deck" do
|
133
|
+
@deck.retain_all(Rank::KING)
|
134
|
+
assert_equal 4, @deck.cards.size
|
135
|
+
assert_equal 4, @deck.count_cards_with_rank(Rank::KING)
|
136
|
+
end
|
137
|
+
|
114
138
|
end
|
@@ -7,45 +7,25 @@ class HandTest < ActiveSupport::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
test "should raise an error when a hand is not created with 5 cards" do
|
10
|
-
|
10
|
+
assert_raise_message "Exactly 5 cards are required to create a hand, 2 provided", ArgumentError do
|
11
11
|
Hand.new [Card.new("AS"), Card.new("KS")]
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
test "should raise an error when a hand is not created with 10 characters" do
|
16
|
-
|
16
|
+
assert_raise_message "Exactly 5 cards are required to create a hand, 8 provided", ArgumentError do
|
17
17
|
Hand.new "ASKSQSJS"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
test "should raise an error when creating a hand with duplicate cards" do
|
22
|
-
|
22
|
+
assert_raise_message "The hand contains duplicate cards", ArgumentError do
|
23
23
|
Hand.new "AS KS JS AS KS"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
test "the hand should have
|
28
|
-
assert_equal
|
29
|
-
end
|
30
|
-
|
31
|
-
test "the hand id should be equal to the product of each card id contained in the hand" do
|
32
|
-
assert_equal @hand.id, (Card.new("AS").id * Card.new("KS").id * Card.new("QS").id * Card.new("JS").id * Card.new("TS").id)
|
33
|
-
end
|
34
|
-
|
35
|
-
test "the hand should have a hash key" do
|
36
|
-
assert_equal 2101589603, @hand.hash_key
|
37
|
-
end
|
38
|
-
|
39
|
-
test "the hash key should be equal to the product of each card rank id in the hand times" do
|
40
|
-
assert_equal Hand.new("ASACAHJSTS").hash_key, (Card.new("AS").rank.id * Card.new("AC").rank.id * Card.new("AH").rank.id * Card.new("JS").rank.id * Card.new("TS").rank.id)
|
41
|
-
end
|
42
|
-
|
43
|
-
test "the hash key should be equal to the product of each card rank id in the hand times 67 when the hand is a flush" do
|
44
|
-
assert_equal @hand.hash_key, (Card.new("AS").rank.id * Card.new("KS").rank.id * Card.new("QS").rank.id * Card.new("JS").rank.id * Card.new("TS").rank.id * 67)
|
45
|
-
end
|
46
|
-
|
47
|
-
test "the hand should have a value" do
|
48
|
-
assert_equal "AS,KS,QS,JS,TS", @hand.value
|
27
|
+
test "the hand should have a hand key" do
|
28
|
+
assert_equal "ASKSQSJSTS", @hand.key
|
49
29
|
end
|
50
30
|
|
51
31
|
test "the hand should be a flush" do
|
@@ -60,10 +40,6 @@ class HandTest < ActiveSupport::TestCase
|
|
60
40
|
assert_equal 1, @hand.score
|
61
41
|
end
|
62
42
|
|
63
|
-
test "the hand should have a probability" do
|
64
|
-
assert_equal 0.0015, @hand.probability
|
65
|
-
end
|
66
|
-
|
67
43
|
test "the hand should have a name" do
|
68
44
|
assert_equal "Royal Flush", @hand.name
|
69
45
|
end
|
@@ -15,19 +15,19 @@ class HandTypeTest < ActiveSupport::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
test "should raise an error when performing a lookup with an invalid key" do
|
18
|
-
|
18
|
+
assert_raise_message "No hand type exists for key 'L'", ArgumentError do
|
19
19
|
HandType.get "L"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
test "should raise an error when performing a lookup with an empty key" do
|
24
|
-
|
24
|
+
assert_raise_message "No hand type exists for key ''", ArgumentError do
|
25
25
|
HandType.get ""
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
test "should raise an error when performing a lookup with a nil key" do
|
30
|
-
|
30
|
+
assert_raise_message "can't convert nil into String", TypeError do
|
31
31
|
HandType.get nil
|
32
32
|
end
|
33
33
|
end
|
data/test/rora/model/pot_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path("../../rora_test", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class PotTest < ActiveSupport::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
def setup
|
6
6
|
@pot = Pot.new
|
7
7
|
end
|
@@ -11,7 +11,7 @@ class PotTest < ActiveSupport::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
test "should raise an error when attempting to add a negative value to the pot" do
|
14
|
-
|
14
|
+
assert_raise_message "Can only add positive values", ArgumentError do
|
15
15
|
@pot.add -0.50
|
16
16
|
end
|
17
17
|
end
|
@@ -27,7 +27,7 @@ class RankTest < ActiveSupport::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
test "should raise an error when performing a lookup with an empty key" do
|
30
|
-
assert_raise_message
|
30
|
+
assert_raise_message "No rank exists for key ''", ArgumentError do
|
31
31
|
Rank.get ""
|
32
32
|
end
|
33
33
|
end
|
@@ -39,7 +39,15 @@ class RankTest < ActiveSupport::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
test "should generate a readable string representation" do
|
42
|
-
assert_equal "
|
42
|
+
assert_equal "Ace", Rank::ACE.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
test "two identical ranks should be equal" do
|
46
|
+
assert_equal true, Rank::ACE == Rank::ACE
|
47
|
+
end
|
48
|
+
|
49
|
+
test "two different ranks should not be equal" do
|
50
|
+
assert_equal false, Rank::EIGHT == Rank::FIVE
|
43
51
|
end
|
44
52
|
|
45
53
|
end
|
@@ -7,7 +7,7 @@ class SeatTest < ActiveSupport::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
test "should raise an error when a seat is created with a seat number less than 1" do
|
10
|
-
|
10
|
+
assert_raise_message "Must create a seat number with a value of 1 or greater", ArgumentError do
|
11
11
|
Seat.new 0
|
12
12
|
end
|
13
13
|
end
|
@@ -2,24 +2,20 @@ require File.expand_path("../../rora_test", File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
class StartingHandTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
def setup
|
6
|
-
@hand = StartingHand.new "ASKS"
|
7
|
-
end
|
8
|
-
|
9
5
|
test "should raise an error when a starting hand is not created with 2 cards" do
|
10
|
-
|
6
|
+
assert_raise_message "Exactly 2 cards are required to create a starting hand, 3 provided", ArgumentError do
|
11
7
|
StartingHand.new [Card.new("AS"), Card.new("KS"), Card.new("QS")]
|
12
8
|
end
|
13
9
|
end
|
14
10
|
|
15
11
|
test "should raise an error when a starting hand is not created with 4 characters" do
|
16
|
-
|
12
|
+
assert_raise_message "Exactly 2 cards are required to create a starting hand, 4 provided", ArgumentError do
|
17
13
|
StartingHand.new "ASKSQSJS"
|
18
14
|
end
|
19
15
|
end
|
20
16
|
|
21
17
|
test "should raise an error when creating a starting hand with duplicate cards" do
|
22
|
-
|
18
|
+
assert_raise_message "The starting hand contains duplicate cards", ArgumentError do
|
23
19
|
StartingHand.new "ASAS"
|
24
20
|
end
|
25
21
|
end
|
@@ -33,7 +29,7 @@ class StartingHandTest < ActiveSupport::TestCase
|
|
33
29
|
end
|
34
30
|
|
35
31
|
test "the starting hand should have a value" do
|
36
|
-
assert_equal "
|
32
|
+
assert_equal "Ace of Spades, King of Spades", StartingHand.new("ASKS").value
|
37
33
|
end
|
38
34
|
|
39
35
|
test "the starting hand should have a short value" do
|
@@ -48,16 +44,12 @@ class StartingHandTest < ActiveSupport::TestCase
|
|
48
44
|
assert_equal false, StartingHand.new("ASKH").pocket_pair?
|
49
45
|
end
|
50
46
|
|
51
|
-
test "the starting hand should have
|
52
|
-
assert_equal
|
53
|
-
end
|
54
|
-
|
55
|
-
test "the starting hand should have a key that is equal to the product of the card rank ids when the starting hand is unsuited" do
|
56
|
-
assert_equal StartingHand.new("ASKH").key, (Card.new("AS").rank.id * Card.new("KH").rank.id)
|
47
|
+
test "the starting hand should have a key that is composed of the card keys" do
|
48
|
+
assert_equal "ASKH", StartingHand.new("ASKH").key
|
57
49
|
end
|
58
50
|
|
59
|
-
test "the starting hand should have a
|
60
|
-
assert_equal
|
51
|
+
test "the starting hand key should have a consistent ordering" do
|
52
|
+
assert_equal "ASKH", StartingHand.new("KHAS").key
|
61
53
|
end
|
62
54
|
|
63
55
|
test "should return all starting hands" do
|
@@ -21,13 +21,13 @@ class SuitTest < ActiveSupport::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
test "should raise an error when performing a lookup with an invalid key" do
|
24
|
-
|
24
|
+
assert_raise_message "No suit exists for key 'L'", ArgumentError do
|
25
25
|
Suit.get("L")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
test "should raise an error when performing a lookup with an empty key" do
|
30
|
-
|
30
|
+
assert_raise_message "No suit exists for key ''", ArgumentError do
|
31
31
|
Suit.get("")
|
32
32
|
end
|
33
33
|
end
|
@@ -39,7 +39,7 @@ class SuitTest < ActiveSupport::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
test "should generate a readable string representation" do
|
42
|
-
assert_equal "
|
42
|
+
assert_equal "Spades", Suit::SPADE.to_s
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
@@ -39,7 +39,7 @@ class TableTest < ActiveSupport::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
test "should raise an error when a table is created with less than two seats" do
|
42
|
-
|
42
|
+
assert_raise_message "A table must have at least two seats", ArgumentError do
|
43
43
|
Table.new 1
|
44
44
|
end
|
45
45
|
end
|
@@ -56,19 +56,19 @@ class TableTest < ActiveSupport::TestCase
|
|
56
56
|
|
57
57
|
test "should raise an error when attempting to seat a player at a seat that is already taken" do
|
58
58
|
@table.add "player1", 4
|
59
|
-
|
59
|
+
assert_raise_message "Seat number 4 is already taken by another player", ArgumentError do
|
60
60
|
@table.add "player2", 4
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
test "should raise an error when attempting to seat a player at a seat that does not exist" do
|
65
|
-
|
65
|
+
assert_raise_message "Seat number 11 does not exist at this table", ArgumentError do
|
66
66
|
@table.add "player", 11
|
67
67
|
end
|
68
|
-
|
68
|
+
assert_raise_message "Seat number 0 does not exist at this table", ArgumentError do
|
69
69
|
@table.add "player", 0
|
70
70
|
end
|
71
|
-
|
71
|
+
assert_raise_message "Seat number -3 does not exist at this table", ArgumentError do
|
72
72
|
@table.add "player", -3
|
73
73
|
end
|
74
74
|
end
|
@@ -100,7 +100,7 @@ class TableTest < ActiveSupport::TestCase
|
|
100
100
|
|
101
101
|
test "should raise an error when attempting to seat a player at a full table" do
|
102
102
|
(1..9).each {|x| @table.add("player#{x}")}
|
103
|
-
|
103
|
+
assert_raise_message "Cannot add player, the table is full", RuntimeError do
|
104
104
|
@table.add "player 10"
|
105
105
|
end
|
106
106
|
end
|
@@ -135,7 +135,7 @@ class TableTest < ActiveSupport::TestCase
|
|
135
135
|
|
136
136
|
test "should raise an error when trying to find the next player to act when there are less than two players at the table" do
|
137
137
|
@table.add("Player 1", 1)
|
138
|
-
|
138
|
+
assert_raise_message "There are fewer than two players at the table", RuntimeError do
|
139
139
|
@table.the_seat_after @table.seat(8)
|
140
140
|
end
|
141
141
|
end
|
@@ -160,7 +160,7 @@ class TableTest < ActiveSupport::TestCase
|
|
160
160
|
|
161
161
|
test "should raise an error when trying to find the previous player to act when there are less than two players at the table" do
|
162
162
|
@table.add("Player 1", 1)
|
163
|
-
|
163
|
+
assert_raise_message "There are fewer than two players at the table", RuntimeError do
|
164
164
|
@table.the_seat_before @table.seat(8)
|
165
165
|
end
|
166
166
|
end
|
@@ -1,26 +1,24 @@
|
|
1
1
|
require File.expand_path("../../rora_test", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class HandRepositoyTest < ActiveSupport::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
def setup
|
6
6
|
@repository = HandRepository.instance
|
7
7
|
end
|
8
8
|
|
9
|
-
test "should be able to
|
10
|
-
result = @repository.
|
9
|
+
test "should be able to evaluate a 5 card poker hand" do
|
10
|
+
result = @repository.evaluate_5_card_hand Card.to_cards("AS,KS,QS,JS,TS")
|
11
11
|
assert_equal 1, result[0]
|
12
12
|
assert_equal "SF", result[1]
|
13
13
|
assert_equal "Royal Flush", result[2]
|
14
|
-
assert_equal 0.0015, result[3]
|
15
14
|
end
|
16
15
|
|
17
|
-
test "should
|
18
|
-
|
19
|
-
|
20
|
-
end
|
16
|
+
test "should be able to evaluate a 7 card poker hand" do
|
17
|
+
result = @repository.evaluate_7_card_hand Card.to_cards("KS,3H,2S,AS,AC,AH,AD")
|
18
|
+
assert_equal 11, result[0]
|
21
19
|
end
|
22
20
|
|
23
|
-
test "should return
|
21
|
+
test "should return all 2,598,960 poker hands" do
|
24
22
|
assert_equal 2598960, @repository.list.size
|
25
23
|
end
|
26
24
|
|
@@ -51,33 +49,33 @@ class HandRepositoyTest < ActiveSupport::TestCase
|
|
51
49
|
end
|
52
50
|
|
53
51
|
test "should return every distinct poker hand" do
|
54
|
-
assert_equal 7462, @repository.
|
52
|
+
assert_equal 7462, @repository.list_and_group_by_hand_score.size
|
55
53
|
end
|
56
54
|
|
57
55
|
test "should return every distinct poker hand that can be made with the given starting hand" do
|
58
|
-
assert_equal 620, @repository.
|
56
|
+
assert_equal 620, @repository.list_and_group_by_hand_score(:starting_hand => StartingHand.new("AS,KS")).size
|
59
57
|
end
|
60
58
|
|
61
59
|
test "should return every distinct poker hand that can be made with the given starting hand and deck" do
|
62
60
|
deck = Deck.new.remove "AH,KH,AD,KD"
|
63
|
-
assert_equal 594, @repository.
|
61
|
+
assert_equal 594, @repository.list_and_group_by_hand_score(:starting_hand => StartingHand.new("AS,KS"), :deck => deck).size
|
64
62
|
end
|
65
63
|
|
66
64
|
test "should return every distinct poker hand that can be made with the given starting hand, flop, turn and river" do
|
67
|
-
assert_equal 21, @repository.
|
65
|
+
assert_equal 21, @repository.list_and_group_by_hand_score(:starting_hand => StartingHand.new("AS,KS"), :board => Board.new("QS,JS,TS,4H,3H")).size
|
68
66
|
end
|
69
67
|
|
70
68
|
test "should return every distinct poker hand that can be made with the given starting hand, flop and turn" do
|
71
|
-
assert_equal 212, @repository.
|
69
|
+
assert_equal 212, @repository.list_and_group_by_hand_score(:starting_hand => StartingHand.new("AS,KS"), :board => Board.new("QS,JS,TS,4H")).size
|
72
70
|
end
|
73
71
|
|
74
72
|
test "should return every distinct poker hand that can be made with the given starting hand and flop" do
|
75
|
-
assert_equal 1042, @repository.
|
73
|
+
assert_equal 1042, @repository.list_and_group_by_hand_score(:starting_hand => StartingHand.new("AS,KS"), :board => Board.new("QS,JS,TS")).size
|
76
74
|
end
|
77
75
|
|
78
76
|
test "should return every distinct poker hand that can be made with the given starting hand, flop and deck" do
|
79
77
|
deck = Deck.new.remove "AH,KH,AD,KD"
|
80
|
-
assert_equal 1030, @repository.
|
78
|
+
assert_equal 1030, @repository.list_and_group_by_hand_score(:starting_hand => StartingHand.new("AS,KS"), :board => Board.new("QS,JS,TS"), :deck => deck).size
|
81
79
|
end
|
82
80
|
|
83
81
|
end
|