poker_hands 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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/rails'
5
- require 'rspec/autorun'
6
-
7
- # Requires supporting ruby files with custom matchers and macros, etc,
8
- # in spec/support/ and its subdirectories.
9
- #Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
10
- Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
11
-
12
- RSpec.configure do |config|
13
- # ## Mock Framework
14
- #
15
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
- #
17
- # config.mock_with :mocha
18
- # config.mock_with :flexmock
19
- # config.mock_with :rr
20
-
21
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
22
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
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
- [{:value=>"2", :suit=>"D"},
4
- {:value=>"5", :suit=>"H"},
5
- {:value=>"4", :suit=>"D"},
6
- {:value=>"7", :suit=>"D"},
7
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
12
- {:value=>"5", :suit=>"H"},
13
- {:value=>"4", :suit=>"D"},
14
- {:value=>"7", :suit=>"D"},
15
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
20
- {:value=>"5", :suit=>"H"},
21
- {:value=>"4", :suit=>"D"},
22
- {:value=>"6", :suit=>"D"},
23
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
33
- {:value=>"2", :suit=>"H"},
34
- {:value=>"4", :suit=>"D"},
35
- {:value=>"3", :suit=>"D"},
36
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
41
- {:value=>"2", :suit=>"H"},
42
- {:value=>"3", :suit=>"S"},
43
- {:value=>"5", :suit=>"D"},
44
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
49
- {:value=>"2", :suit=>"H"},
50
- {:value=>"3", :suit=>"S"},
51
- {:value=>"4", :suit=>"D"},
52
- {:value=>"7", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
62
- {:value=>"2", :suit=>"H"},
63
- {:value=>"9", :suit=>"H"},
64
- {:value=>"9", :suit=>"S"},
65
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
70
- {:value=>"2", :suit=>"H"},
71
- {:value=>"9", :suit=>"H"},
72
- {:value=>"9", :suit=>"S"},
73
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
78
- {:value=>"2", :suit=>"H"},
79
- {:value=>"9", :suit=>"H"},
80
- {:value=>"9", :suit=>"S"},
81
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
91
- {:value=>"2", :suit=>"H"},
92
- {:value=>"2", :suit=>"H"},
93
- {:value=>"9", :suit=>"S"},
94
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
99
- {:value=>"2", :suit=>"H"},
100
- {:value=>"2", :suit=>"H"},
101
- {:value=>"6", :suit=>"S"},
102
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
107
- {:value=>"2", :suit=>"H"},
108
- {:value=>"2", :suit=>"H"},
109
- {:value=>"7", :suit=>"S"},
110
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
120
- {:value=>"3", :suit=>"H"},
121
- {:value=>"4", :suit=>"H"},
122
- {:value=>"5", :suit=>"S"},
123
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
128
- {:value=>"3", :suit=>"H"},
129
- {:value=>"4", :suit=>"H"},
130
- {:value=>"5", :suit=>"S"},
131
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
136
- {:value=>"3", :suit=>"H"},
137
- {:value=>"4", :suit=>"H"},
138
- {:value=>"5", :suit=>"S"},
139
- {:value=>"8", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
149
- {:value=>"3", :suit=>"D"},
150
- {:value=>"8", :suit=>"D"},
151
- {:value=>"5", :suit=>"D"},
152
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
157
- {:value=>"3", :suit=>"D"},
158
- {:value=>"8", :suit=>"D"},
159
- {:value=>"5", :suit=>"D"},
160
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
165
- {:value=>"3", :suit=>"D"},
166
- {:value=>"4", :suit=>"D"},
167
- {:value=>"5", :suit=>"D"},
168
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"4", :suit=>"D"},
178
- {:value=>"4", :suit=>"D"},
179
- {:value=>"4", :suit=>"H"},
180
- {:value=>"5", :suit=>"S"},
181
- {:value=>"5", :suit=>"D"}]
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
- [{:value=>"4", :suit=>"D"},
186
- {:value=>"4", :suit=>"D"},
187
- {:value=>"4", :suit=>"H"},
188
- {:value=>"3", :suit=>"S"},
189
- {:value=>"3", :suit=>"D"}]
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
- [{:value=>"5", :suit=>"D"},
194
- {:value=>"5", :suit=>"D"},
195
- {:value=>"5", :suit=>"H"},
196
- {:value=>"2", :suit=>"S"},
197
- {:value=>"2", :suit=>"D"}]
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
- [{:value=>"4", :suit=>"D"},
207
- {:value=>"4", :suit=>"D"},
208
- {:value=>"4", :suit=>"H"},
209
- {:value=>"4", :suit=>"S"},
210
- {:value=>"5", :suit=>"D"}]
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
- [{:value=>"5", :suit=>"D"},
215
- {:value=>"5", :suit=>"D"},
216
- {:value=>"5", :suit=>"H"},
217
- {:value=>"5", :suit=>"S"},
218
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"D"},
228
- {:value=>"3", :suit=>"D"},
229
- {:value=>"4", :suit=>"D"},
230
- {:value=>"5", :suit=>"D"},
231
- {:value=>"6", :suit=>"D"}]
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
- [{:value=>"2", :suit=>"S"},
236
- {:value=>"3", :suit=>"S"},
237
- {:value=>"4", :suit=>"S"},
238
- {:value=>"6", :suit=>"S"},
239
- {:value=>"8", :suit=>"S"}]
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