subject

Write a program that allows two players to play a game of tic-tac-toe. Use a two dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that - Displays the contents of the board array - Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and column number. - Allows player 2 to select a location on the board for an O. The program should ask the user to enter the row and column number. - Determines whether a player has won, or a tie has occurred. If a player has won, the program should declare that player the winner and end. If a tie has occurred, the program should say so and end. Player 1 wins when there are three Xs in a row on the game board. The Xs can appear in a row, in a column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner. You need to code programing challange question 18 (Tic Tac Toe Game) from Chapter 7 and add following feature in it.
1. Add two playing options. That is player can play with other player or with computer.
2. Add difficulty level (Easy, Medium and Hard) when playing against computer.
3. You should store the history of game results in a file and whenever game start you should load the history from the file.
4. Your game should present following menu.

Game Menu

1. Play
2. Game Results
3. Quit

If user select 1 then following menu should be shown

1. Play with Computer
2. Play with Other Player
3. Go Back

If user selects 3 then you should go back and display previous menu screen.
If user selects 1 the show following menu

Please select difficulty
1. Easy
2. Medium
3. Hard
4. Go Back

When user selects the desired difficulty then you should take the username (first and last name) from the user start the game
and user should be able to play with computer. Keep in mind in Easy difficulty level player should be able to easily beat the
computer where as in hard difficulty it should be very difficult for player to win.
Once game has been finished store the result in a file (You can give whatever name you want to) in following format

Name, Opponent Name, Winner, Date

For example if Majid Ali played game against computer with medium level and he wins then file should contain record as following

Majid Ali, Computer, Majid Ali, Medium, 22-August-2020

For example if Majid Ali played game against Hamza Abbas and Hamza wins then file should contain record as following

Majid Ali, Hamza Abbas, Hamza Abbas, None, 20-August-2020

When user selects 'Game Results' from the main menu then all the contents you saved in the file should be display to the screen in following format

Player 1 Player2 Winner Level Date

Majid Ali Computer Majid Ali Medium 22-August-2020
Majid Ali Hamza Abbas Hamza Abbas None 22-August-2020

Please do proper input validation at each level.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:10
How does access indicates that a filter has been applied to a specific column
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
Write a function named printfloatrepresentation(float number) that will print the floating point representation of a number using the format given below. (sign bit) exponent in binary (assumed bit).significandfor example if the number passed an argument is 71 yourprogram should print (0) 10000101 (1).00011100000000000000000similarly if the number passed to the function as argument is -71 the program should print (1) 10000101 (1).00011100000000000000000
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Why is hard disk space important to an audio engineer? why are usb ports and firewire ports useful for an audio engineer? explain in 2-3 sentences. (3.0 points) here's a list of different audio software: ableton live apple inc.'s garageband apple inc.'s logic studio digidesign's pro tools propellerhead sofware's reason sony creative software's acid pro steinberg cubase steinberg nuendo choose one of the software programs listed above, and then go to that software program's web site. read about what the software program is used for, and then write 4-5 sentences about what you learned. (10.0 points) which type of software license is the most limiting? why? explain in 2-3 sentences. (3.0 points) when sending a midi channel voice message, how can you control the volume of the sound? explain in 2-3 sentences. (4.0 points)
Answers: 1
You know the right answer?
Write a program that allows two players to play a game of tic-tac-toe. Use a two dimensional char ar...
Questions
question
Mathematics, 06.11.2020 18:30
question
Social Studies, 06.11.2020 18:30
question
Mathematics, 06.11.2020 18:30
question
Mathematics, 06.11.2020 18:30
question
History, 06.11.2020 18:30
question
Mathematics, 06.11.2020 18:30
Questions on the website: 13722361