Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
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")
print("Fine...")
return move
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...