From cebffecc35b854c464cd3498c173cc9ec59036b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 8 Mar 2016 12:54:16 +0100 Subject: [PATCH] +4 on +4, skip turn --- bot.py | 4 +++- player.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 75c01ce..b0424ec 100644 --- a/bot.py +++ b/bot.py @@ -316,7 +316,9 @@ def do_draw(game, player): player.cards.append(game.deck.draw()) game.draw_counter = 0 player.drew = True - if game.last_card.value == c.DRAW_TWO and draw_counter_before > 0: + if (game.last_card.value == c.DRAW_TWO or + game.last_card.special == c.DRAW_FOUR) and \ + draw_counter_before > 0: game.turn() diff --git a/player.py b/player.py index d006d6d..23b5ff5 100644 --- a/player.py +++ b/player.py @@ -102,11 +102,11 @@ class Player(object): self.logger.debug("Card's color or value doesn't match") is_playable = False if last.value == c.DRAW_TWO and not \ - (card.value == c.DRAW_TWO or - not self.game.draw_counter): + card.value == c.DRAW_TWO and self.game.draw_counter: self.logger.debug("Player has to draw and can't counter") is_playable = False - if last.special == c.DRAW_FOUR and self.game.draw_counter: + if last.special == c.DRAW_FOUR and not \ + card.special == c.DRAW_FOUR and self.game.draw_counter: self.logger.debug("Player has to draw and can't counter") is_playable = False if not last.color or card in playable: