Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

Tic Tac Toe with Python - How will the human player move

Now we will write a function that will define how a human player will make their moves in this game.

  • Define the function human_move as shown below, this function takes 2 arguments, board, and human respectively:

    def <<your code goes here>>(board, <<your code goes here>>):
        legal = legal_moves(board)
        move = None
        while move not in legal:
            move = ask_number("Where will you move? (0-8): ", 0, NUM_SQUARES)
            if move not in legal:
                print("\nUn oh, looks like that square is already occupied. Choose another one.\n")
        return move

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...