fix(test): turn_defeats

parent 118e40b2
......@@ -49,12 +49,9 @@ class Game:
self.deck.reset()
for current_player in self.players:
current_player.clear()
draw = []
for i in range(self.defeats[current_player] + 1):
draw.append(self.deck.random_card())
print(f"Drew {draw} for {current_player}.")
for d in draw:
current_player.give(d)
current_player.give(self.deck.random_card())
print(f"Drew {current_player.hand} for {current_player}.")
# Tour
self.current_bet = None
......@@ -91,6 +88,7 @@ class Game:
def count_defeat(self, loser):
self.defeats[loser] += 1
print(f"Total defeats for {loser}: {self.defeats[loser]}")
def add_player(self, player: Player):
"""
......@@ -133,7 +131,6 @@ class Game:
print(f" {current_player} bets {self.current_bet}.")
else: # Menteur! Who lost the round?
print(f" {current_player} says Menteur!")
menteur = self.is_menteur(self.current_bet)
loser = last_player if menteur else current_player
self.count_defeat(loser)
......
......@@ -36,7 +36,7 @@ class TestGame(TestCase):
self.game = Game([menteur, naive])
self.game.new_turn()
self.assertEqual(1, len(self.game.defeats.values()), "There should have been one defeat.")
self.assertEqual(1, len([v for v in self.game.defeats.values() if v > 0]), "There should have been one defeat.")
self.assertTrue(1 in self.game.defeats.values(), "A player should have one defeat.")
loser = [p for p in self.game.players if self.game.defeats[p]][0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment