Playing cards: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 635: | Line 635: | ||
constructor: (@pip, @suit) -> |
constructor: (@pip, @suit) -> |
||
toString: |
toString: => "#{@pip}#{@suit}" |
||
class Deck |
class Deck |
||
Line 648: | Line 648: | ||
@cards.push new Card(pip, suit) |
@cards.push new Card(pip, suit) |
||
toString: |
toString: => "[#{@cards.join(', ')}]" |
||
shuffle: |
shuffle: => |
||
for card, i in @cards |
for card, i in @cards |
||
randomCard = parseInt @cards.length * Math.random() |
randomCard = parseInt @cards.length * Math.random() |