![]() ![]() Currently you have this: def winner(board): The function that checks for a win or tie is incorrect. Move = computer_move(board, computer, human)Ĭongrat_winner(the_winner, computer, human) for this is the best you will ever achieve.\n") ![]() Print("You were most lucky, human, and somehow managed to tie me. "But never again! I, the computer, so swears it\n!") Print("No, no! It cannot be! Somehow you tricked me, human. "Proof that computers are superior to humans in all regards.\n") Print("As I predicted, human, I am triumphant once more. # since no one ca win on next move, pick best open squareĭef congrat_winner(the_winner, computer, human): #make a copy to work with since function will be changing list. Choose another.\n")ĭef computer_move(board, computer, human): Print("\nThat square is already occupied, foolish human. Move = ask_number("Where will you move? (0 - 8): ", 0, NUM_SQUARES) Print("\nYour bravery will be your undoing. Go_first = ask_yes_no("Do you require the first move? (y/n): ") Will correspond to the board position as illustrated: You will make your move known by entering a number, 0 - 8. This will be a showdown between your human brain and my silicon processor. Welcome to the greatest intellectual challenge of all time: Tic-Tac-Toe. The program continues until all the spaces are mark with either "X" or "O". I have this code for Chapter 6 and when I ran the code and got the straight "X" in the board, it won't return the winner. ![]() I'm currently reading Michael Dawson's book Python for the Absolute Beginner. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |