32 lines
607 B
Ruby

module Models
module PlayHelpers
def create_hand(count, type)
cards = []
count.times do
cards << PlayerCard.new
end
case type
when /run/
cards.each.with_index(3) do |c, i|
# double
if type.include? 'double'
c.rank = Card::RANKS[i % (cards.count/2)]
else
c.rank = Card::RANKS[i % 13]
end
# suited
if type.include? 'suited'
c.suit = Card::SUITS[0]
else
c.suit = Card::SUITS[i % 4]
end
end
end
end
end
end