1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zlopas [31]
3 years ago
7

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 thre

e 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.
Computers and Technology
1 answer:
Katyanochek1 [597]3 years ago
7 0

Answer:

Explanation:

i think it is easy:

1- you declare 2d array

2- fill it with *

3- declare player1Turn =true

4- declare player2Turn =false

5- make while loop where not finished

BS:not Finished would be function return bool that checks the condtions

6-if player1Turn

6.1- player1Turn =false

6.2- player2Turn =true

6.3- call function called play with "player1","X" as args

6-else if player2Turn

6.1- player2Turn =false

6.2- player1Turn =true

6.3- call function called play with "player2","O" as args

5- end while loop

You might be interested in
a certain kind of fish in the ocean eats only algae. a seal eats this fish a bear eats the seal .when the bear dies,it’s recycle
STatiana [176]

Answer:seal

Explanation:

4 0
2 years ago
Taking a recipe and breaking it down into its individual sections, like ingredients, preparation, cooking instructions, and nutr
Anna11 [10]
1.For each of the following, give the name of an element from Period 4 (potassium to krypton), which matches the description.
Elements may be used once, more than once or not all.. Single line text.
(1 Point)
an element that reacts with water to produce a lilac flame

2.For each of the following, give the name of an element from Period 4 (potassium to krypton), which matches the description.
Elements may be used once, more than once or not all.. Single line text.
(1 Point)
an element used as an inert atmosphere

3.For each of the following, give the name of an element from Period 4 (potassium to krypton), which matches the description.
Elements may be used once, more than once or not all.. Single line text.
(1 Point)
an element that has a valency of 3

4.Write a balanced chemical equation for the reaction between potassium and water. (Non-anonymous question). .
(1 Point)

Upload file
File number limit: 1Single file size limit: 10MBAllowed file types: Word, Excel, PPT, PDF, Image, Video, Audio
5.For each of the following, give the name of an element from Period 4 (potassium to krypton), which matches the description.
Elements may be used once, more than once or not all.. Single line text.
(1 Point)
an element with a fixed valency of 2 that not is not in group 2
8 0
3 years ago
Read 2 more answers
What can search the internet and select elements based on important words
Lana71 [14]

The item in question is known as a web search engine. These services will crawl websites and gather information about web pages to present to the searching user based on the search terms compared to the content of the webpage.

7 0
2 years ago
Write a program that:
Gemiola [76]

Answer:

num1 = int(input("Enter number 1: "))

num2 = int(input("Enter number 2: "))

choice = input("Do you want to multiply them?: ")

if choice.capitalize() == "Yes":

   print(num1 * num2)

else:

   print("Peace out.")

Explanation:

Gg ez.

(I wrote the it in python because I don't know what language you want it in. Next time, say what language you want.)

7 0
2 years ago
Kim's father's company has expanded many times. Therefore, the company's volume of data has also increased. The employees of tha
Flura [38]

B. LAN


She should choose the LAN because , its secured and wired. On LAN the huge amount of data can be transferred better than WLAN so the best option would be place LAN network for the employees to access the huge amount of data.

4 0
3 years ago
Read 2 more answers
Other questions:
  • BITS wants to store information about the supervisors, including their supervisor number and the relationship to consultants. Su
    15·1 answer
  • The safest action to take if someone claiming to be from your banks calls you to ask for account information is to
    8·2 answers
  • I don't know how to explain what is motion in my own words
    7·2 answers
  • Which option describes wearable technology?
    9·1 answer
  • What method do phishing and spoofing scammers use
    12·1 answer
  • Mark and his team are working on a project that is due for delivery in the next few days. The team is using project management t
    10·1 answer
  • What is number system?<br>​
    11·1 answer
  • What are the major benefits of preproduction?
    11·1 answer
  • If you want to remove the autocorrect options button from the screen, you can press the ____ key.
    15·1 answer
  • HELP ASAP
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!