poker_hands 0.0.4 → 0.0.5
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/lib/deck/hand.rb +5 -4
- data/lib/deck/rank_selector.rb +12 -11
- data/lib/poker_hands.rb +2 -2
- data/lib/rank/flush.rb +2 -1
- data/lib/rank/four_of_a_kind.rb +2 -1
- data/lib/rank/full_house.rb +2 -1
- data/lib/rank/{rank.rb → hand_rank.rb} +2 -2
- data/lib/rank/high_card.rb +2 -1
- data/lib/rank/pair.rb +2 -1
- data/lib/rank/straight.rb +2 -1
- data/lib/rank/straight_flush.rb +2 -1
- data/lib/rank/three_of_a_kind.rb +2 -1
- data/lib/rank/two_pairs.rb +2 -1
- data/{poker-hands.gemspec → poker_hands.gemspec} +2 -2
- data/spec/{hand_spec.rb → deck/hand_spec.rb} +19 -20
- data/spec/{table_spec.rb → poker_hands_spec.rb} +49 -50
- data/spec/spec_helper.rb +338 -39
- data/spec/support/test_helpers.rb +186 -186
- metadata +5 -5
data/spec/spec_helper.rb
CHANGED
@@ -1,43 +1,342 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec
|
5
|
-
require '
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
-
# examples within a transaction, remove the following line or assign false
|
26
|
-
# instead of true.
|
27
|
-
config.use_transactional_fixtures = true
|
28
|
-
|
29
|
-
# If true, the base class of anonymous controllers will be inferred
|
30
|
-
# automatically. This will be the default behavior in future versions of
|
31
|
-
# rspec-rails.
|
32
|
-
config.infer_base_class_for_anonymous_controllers = false
|
33
|
-
|
34
|
-
# Run specs in random order to surface order dependencies. If you find an
|
35
|
-
# order dependency and want to debug it, you can fix the order by providing
|
36
|
-
# the seed, which is printed after each run.
|
37
|
-
# --seed 1234
|
38
|
-
config.order = "random"
|
39
|
-
|
40
|
-
config.include TestHelpers
|
2
|
+
#ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
#require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec'
|
5
|
+
require 'deck/card'
|
6
|
+
require 'deck/cards'
|
7
|
+
require 'deck/deck'
|
8
|
+
require 'deck/hand'
|
9
|
+
require 'deck/rank_selector'
|
10
|
+
require 'rank/flush'
|
11
|
+
require 'rank/four_of_a_kind'
|
12
|
+
require 'rank/full_house'
|
13
|
+
require 'rank/high_card'
|
14
|
+
require 'rank/pair'
|
15
|
+
require 'rank/hand_rank'
|
16
|
+
require 'rank/straight'
|
17
|
+
require 'rank/straight_flush'
|
18
|
+
require 'rank/three_of_a_kind'
|
19
|
+
require 'rank/two_pairs'
|
20
|
+
require 'poker_hands'
|
21
|
+
require 'net/http'
|
22
|
+
require 'active_support'
|
23
|
+
require 'action_controller'
|
41
24
|
|
42
25
|
|
26
|
+
def high_card
|
27
|
+
[Deck::Card.new("2", "D"),
|
28
|
+
Deck::Card.new("5", "H"),
|
29
|
+
Deck::Card.new("4", "D"),
|
30
|
+
Deck::Card.new("7", "S"),
|
31
|
+
Deck::Card.new("8", "D")]
|
32
|
+
end
|
33
|
+
|
34
|
+
def high_card_same_highest_1
|
35
|
+
[Deck::Card.new("2", "D"),
|
36
|
+
Deck::Card.new("5", "H"),
|
37
|
+
Deck::Card.new("4", "D"),
|
38
|
+
Deck::Card.new("7", "D"),
|
39
|
+
Deck::Card.new("8", "D")]
|
40
|
+
end
|
41
|
+
|
42
|
+
def high_card_same_highest_2
|
43
|
+
[Deck::Card.new("2", "D"),
|
44
|
+
Deck::Card.new("5", "H"),
|
45
|
+
Deck::Card.new("4", "D"),
|
46
|
+
Deck::Card.new("6", "D"),
|
47
|
+
Deck::Card.new("8", "D")]
|
48
|
+
end
|
49
|
+
|
50
|
+
def hand_high_card_same_highest
|
51
|
+
[Deck::Hand.new(high_card_same_highest_1),
|
52
|
+
Deck::Hand.new(high_card_same_highest_2)]
|
53
|
+
end
|
54
|
+
|
55
|
+
def pair
|
56
|
+
[Deck::Card.new("2", "D"),
|
57
|
+
Deck::Card.new("2", "H"),
|
58
|
+
Deck::Card.new("4", "D"),
|
59
|
+
Deck::Card.new("3", "D"),
|
60
|
+
Deck::Card.new("8", "D")]
|
61
|
+
end
|
62
|
+
|
63
|
+
def same_pair_1
|
64
|
+
[Deck::Card.new("2", "D"),
|
65
|
+
Deck::Card.new("2", "H"),
|
66
|
+
Deck::Card.new("3", "S"),
|
67
|
+
Deck::Card.new("5", "D"),
|
68
|
+
Deck::Card.new("8", "D")]
|
69
|
+
end
|
70
|
+
|
71
|
+
def same_pair_2
|
72
|
+
[Deck::Card.new("2", "D"),
|
73
|
+
Deck::Card.new("2", "H"),
|
74
|
+
Deck::Card.new("3", "S"),
|
75
|
+
Deck::Card.new("4", "D"),
|
76
|
+
Deck::Card.new("7", "D")]
|
77
|
+
end
|
78
|
+
|
79
|
+
def hand_same_pair
|
80
|
+
[Deck::Hand.new(same_pair_1),
|
81
|
+
Deck::Hand.new(same_pair_2)]
|
82
|
+
end
|
83
|
+
|
84
|
+
def two_pairs
|
85
|
+
[Deck::Card.new("2", "D"),
|
86
|
+
Deck::Card.new("2", "H"),
|
87
|
+
Deck::Card.new("9", "H"),
|
88
|
+
Deck::Card.new("9", "S"),
|
89
|
+
Deck::Card.new("8", "D")]
|
90
|
+
end
|
91
|
+
|
92
|
+
def same_two_pair_1
|
93
|
+
[Deck::Card.new("2", "D"),
|
94
|
+
Deck::Card.new("2", "H"),
|
95
|
+
Deck::Card.new("9", "H"),
|
96
|
+
Deck::Card.new("9", "S"),
|
97
|
+
Deck::Card.new("8", "D")]
|
98
|
+
end
|
99
|
+
|
100
|
+
def same_two_pair_2
|
101
|
+
[Deck::Card.new("2", "D"),
|
102
|
+
Deck::Card.new("2", "H"),
|
103
|
+
Deck::Card.new("9", "H"),
|
104
|
+
Deck::Card.new("9", "S"),
|
105
|
+
Deck::Card.new("6", "D")]
|
106
|
+
end
|
107
|
+
|
108
|
+
def hand_same_two_pairs
|
109
|
+
[Deck::Hand.new(same_pair_1),
|
110
|
+
Deck::Hand.new(same_pair_2)]
|
111
|
+
end
|
112
|
+
|
113
|
+
def three_of_a_kind
|
114
|
+
[Deck::Card.new("2", "D"),
|
115
|
+
Deck::Card.new("2", "H"),
|
116
|
+
Deck::Card.new("2", "H"),
|
117
|
+
Deck::Card.new("9", "S"),
|
118
|
+
Deck::Card.new("8", "D")]
|
119
|
+
end
|
120
|
+
|
121
|
+
def same_three_of_a_kind_1
|
122
|
+
[Deck::Card.new("2", "D"),
|
123
|
+
Deck::Card.new("2", "H"),
|
124
|
+
Deck::Card.new("2", "H"),
|
125
|
+
Deck::Card.new("6", "S"),
|
126
|
+
Deck::Card.new("8", "D")]
|
127
|
+
end
|
128
|
+
|
129
|
+
def same_three_of_a_kind_2
|
130
|
+
[Deck::Card.new("2", "D"),
|
131
|
+
Deck::Card.new("2", "H"),
|
132
|
+
Deck::Card.new("2", "H"),
|
133
|
+
Deck::Card.new("7", "S"),
|
134
|
+
Deck::Card.new("8", "D")]
|
135
|
+
end
|
136
|
+
|
137
|
+
def hand_some_three_of_a_kind
|
138
|
+
[Deck::Hand.new(same_three_of_a_kind_1),
|
139
|
+
Deck::Hand.new(same_three_of_a_kind_2)]
|
140
|
+
end
|
141
|
+
|
142
|
+
def straight
|
143
|
+
[Deck::Card.new("2", "D"),
|
144
|
+
Deck::Card.new("3", "H"),
|
145
|
+
Deck::Card.new("4", "H"),
|
146
|
+
Deck::Card.new("5", "S"),
|
147
|
+
Deck::Card.new("6", "D")]
|
148
|
+
end
|
149
|
+
|
150
|
+
def same_stright_1
|
151
|
+
[Deck::Card.new("2", "D"),
|
152
|
+
Deck::Card.new("3", "H"),
|
153
|
+
Deck::Card.new("4", "H"),
|
154
|
+
Deck::Card.new("5", "S"),
|
155
|
+
Deck::Card.new("6", "D")]
|
156
|
+
end
|
157
|
+
|
158
|
+
def same_stright_2
|
159
|
+
[Deck::Card.new("2", "D"),
|
160
|
+
Deck::Card.new("3", "H"),
|
161
|
+
Deck::Card.new("4", "H"),
|
162
|
+
Deck::Card.new("5", "S"),
|
163
|
+
Deck::Card.new("8", "D")]
|
164
|
+
end
|
165
|
+
|
166
|
+
def hand_same_straight
|
167
|
+
[Deck::Hand.new(same_stright_1),
|
168
|
+
Deck::Hand.new(same_stright_2)]
|
169
|
+
end
|
170
|
+
|
171
|
+
def flush
|
172
|
+
[Deck::Card.new("2", "D"),
|
173
|
+
Deck::Card.new("3", "D"),
|
174
|
+
Deck::Card.new("8", "D"),
|
175
|
+
Deck::Card.new("5", "D"),
|
176
|
+
Deck::Card.new("6", "D")]
|
177
|
+
end
|
178
|
+
|
179
|
+
def flush_1
|
180
|
+
[Deck::Card.new("2", "D"),
|
181
|
+
Deck::Card.new("3", "D"),
|
182
|
+
Deck::Card.new("8", "D"),
|
183
|
+
Deck::Card.new("5", "D"),
|
184
|
+
Deck::Card.new("6", "D")]
|
185
|
+
end
|
186
|
+
|
187
|
+
def flush_2
|
188
|
+
[Deck::Card.new("2", "D"),
|
189
|
+
Deck::Card.new("3", "D"),
|
190
|
+
Deck::Card.new("4", "D"),
|
191
|
+
Deck::Card.new("5", "D"),
|
192
|
+
Deck::Card.new("6", "D")]
|
193
|
+
end
|
194
|
+
|
195
|
+
def hand_two_flush
|
196
|
+
[Deck::Hand.new(same_stright_1),
|
197
|
+
Deck::Hand.new(same_stright_2)]
|
198
|
+
end
|
199
|
+
|
200
|
+
def full_house
|
201
|
+
[Deck::Card.new("4", "D"),
|
202
|
+
Deck::Card.new("4", "D"),
|
203
|
+
Deck::Card.new("4", "H"),
|
204
|
+
Deck::Card.new("5", "S"),
|
205
|
+
Deck::Card.new("5", "D")]
|
206
|
+
end
|
207
|
+
|
208
|
+
def same_full_house_1
|
209
|
+
[Deck::Card.new("4", "D"),
|
210
|
+
Deck::Card.new("4", "D"),
|
211
|
+
Deck::Card.new("4", "H"),
|
212
|
+
Deck::Card.new("3", "S"),
|
213
|
+
Deck::Card.new("3", "D")]
|
214
|
+
end
|
215
|
+
|
216
|
+
def same_full_house_2
|
217
|
+
[Deck::Card.new("5", "D"),
|
218
|
+
Deck::Card.new("5", "D"),
|
219
|
+
Deck::Card.new("5", "H"),
|
220
|
+
Deck::Card.new("2", "S"),
|
221
|
+
Deck::Card.new("2", "D")]
|
222
|
+
end
|
223
|
+
|
224
|
+
def hand_same_full_house
|
225
|
+
[Deck::Hand.new(same_full_house_1),
|
226
|
+
Deck::Hand.new(same_full_house_2)]
|
227
|
+
end
|
228
|
+
|
229
|
+
def four_of_a_kind
|
230
|
+
[Deck::Card.new("4", "D"),
|
231
|
+
Deck::Card.new("4", "D"),
|
232
|
+
Deck::Card.new("4", "H"),
|
233
|
+
Deck::Card.new("4", "S"),
|
234
|
+
Deck::Card.new("5", "D")]
|
235
|
+
end
|
236
|
+
|
237
|
+
def same_four_of_a_kind
|
238
|
+
[Deck::Card.new("5", "D"),
|
239
|
+
Deck::Card.new("5", "D"),
|
240
|
+
Deck::Card.new("5", "H"),
|
241
|
+
Deck::Card.new("5", "S"),
|
242
|
+
Deck::Card.new("6", "D")]
|
243
|
+
end
|
244
|
+
|
245
|
+
def hand_same_four_of_a_kind
|
246
|
+
[Deck::Hand.new(four_of_a_kind),
|
247
|
+
Deck::Hand.new(same_four_of_a_kind)]
|
248
|
+
end
|
249
|
+
|
250
|
+
def straight_flush
|
251
|
+
[Deck::Card.new("2", "D"),
|
252
|
+
Deck::Card.new("3", "D"),
|
253
|
+
Deck::Card.new("4", "D"),
|
254
|
+
Deck::Card.new("5", "D"),
|
255
|
+
Deck::Card.new("6", "D")]
|
256
|
+
end
|
257
|
+
|
258
|
+
def straight_flush_2
|
259
|
+
[Deck::Card.new("2", "S"),
|
260
|
+
Deck::Card.new("3", "S"),
|
261
|
+
Deck::Card.new("4", "S"),
|
262
|
+
Deck::Card.new("6", "S"),
|
263
|
+
Deck::Card.new("8", "S")]
|
264
|
+
end
|
265
|
+
|
266
|
+
def hand_two_straight_flush
|
267
|
+
[Deck::Hand.new(straight_flush),
|
268
|
+
Deck::Hand.new(straight_flush_2)]
|
269
|
+
end
|
270
|
+
|
271
|
+
def hand_straight_flush
|
272
|
+
[Deck::Hand.new(straight_flush),
|
273
|
+
Deck::Hand.new(four_of_a_kind),
|
274
|
+
Deck::Hand.new(full_house),
|
275
|
+
Deck::Hand.new(flush),
|
276
|
+
Deck::Hand.new(straight),
|
277
|
+
Deck::Hand.new(three_of_a_kind),
|
278
|
+
Deck::Hand.new(two_pairs),
|
279
|
+
Deck::Hand.new(pair)]
|
280
|
+
end
|
281
|
+
|
282
|
+
def hand_four_of_a_kind
|
283
|
+
[Deck::Hand.new(four_of_a_kind),
|
284
|
+
Deck::Hand.new(full_house),
|
285
|
+
Deck::Hand.new(flush),
|
286
|
+
Deck::Hand.new(straight),
|
287
|
+
Deck::Hand.new(three_of_a_kind),
|
288
|
+
Deck::Hand.new(two_pairs),
|
289
|
+
Deck::Hand.new(pair)]
|
290
|
+
end
|
291
|
+
|
292
|
+
def hand_full_house
|
293
|
+
[Deck::Hand.new(full_house),
|
294
|
+
Deck::Hand.new(flush),
|
295
|
+
Deck::Hand.new(straight),
|
296
|
+
Deck::Hand.new(three_of_a_kind),
|
297
|
+
Deck::Hand.new(two_pairs),
|
298
|
+
Deck::Hand.new(pair)]
|
299
|
+
end
|
300
|
+
|
301
|
+
def hand_flush
|
302
|
+
[Deck::Hand.new(flush),
|
303
|
+
Deck::Hand.new(straight),
|
304
|
+
Deck::Hand.new(three_of_a_kind),
|
305
|
+
Deck::Hand.new(two_pairs),
|
306
|
+
Deck::Hand.new(pair)]
|
307
|
+
end
|
308
|
+
|
309
|
+
def hand_flush
|
310
|
+
[Deck::Hand.new(flush),
|
311
|
+
Deck::Hand.new(straight),
|
312
|
+
Deck::Hand.new(three_of_a_kind),
|
313
|
+
Deck::Hand.new(two_pairs),
|
314
|
+
Deck::Hand.new(pair)]
|
315
|
+
end
|
316
|
+
|
317
|
+
def hand_straight
|
318
|
+
[Deck::Hand.new(straight),
|
319
|
+
Deck::Hand.new(three_of_a_kind),
|
320
|
+
Deck::Hand.new(two_pairs),
|
321
|
+
Deck::Hand.new(pair)]
|
322
|
+
end
|
323
|
+
|
324
|
+
def hand_three_of_a_kind
|
325
|
+
[Deck::Hand.new(three_of_a_kind),
|
326
|
+
Deck::Hand.new(two_pairs),
|
327
|
+
Deck::Hand.new(pair)]
|
328
|
+
end
|
329
|
+
|
330
|
+
def hand_two_pairs
|
331
|
+
[Deck::Hand.new(two_pairs),
|
332
|
+
Deck::Hand.new(pair)]
|
333
|
+
end
|
334
|
+
|
335
|
+
def hand_pair
|
336
|
+
[Deck::Hand.new(pair),
|
337
|
+
Deck::Hand.new(high_card)]
|
338
|
+
end
|
339
|
+
|
340
|
+
def hand_high_card
|
341
|
+
[Deck::Hand.new(high_card)]
|
43
342
|
end
|
@@ -1,320 +1,320 @@
|
|
1
1
|
module TestHelpers
|
2
2
|
def high_card
|
3
|
-
[
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
[Deck::Card.new("2", "D"),
|
4
|
+
Deck::Card.new("5", "H"),
|
5
|
+
Deck::Card.new("4", "D"),
|
6
|
+
Deck::Card.new("7", "S"),
|
7
|
+
Deck::Card.new("8", "D")]
|
8
8
|
end
|
9
9
|
|
10
10
|
def high_card_same_highest_1
|
11
|
-
[
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
[Deck::Card.new("2", "D"),
|
12
|
+
Deck::Card.new("5", "H"),
|
13
|
+
Deck::Card.new("4", "D"),
|
14
|
+
Deck::Card.new("7", "D"),
|
15
|
+
Deck::Card.new("8", "D")]
|
16
16
|
end
|
17
17
|
|
18
18
|
def high_card_same_highest_2
|
19
|
-
[
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
[Deck::Card.new("2", "D"),
|
20
|
+
Deck::Card.new("5", "H"),
|
21
|
+
Deck::Card.new("4", "D"),
|
22
|
+
Deck::Card.new("6", "D"),
|
23
|
+
Deck::Card.new("8", "D")]
|
24
24
|
end
|
25
25
|
|
26
26
|
def hand_high_card_same_highest
|
27
|
-
[Hand.new(high_card_same_highest_1),
|
28
|
-
Hand.new(high_card_same_highest_2)]
|
27
|
+
[Deck::Hand.new(high_card_same_highest_1),
|
28
|
+
Deck::Hand.new(high_card_same_highest_2)]
|
29
29
|
end
|
30
30
|
|
31
31
|
def pair
|
32
|
-
[
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
[Deck::Card.new("2", "D"),
|
33
|
+
Deck::Card.new("2", "H"),
|
34
|
+
Deck::Card.new("4", "D"),
|
35
|
+
Deck::Card.new("3", "D"),
|
36
|
+
Deck::Card.new("8", "D")]
|
37
37
|
end
|
38
38
|
|
39
39
|
def same_pair_1
|
40
|
-
[
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
[Deck::Card.new("2", "D"),
|
41
|
+
Deck::Card.new("2", "H"),
|
42
|
+
Deck::Card.new("3", "S"),
|
43
|
+
Deck::Card.new("5", "D"),
|
44
|
+
Deck::Card.new("8", "D")]
|
45
45
|
end
|
46
46
|
|
47
47
|
def same_pair_2
|
48
|
-
[
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
[Deck::Card.new("2", "D"),
|
49
|
+
Deck::Card.new("2", "H"),
|
50
|
+
Deck::Card.new("3", "S"),
|
51
|
+
Deck::Card.new("4", "D"),
|
52
|
+
Deck::Card.new("7", "D")]
|
53
53
|
end
|
54
54
|
|
55
55
|
def hand_same_pair
|
56
|
-
[Hand.new(same_pair_1),
|
57
|
-
Hand.new(same_pair_2)]
|
56
|
+
[Deck::Hand.new(same_pair_1),
|
57
|
+
Deck::Hand.new(same_pair_2)]
|
58
58
|
end
|
59
59
|
|
60
60
|
def two_pairs
|
61
|
-
[
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
[Deck::Card.new("2", "D"),
|
62
|
+
Deck::Card.new("2", "H"),
|
63
|
+
Deck::Card.new("9", "H"),
|
64
|
+
Deck::Card.new("9", "S"),
|
65
|
+
Deck::Card.new("8", "D")]
|
66
66
|
end
|
67
67
|
|
68
68
|
def same_two_pair_1
|
69
|
-
[
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
[Deck::Card.new("2", "D"),
|
70
|
+
Deck::Card.new("2", "H"),
|
71
|
+
Deck::Card.new("9", "H"),
|
72
|
+
Deck::Card.new("9", "S"),
|
73
|
+
Deck::Card.new("8", "D")]
|
74
74
|
end
|
75
75
|
|
76
76
|
def same_two_pair_2
|
77
|
-
[
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
[Deck::Card.new("2", "D"),
|
78
|
+
Deck::Card.new("2", "H"),
|
79
|
+
Deck::Card.new("9", "H"),
|
80
|
+
Deck::Card.new("9", "S"),
|
81
|
+
Deck::Card.new("6", "D")]
|
82
82
|
end
|
83
83
|
|
84
84
|
def hand_same_two_pairs
|
85
|
-
[Hand.new(same_pair_1),
|
86
|
-
Hand.new(same_pair_2)]
|
85
|
+
[Deck::Hand.new(same_pair_1),
|
86
|
+
Deck::Hand.new(same_pair_2)]
|
87
87
|
end
|
88
88
|
|
89
89
|
def three_of_a_kind
|
90
|
-
[
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
[Deck::Card.new("2", "D"),
|
91
|
+
Deck::Card.new("2", "H"),
|
92
|
+
Deck::Card.new("2", "H"),
|
93
|
+
Deck::Card.new("9", "S"),
|
94
|
+
Deck::Card.new("8", "D")]
|
95
95
|
end
|
96
96
|
|
97
97
|
def same_three_of_a_kind_1
|
98
|
-
[
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
[Deck::Card.new("2", "D"),
|
99
|
+
Deck::Card.new("2", "H"),
|
100
|
+
Deck::Card.new("2", "H"),
|
101
|
+
Deck::Card.new("6", "S"),
|
102
|
+
Deck::Card.new("8", "D")]
|
103
103
|
end
|
104
104
|
|
105
105
|
def same_three_of_a_kind_2
|
106
|
-
[
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
106
|
+
[Deck::Card.new("2", "D"),
|
107
|
+
Deck::Card.new("2", "H"),
|
108
|
+
Deck::Card.new("2", "H"),
|
109
|
+
Deck::Card.new("7", "S"),
|
110
|
+
Deck::Card.new("8", "D")]
|
111
111
|
end
|
112
112
|
|
113
113
|
def hand_some_three_of_a_kind
|
114
|
-
[Hand.new(same_three_of_a_kind_1),
|
115
|
-
Hand.new(same_three_of_a_kind_2)]
|
114
|
+
[Deck::Hand.new(same_three_of_a_kind_1),
|
115
|
+
Deck::Hand.new(same_three_of_a_kind_2)]
|
116
116
|
end
|
117
117
|
|
118
118
|
def straight
|
119
|
-
[
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
119
|
+
[Deck::Card.new("2", "D"),
|
120
|
+
Deck::Card.new("3", "H"),
|
121
|
+
Deck::Card.new("4", "H"),
|
122
|
+
Deck::Card.new("5", "S"),
|
123
|
+
Deck::Card.new("6", "D")]
|
124
124
|
end
|
125
125
|
|
126
126
|
def same_stright_1
|
127
|
-
[
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
127
|
+
[Deck::Card.new("2", "D"),
|
128
|
+
Deck::Card.new("3", "H"),
|
129
|
+
Deck::Card.new("4", "H"),
|
130
|
+
Deck::Card.new("5", "S"),
|
131
|
+
Deck::Card.new("6", "D")]
|
132
132
|
end
|
133
133
|
|
134
134
|
def same_stright_2
|
135
|
-
[
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
[Deck::Card.new("2", "D"),
|
136
|
+
Deck::Card.new("3", "H"),
|
137
|
+
Deck::Card.new("4", "H"),
|
138
|
+
Deck::Card.new("5", "S"),
|
139
|
+
Deck::Card.new("8", "D")]
|
140
140
|
end
|
141
141
|
|
142
142
|
def hand_same_straight
|
143
|
-
[Hand.new(same_stright_1),
|
144
|
-
Hand.new(same_stright_2)]
|
143
|
+
[Deck::Hand.new(same_stright_1),
|
144
|
+
Deck::Hand.new(same_stright_2)]
|
145
145
|
end
|
146
146
|
|
147
147
|
def flush
|
148
|
-
[
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
148
|
+
[Deck::Card.new("2", "D"),
|
149
|
+
Deck::Card.new("3", "D"),
|
150
|
+
Deck::Card.new("8", "D"),
|
151
|
+
Deck::Card.new("5", "D"),
|
152
|
+
Deck::Card.new("6", "D")]
|
153
153
|
end
|
154
154
|
|
155
155
|
def flush_1
|
156
|
-
[
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
156
|
+
[Deck::Card.new("2", "D"),
|
157
|
+
Deck::Card.new("3", "D"),
|
158
|
+
Deck::Card.new("8", "D"),
|
159
|
+
Deck::Card.new("5", "D"),
|
160
|
+
Deck::Card.new("6", "D")]
|
161
161
|
end
|
162
162
|
|
163
163
|
def flush_2
|
164
|
-
[
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
164
|
+
[Deck::Card.new("2", "D"),
|
165
|
+
Deck::Card.new("3", "D"),
|
166
|
+
Deck::Card.new("4", "D"),
|
167
|
+
Deck::Card.new("5", "D"),
|
168
|
+
Deck::Card.new("6", "D")]
|
169
169
|
end
|
170
170
|
|
171
171
|
def hand_two_flush
|
172
|
-
[Hand.new(same_stright_1),
|
173
|
-
Hand.new(same_stright_2)]
|
172
|
+
[Deck::Hand.new(same_stright_1),
|
173
|
+
Deck::Hand.new(same_stright_2)]
|
174
174
|
end
|
175
175
|
|
176
176
|
def full_house
|
177
|
-
[
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
177
|
+
[Deck::Card.new("4", "D"),
|
178
|
+
Deck::Card.new("4", "D"),
|
179
|
+
Deck::Card.new("4", "H"),
|
180
|
+
Deck::Card.new("5", "S"),
|
181
|
+
Deck::Card.new("5", "D")]
|
182
182
|
end
|
183
183
|
|
184
184
|
def same_full_house_1
|
185
|
-
[
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
185
|
+
[Deck::Card.new("4", "D"),
|
186
|
+
Deck::Card.new("4", "D"),
|
187
|
+
Deck::Card.new("4", "H"),
|
188
|
+
Deck::Card.new("3", "S"),
|
189
|
+
Deck::Card.new("3", "D")]
|
190
190
|
end
|
191
191
|
|
192
192
|
def same_full_house_2
|
193
|
-
[
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
193
|
+
[Deck::Card.new("5", "D"),
|
194
|
+
Deck::Card.new("5", "D"),
|
195
|
+
Deck::Card.new("5", "H"),
|
196
|
+
Deck::Card.new("2", "S"),
|
197
|
+
Deck::Card.new("2", "D")]
|
198
198
|
end
|
199
199
|
|
200
200
|
def hand_same_full_house
|
201
|
-
[Hand.new(same_full_house_1),
|
202
|
-
Hand.new(same_full_house_2)]
|
201
|
+
[Deck::Hand.new(same_full_house_1),
|
202
|
+
Deck::Hand.new(same_full_house_2)]
|
203
203
|
end
|
204
204
|
|
205
205
|
def four_of_a_kind
|
206
|
-
[
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
206
|
+
[Deck::Card.new("4", "D"),
|
207
|
+
Deck::Card.new("4", "D"),
|
208
|
+
Deck::Card.new("4", "H"),
|
209
|
+
Deck::Card.new("4", "S"),
|
210
|
+
Deck::Card.new("5", "D")]
|
211
211
|
end
|
212
212
|
|
213
213
|
def same_four_of_a_kind
|
214
|
-
[
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
214
|
+
[Deck::Card.new("5", "D"),
|
215
|
+
Deck::Card.new("5", "D"),
|
216
|
+
Deck::Card.new("5", "H"),
|
217
|
+
Deck::Card.new("5", "S"),
|
218
|
+
Deck::Card.new("6", "D")]
|
219
219
|
end
|
220
220
|
|
221
221
|
def hand_same_four_of_a_kind
|
222
|
-
[Hand.new(four_of_a_kind),
|
223
|
-
Hand.new(same_four_of_a_kind)]
|
222
|
+
[Deck::Hand.new(four_of_a_kind),
|
223
|
+
Deck::Hand.new(same_four_of_a_kind)]
|
224
224
|
end
|
225
225
|
|
226
226
|
def straight_flush
|
227
|
-
[
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
227
|
+
[Deck::Card.new("2", "D"),
|
228
|
+
Deck::Card.new("3", "D"),
|
229
|
+
Deck::Card.new("4", "D"),
|
230
|
+
Deck::Card.new("5", "D"),
|
231
|
+
Deck::Card.new("6", "D")]
|
232
232
|
end
|
233
233
|
|
234
234
|
def straight_flush_2
|
235
|
-
[
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
235
|
+
[Deck::Card.new("2", "S"),
|
236
|
+
Deck::Card.new("3", "S"),
|
237
|
+
Deck::Card.new("4", "S"),
|
238
|
+
Deck::Card.new("6", "S"),
|
239
|
+
Deck::Card.new("8", "S")]
|
240
240
|
end
|
241
241
|
|
242
242
|
def hand_two_straight_flush
|
243
|
-
[Hand.new(straight_flush),
|
244
|
-
Hand.new(straight_flush_2)]
|
243
|
+
[Deck::Hand.new(straight_flush),
|
244
|
+
Deck::Hand.new(straight_flush_2)]
|
245
245
|
end
|
246
246
|
|
247
247
|
def hand_straight_flush
|
248
|
-
[Hand.new(straight_flush),
|
249
|
-
Hand.new(four_of_a_kind),
|
250
|
-
Hand.new(full_house),
|
251
|
-
Hand.new(flush),
|
252
|
-
Hand.new(straight),
|
253
|
-
Hand.new(three_of_a_kind),
|
254
|
-
Hand.new(two_pairs),
|
255
|
-
Hand.new(pair)]
|
248
|
+
[Deck::Hand.new(straight_flush),
|
249
|
+
Deck::Hand.new(four_of_a_kind),
|
250
|
+
Deck::Hand.new(full_house),
|
251
|
+
Deck::Hand.new(flush),
|
252
|
+
Deck::Hand.new(straight),
|
253
|
+
Deck::Hand.new(three_of_a_kind),
|
254
|
+
Deck::Hand.new(two_pairs),
|
255
|
+
Deck::Hand.new(pair)]
|
256
256
|
end
|
257
257
|
|
258
258
|
def hand_four_of_a_kind
|
259
|
-
[Hand.new(four_of_a_kind),
|
260
|
-
Hand.new(full_house),
|
261
|
-
Hand.new(flush),
|
262
|
-
Hand.new(straight),
|
263
|
-
Hand.new(three_of_a_kind),
|
264
|
-
Hand.new(two_pairs),
|
265
|
-
Hand.new(pair)]
|
259
|
+
[Deck::Hand.new(four_of_a_kind),
|
260
|
+
Deck::Hand.new(full_house),
|
261
|
+
Deck::Hand.new(flush),
|
262
|
+
Deck::Hand.new(straight),
|
263
|
+
Deck::Hand.new(three_of_a_kind),
|
264
|
+
Deck::Hand.new(two_pairs),
|
265
|
+
Deck::Hand.new(pair)]
|
266
266
|
end
|
267
267
|
|
268
268
|
def hand_full_house
|
269
|
-
[Hand.new(full_house),
|
270
|
-
Hand.new(flush),
|
271
|
-
Hand.new(straight),
|
272
|
-
Hand.new(three_of_a_kind),
|
273
|
-
Hand.new(two_pairs),
|
274
|
-
Hand.new(pair)]
|
269
|
+
[Deck::Hand.new(full_house),
|
270
|
+
Deck::Hand.new(flush),
|
271
|
+
Deck::Hand.new(straight),
|
272
|
+
Deck::Hand.new(three_of_a_kind),
|
273
|
+
Deck::Hand.new(two_pairs),
|
274
|
+
Deck::Hand.new(pair)]
|
275
275
|
end
|
276
276
|
|
277
277
|
def hand_flush
|
278
|
-
[Hand.new(flush),
|
279
|
-
Hand.new(straight),
|
280
|
-
Hand.new(three_of_a_kind),
|
281
|
-
Hand.new(two_pairs),
|
282
|
-
Hand.new(pair)]
|
278
|
+
[Deck::Hand.new(flush),
|
279
|
+
Deck::Hand.new(straight),
|
280
|
+
Deck::Hand.new(three_of_a_kind),
|
281
|
+
Deck::Hand.new(two_pairs),
|
282
|
+
Deck::Hand.new(pair)]
|
283
283
|
end
|
284
284
|
|
285
285
|
def hand_flush
|
286
|
-
[Hand.new(flush),
|
287
|
-
Hand.new(straight),
|
288
|
-
Hand.new(three_of_a_kind),
|
289
|
-
Hand.new(two_pairs),
|
290
|
-
Hand.new(pair)]
|
286
|
+
[Deck::Hand.new(flush),
|
287
|
+
Deck::Hand.new(straight),
|
288
|
+
Deck::Hand.new(three_of_a_kind),
|
289
|
+
Deck::Hand.new(two_pairs),
|
290
|
+
Deck::Hand.new(pair)]
|
291
291
|
end
|
292
292
|
|
293
293
|
def hand_straight
|
294
|
-
[Hand.new(straight),
|
295
|
-
Hand.new(three_of_a_kind),
|
296
|
-
Hand.new(two_pairs),
|
297
|
-
Hand.new(pair)]
|
294
|
+
[Deck::Hand.new(straight),
|
295
|
+
Deck::Hand.new(three_of_a_kind),
|
296
|
+
Deck::Hand.new(two_pairs),
|
297
|
+
Deck::Hand.new(pair)]
|
298
298
|
end
|
299
299
|
|
300
300
|
def hand_three_of_a_kind
|
301
|
-
[Hand.new(three_of_a_kind),
|
302
|
-
Hand.new(two_pairs),
|
303
|
-
Hand.new(pair)]
|
301
|
+
[Deck::Hand.new(three_of_a_kind),
|
302
|
+
Deck::Hand.new(two_pairs),
|
303
|
+
Deck::Hand.new(pair)]
|
304
304
|
end
|
305
305
|
|
306
306
|
def hand_two_pairs
|
307
|
-
[Hand.new(two_pairs),
|
308
|
-
Hand.new(pair)]
|
307
|
+
[Deck::Hand.new(two_pairs),
|
308
|
+
Deck::Hand.new(pair)]
|
309
309
|
end
|
310
310
|
|
311
311
|
def hand_pair
|
312
|
-
[Hand.new(pair),
|
313
|
-
Hand.new(high_card)]
|
312
|
+
[Deck::Hand.new(pair),
|
313
|
+
Deck::Hand.new(high_card)]
|
314
314
|
end
|
315
315
|
|
316
316
|
def hand_high_card
|
317
|
-
[Hand.new(high_card)]
|
317
|
+
[Deck::Hand.new(high_card)]
|
318
318
|
end
|
319
319
|
|
320
320
|
|