diff --git a/quartett.py b/quartett.py index bb85822..305b935 100644 --- a/quartett.py +++ b/quartett.py @@ -16,20 +16,19 @@ def central_function(): does everything, keeps order ''' - active = 0 # contains index of the active player - switch = True - card_stack, players_with_cards, players, complete_card_stack = initialize() + card_stack, players_with_cards, players, complete_card_stack = initialize() + active = random.randint(0, len(players) - 1) # contains index of the active player # stores the dropped cards all_quartets = [] - print("players",players) # debug - print("card stack", card_stack) # debug - print(players_with_cards) # debug - for i in range(len(players)): # debug - pretty_print_deck(players_with_cards, i) # debug - print("active", active) # debug + print("players", players) # debug + print("card stack", card_stack) # debug + print(players_with_cards) # debug + for i in range(len(players)): # debug + pretty_print_deck(players_with_cards, i) # debug + print("active", active) # debug drop_cards(players_with_cards, all_quartets) while switch: round(card_stack, players_with_cards, players, active, complete_card_stack, all_quartets) @@ -264,11 +263,11 @@ def the_winner_is(players_with_cards, players): winners.append(0) dropped_quartets = players_with_cards[i]['quartet'] - if temp < dropped_quartets : - temp = dropped_quartets - winners.insert(i, dropped_quartets ) + if temp < dropped_quartets: + temp = dropped_quartets + winners.insert(i, dropped_quartets) - if temp == dropped_quartets : + if temp == dropped_quartets: winners[i] = dropped_quartets # winners then functions as a template @@ -277,7 +276,7 @@ def the_winner_is(players_with_cards, players): if winners[i] == temp: print(players[i], "has won the game!") + # Call central_function() only if quartett.py is the main module if __name__ == "__main__": central_function() -