Class: CribbageDeck
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Deck
Instance Method Summary collapse
Methods inherited from Deck
#card_at, #combine, #deal_in, #group_no, #index_of, #initialize, #shuffle, #swap, #top
Constructor Details
This class inherits a constructor from Deck
Instance Method Details
#deal(num_players) ⇒ Object
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/crystel.rb', line 287 def deal(num_players) case num_players when 2 for x in 0...3 if (1...3).include?(x) x = top(6) (0...6).each do @position.shift end else x = [] end @groups.push(x) end when 3 for x in 0...4 if (1...3).include?(x) x = top(5) (0...5).each do @position.shift end else x = [@position[0]] end @groups.push(x) end end self end |