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 system provides an easier way for people to communicate with a computer than a graphical user interface (GUI)
Marta_Voda [28]
Answer: natural Language Processing

Explanation:

Natural Language Processing: It is a sub field of linguistics which is concerned with the interactions between Human and computer especially how to program computers to process and to understand large amounts of natural language data.
6 0
2 years ago
You often insert your company's logo into a document you create.one way to make it easier for you to quickly insert it is to sav
eduard
Save the logo as a TEMPLATE.

A template is a pre-developed page layout in soft copy or hard copy used to make pages with the same pattern, style, or design.

In the above scenario, you can prepare a template with you logo in it and save it for future use. In the event that you need to create a new document, you only have to bring up the saved template and edit it with the new information that you need to type.

This way, you will not be hassled to manually add your logo to every new document you create.
5 0
3 years ago
_________ is a society organized with the purpose of rendering service to its members and to the public in general.
sesenic [268]

Answer:

cooperate society

Explanation:

A cooperative society is a voluntary association that started with the aim of the service of its members.

8 0
2 years ago
What is a quick way to determine if a site might contain reliable information?
xz_007 [3.2K]
<span>The best and most correct answer among the choices provided by the question is the fourth choice.

A way of determining that a site is realiable is examining comments about the <span>webpage.</span></span><span>
I hope my answer has come to your help. God bless and have a nice day ahead!</span>
5 0
2 years ago
Read 2 more answers
Yuki is preparing to write a research paper for his history class. Which style guide would be best for him to use?
FromTheMoon [43]
The answer is Modern Language Association (MLA).  Yuki is preparing to write a research paper for his history class. The style guide that would be best for him to use is Modern Language Association (MLA).  <span>MLA style is a system for documenting sources in scholarly writing.  it has been widely used for classroom instruction and used worldwide by scholars, journal publishers, academic and commercial presses.</span>
3 0
3 years ago
Read 2 more answers
Other questions:
  • What is the force generated by a rocket motor to propel a spacecraft forward?
    14·1 answer
  • What type of restrictions may be placed on your license?
    7·1 answer
  • In three to five sentences, explain how you would insert graphics using your word-processing software.
    7·2 answers
  • Which statement is true about wikis? Wikihow is an online dictionary that aims to define words. A wiki cannot be used in an orga
    12·2 answers
  • Finish and test the following two functions append and merge in the skeleton file:
    12·1 answer
  • Allows an administrator to query a dns database and find the host name associated with a specific ip address or
    15·1 answer
  • 5. How should you use LinkedIn Answers as a professional?
    8·1 answer
  • 2. What is the layout of the modern keyboard known as?
    13·1 answer
  • Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
    5·1 answer
  • I am trying to make a flowgorithm chart for a dogs name, age, weight and when their weight is less than 50 OR more than 100 its
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!