lib/99_game.rb in 99_game-1.0.2 vs lib/99_game.rb in 99_game-1.0.3.pre
- old
+ new
@@ -30,13 +30,10 @@
end
class Hand # Creates a object that holds and can play cards
attr_reader :hand
def initialize; @hand = [$deck.shift, $deck.shift, $deck.shift]; end
def play(card)
- legal = false
- for cards in @hand; legal = true if cards.num == card.num; end
- raise CardError, "\aCard not allowed\a" unless legal
if card.num == "King"; $value = 99
elsif card.num == "Joker"; $value = 0
else; $value += card.value
end
i, done = 0, false
@@ -77,6 +74,6 @@
$deck.push(Card.new(3))
$deck.push(Card.new(2))
end
2.times {$deck.push(Card.new("Joker"))}
$deck.shuffle!
-__END__
\ No newline at end of file
+__END__