Question: ((PLEASE DO NOT COPY THE ASSIGNMENT FROM ANOTHER CHEGG QUESTION)) Code a comprehensive problem solution in Python applying the following programming concepts: Different forms of


1. It should prompt the user for the size of the board game it solves. you need to implement a Python program that implements: o Simplified 3x3 Tic-Tac-Toe game that you already did. Winning is for any who gets 3-in- a-row characters in any row. Complex NxN Tic-Tac-Toe: winning is for the player who gets the most 3-in-a-rows 2. The Welcome message should first ask for the player name in order to use it for saving game results in a file: Welcome to Tic-Tac-Toe game! please enter to player name: John Smith 3. Now it should ask the user for the character the he want to use (x, o) as well as the size of game he would like and then print the empty game board to start the game: Please choose your letter (x,c)? followed by game size (1.e 3x3): * 6x6 Your Score: Computer Score: LLLLLL LLLLLLLLL LLLLLLL LLLLLL LLLLLL LLLLLLLL 4. Ask the user for his next move by specifying the exact position of the move in (row, column) format. please enter the coordinates of your next move(x,y)?3,3 Based on the input values it will either: If the position is vacant/available for the next move then it will display the current board status after updating the user move. Your Score: Computer Score: ...... LLLLLL LLLLLLL LLLLLL LLLLLL o Or, if the player mistakenly chose a position that is already filled with an x/o character then it should alert him and ask him to re-enter a different (row, column) position unfortunately, the (0,1) move you have entered is already used, please enter a new move? 5. Program then chooses the corresponding computer move randomly from the pool of available empty positions and display the current board status after the computer move computer's move: Your Score: Computer Score: LLLLLLL LLLLLLL LLLILLI LLLLLLLL LLLLLLLL 6. Check the game for a winner by searching for three consecutive o's or x's in any direction: If it's the basic 3x3 simple game then search for three consecutive o's or x's in any direction: . If a winner is found then announce the winner (you or the computer), display a congrats message, display the number of moves to reach this win and end this game round Congratulations! you won the game in just 3 moves. This round is now over! Or Unfortunately, you lost the game! the computer won in 5 moves. This round is now Else, if no winner is found then go to step 4 Else, if the board is filled completely and no winner is found then announce a draw Else, If it's the more complex NxN board game then search for All three consecutive o's or x's in any direction: Update the scores of both the player and computer and re-draw the updated board. Your Score:1 | Computer Score:1 Ixlalelelel IxLLLLLLL IxlxLLLL LLLLLL LLLLLLLL LLLLLLL If all game board cells are filled then announce a winner based on the scores achieved so far. Else, go to step 4 to continue. 7. Save the user score in a file for later retrieval. You should save it in the following format: * John Smith': {'ganes_played":3,ganes_won': 2, "previous_Scores: [(4,5),(5,2).(6,3)}}} {"Mike Tyson:{'games played: 2, games_won":2,previous Scores': (10,2), (9,3)}}} John Bolton iganes played":4. Eanes won': 0, 'previous Scores': ((0.10).(3,6).(2.9).(3.5))) 8. Ask the user if he wants to play more and if yes then go to step 1. Would you like to go for another round or just end this game?(yeso) 9. If he doesn't want then display the games history by retrieving all the saved information from the file and highlight the current player score among all-time game players in a sorted by game_won) format as follows: player games_played 1 games_won 1 previous_Scores > 3 (4,5),(5,2), (6,3) Mike Tyson 2 (10,2), (9,3) John Bolton (0,10), (3,6),(2,9),(3,8) 10. End the game 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
