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
Which is a solution that represents the majority of VPNs on the market and is commonly referred to as a VPN appliance?
Dafna1 [17]

Answer:

Remote access VPN

Explanation:

The solution that represents the majority of VPN's on the markets and is commonly referred to as a VPN appliance is the Remote access VPN

A remote access VPN is a type of VPN  that  works by creating a virtual channel (appliance ) between different devices for the purpose of exchanging data in an encrypted form. although this Tunnel passes through the public internet the Data exchanged are only accessible by the devices connected via the tunnel only .

The remote access VPN  is mostly used to connect an employee to the company's network therefore it represent the majority of VPNs in the market.

3 0
3 years ago
You wrote a program to allow the user to guess a number. Complete the code to generate a random integer from one to 10.
just olya [345]

Answer:

randint

Explanation:

Just did my quiz and got a 100%

7 0
3 years ago
Read 2 more answers
PLEASE HELP ME HELP ME NO IM NOT OKAY AND ITS NOT EASY FOR ME.....Vladimir is reworking an old slideshow. He needs to delete som
Mandarinka [93]

Answer:

Outline view

Explanation:

This is a formatted window that shows all text, headers, and titles in a popup on the left side of the screen. Slide master shows all the slides but includes slide details such as inserted images and smart art.

7 0
3 years ago
HELPPPPPPP!!!!!!!!!
Andrei [34K]
The compression ratio is 20:1 please mark me brainliest
3 0
3 years ago
Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
Nady [450]

Since I have rechecked and noticed that it is not a disk space shortage, then the problem should not be on the disk but the RAM. Even basic tasks like opening up a Word document can be slow if you do not have enough RAM. You can check RAM usage in task manager by right clicking on the taskbar and selecting the task manager option. You will be required to click on the Performance tab of the task manager. Here, you will be able to graphically view how much RAM on your computer is being used. If the RAM is being over-utilized, you will have to consider upgrading your PC with more RAM.

5 0
3 years ago
Other questions:
  • Write a program that reads in 10 numbers from the user and stores them in a 1D array of size 10. Then, write BubbleSort to sort
    13·1 answer
  • Write a program in python that reads an unspecified number of integers from the user, determines how many positive and negative
    8·1 answer
  • What does a virus do to a computer? How can it be fixed?
    9·1 answer
  • g A sign of thrashing is Group of answer choices the CPU utilization increases as the degree of multiprogramming is increased. t
    5·1 answer
  • Which tool will select the lines of a sketch in digital software?
    7·1 answer
  • A company wants to build a new type of spaceship for transporting astronauts to the moon. What should the company do first?
    15·2 answers
  • Help plzzzzzzzzzzzzzzzzzzzzzzzzz
    14·1 answer
  • Which is a connectionless protocol in the transport layer? What are the small chunks of data called?
    12·2 answers
  • HELP FAST PLEASE
    6·1 answer
  • Which of the following keywords allows a subclass to access a superclass method even when the subclass has overridden the superc
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!