From 68b485da63f73f3dd02b656a894556e069b26a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Mon, 6 May 2019 11:07:26 +0300 Subject: [PATCH] Don't deal cards to the czar --- gameloop.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gameloop.py b/gameloop.py index 224c798..bbe07cc 100644 --- a/gameloop.py +++ b/gameloop.py @@ -376,6 +376,10 @@ def game(): def setup_round(): nonlocal players, round_call_card, czar, card_choices + # Select a czar randomly, if we need to + if czar not in players.values(): + czar = random.choice(list(players.values())) + # Clear out previous round's cards card_choices = {} @@ -392,6 +396,9 @@ def game(): # Find out how many response cards we need need_responses = 0 for player in players.values(): + # Don't deal cards to the czar this round + if player is czar: continue + if len(player.hand) < 10: need_responses += 10 - len(player.hand) need_responses += player.hand.count(None) @@ -407,6 +414,9 @@ def game(): # Add responses to players' inventories for player in players.values(): + # We skipped the czar in the counts, so skip here too + if player is czar: continue + while len(player.hand) < 10: player.hand.append(responses.pop()) @@ -414,10 +424,6 @@ def game(): if player.hand[index] is None: player.hand[index] = responses.pop() - # Select a czar randomly, if we need to - if czar not in players.values(): - czar = random.choice(list(players.values())) - return top_of_round def sanitize(text):