Don't deal cards to the czar

This commit is contained in:
Juhani Krekelä 2019-05-06 11:07:26 +03:00
parent 8408e7f3a3
commit 68b485da63
1 changed files with 10 additions and 4 deletions

View File

@ -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):