Playing in the Console

You should now be able to take all the pieces of your game, put them in a single file, and then run the game with the following code at the end:

# Put all the pieces of your game here, above the code below.

def get_choice() -> str:
    """
    Get user input and return either 'p' or 'f' depending on the player's choice.
    """
    answer= ' '
    while answer not in ['p', 'f']:
        answer=input("Please enter either 'p' or 'f':")
    return answer

from random import randint

def deal() -> list[int]:
    """
    Simple random card dealing function that returns three randomly chosen cards,
    represented as integers between 2 and 14.
    """
    return [randint(2, 14), randint(2, 14), randint(2, 14)]

score = 0
while True:
    score += play_round()
    print("Your score is", score, "- Starting a new round!")

Playing in Drafter

The simple interface we’ve created so far works with the REPL (command line) to repeatedly ask the user to type their answer into a box. But that is not very visually exciting. What if instead, we had a user interface in Drafter?

The last step of this project is to develop a user interface in Drafter that can play the game. To help support this process, we will give you a fair amount of code. However, some of the functions will be incomplete. You will need to finish writing these functions.