print("You lose {} cards!".format(len(pot))) # print("LOSE", end="") c_reserve.extend(pot) elif winner == 0: # A tie; a cause for WAR! print("There is a tie.") print("Declare War!") interface.wait_for_input() # print(" TIE", end="\n") (h_hand, h_reserve) = flip_if_needed((h_hand, h_reserve), n=3) (c_hand, c_reserve) = flip_if_needed((c_hand, c_reserve), n=3) pot.extend(cards.pull_three(h_hand)) pot.extend(cards.pull_three(c_hand)) # Weeeee, recursion! ((h_hand, h_reserve), (c_hand, c_reserve)) = play_turn((h_hand, h_reserve), (c_hand, c_reserve), pot) return ((h_hand, h_reserve), (c_hand, c_reserve)) if __name__ == "__main__": deck = cards.create_deck() deck = cards.shuffle_cards(deck) (h_hand, c_hand) = cards.deal_cards(deck) interface.wait_for_input(DISABLE_WAIT) won = main((h_hand, []), (c_hand, []))
def test_shuffle(): deck = cards.create_deck() shuf = cards.shuffle_cards(deck) assert deck != shuf
#print("LOSE", end="") c_reserve.extend(pot) elif winner == 0: # A tie; a cause for WAR! print("There is a tie.") print("Declare War!") interface.wait_for_input() #print(" TIE", end="\n") (h_hand, h_reserve) = flip_if_needed((h_hand, h_reserve), n=3) (c_hand, c_reserve) = flip_if_needed((c_hand, c_reserve), n=3) pot.extend(cards.pull_three(h_hand)) pot.extend(cards.pull_three(c_hand)) # Weeeee, recursion! ((h_hand, h_reserve), (c_hand, c_reserve)) = play_turn( (h_hand, h_reserve), (c_hand, c_reserve), pot) return ((h_hand, h_reserve), (c_hand, c_reserve)) if __name__ == '__main__': deck = cards.create_deck() deck = cards.shuffle_cards(deck) (h_hand, c_hand) = cards.deal_cards(deck) interface.wait_for_input(DISABLE_WAIT) won = main((h_hand, []), (c_hand, []))