From bc9c057d57d4dbc2e3c70eaf3ac182df2b334107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 19 Apr 2016 00:40:57 +0200 Subject: [PATCH] fix bluffing again --- player.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/player.py b/player.py index 90bb280..1d4a045 100644 --- a/player.py +++ b/player.py @@ -86,12 +86,16 @@ class Player(object): self.logger.debug("Matching!") playable.append(card) - # You may only play a +4 if it's the only card you can play - self.bluffing = bool(len(playable) - 1) + # You may only play a +4 if you have no cards of the correct color + self.bluffing = False + for card in playable: + if card.color == last.color: + self.bluffing = True + break # You may not play a chooser or +4 as your last card - if len(self.cards) == 1 and (self.cards[0].special == c.DRAW_FOUR - or self.cards[0].special == c.CHOOSE): + if len(self.cards) == 1 and (self.cards[0].special == c.DRAW_FOUR or + self.cards[0].special == c.CHOOSE): return list() return playable