Commencé à intégrer les règle d'écarté
This commit is contained in:
1 parent
3c7ad236fc
commit
f09e4ba6ae
1 file changed
+15
-2
@@ -67,6 +67,10 @@ class Player
|
||||
@hand << card
|
||||
end
|
||||
|
||||
def clear_hand
|
||||
@hand.clear
|
||||
end
|
||||
|
||||
def play
|
||||
@hand.pop
|
||||
end
|
||||
@@ -112,6 +116,10 @@ class Game
|
||||
end
|
||||
|
||||
def deal
|
||||
@player1.clear_hand
|
||||
@player2.clear_hand
|
||||
|
||||
@deck = Deck.new
|
||||
@deck.shuffle
|
||||
5.times do
|
||||
@non_dealer.receive(@deck.draw)
|
||||
@@ -165,16 +173,21 @@ end
|
||||
|
||||
# Instance du jeu
|
||||
game = Game.new("Alice", "Bob")
|
||||
|
||||
game.determine_dealer
|
||||
puts "The dealer is #{game.dealer.player_name}."
|
||||
puts
|
||||
game.deal
|
||||
puts "#{game.player1.player_name} has #{game.player1.hand.count} cards."
|
||||
puts "#{game.player2.player_name} has #{game.player2.hand.count} cards."
|
||||
puts "The stock has #{game.stock.length} cards."
|
||||
puts
|
||||
game.change_dealer
|
||||
puts "The dealer is #{game.dealer.player_name}."
|
||||
puts
|
||||
game.deal
|
||||
puts "#{game.player1.player_name} has #{game.player1.hand.count} cards."
|
||||
puts "#{game.player2.player_name} has #{game.player2.hand.count} cards."
|
||||
puts "The stock has #{game.stock.length} cards."
|
||||
|
||||
# Mise en place du jeu
|
||||
# puts "#{game.player1.player_name} has :"
|
||||
# puts
|
||||
|
||||
Reference in new issue
Block a user