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 standard is commonly used on the Internet to represent non-numeric data?
mezya [45]
ASCI is the standard that is commonly used on the Internet to represent non-numeric data. ASCI stands for American Standard Code fro Information Interchange. This character encoding standard represents text in computers, telecommunications equipment, and other devices.  It assigns letters, numbers, and other characters within the 256 slots available in the 8-bit code
4 0
3 years ago
Implement a function inValues() that asks the user to input a set of nonzero floating-point values. When the user enters a value
elena-s [515]

Answer:

Explanation:

The following is written in Python and uses exception handling to do exactly as requested. It then goes adding all of the integer values to an array called num_list and finally adding them all together when the function ends.

def in_values():

   num_list = []

   while True:

       try:

           num = input("Input non-zero floating point: ")

           num = int(num)

           if num == 0:

               break

           else:

               num_list.append(num)

       except ValueError:

           print("No valid integer! Please try again ...")

           try:

               num = input("Input non-zero floating point: ")

               num = int(num)

               break

           except ValueError:

               break

   sum = 0

   for number in num_list:

       sum += number

   return sum

5 0
3 years ago
Which is NOT a component of a relationaldatabase?
MaRussiya [10]

Answer: 4) Hierarchy

Explanation:

The main components of the relational database are table, entity and attributes. As, relational data base is the method of arranging and maintaining the data and each table in the database contain data in the entity and the attributes. Hierarchy is not the component of the database as it is included in the type oh hierarchical database not in relational database.

5 0
3 years ago
PLEASE HELP
mario62 [17]

Answer:

the 3rd one you put

Explanation:

6 0
3 years ago
Your company has decided to store data files in Cloud Storage. The data would be hosted in a regional bucket to start with. You
Natasha_Volkova [10]

1. Necessary backup from cloud storage to client workstation or desktop or pc.

2. Delete 30 day and one year data from cloud storage.

<u>Explanation:</u>

Purging the data is used in database where necessary backup and purging the data up to certain years. So that database is access will be faster.

At cloud storage it has very limited storage's and by increasing storage will cost more to company or organization, as best practices every 30 day the purge old data should done in cloud storage's and with necessary backup  to be taken as precautionary measurement.

Once data is completed more than one year, with necessary backup delete old year data from cloud storages. Some cases old dead account where been deactivated also can deleted depends of organizations policy.

7 0
3 years ago
Other questions:
  • Which choice lists two image formats that support transparency
    6·2 answers
  • The current standard for RFID is based off of Group of answer choices MIT standards IEEE standards ISO standards there is no agr
    12·1 answer
  • sometimes people who have been playing gta for a while are annoying, i was playing gta this weekend and was trying to escape, bu
    8·2 answers
  • When creating envelopes, how will you adjust the layout?
    10·2 answers
  • What will be the code in CSS, to set
    13·1 answer
  • Trish has bought a new computer that she plans to start on after a week
    5·1 answer
  • What would be an ideal scenario for using edge computing solutions? a regional sales report uploaded to a central server once a
    14·1 answer
  • Select the correct answer.
    10·1 answer
  • Select all steps in the list below that should be completed when using the problem-solving process discussed in this chapter.
    14·1 answer
  • A new thread begins its life cycle by transitioning to the ________ state. Group of answer choices new runnable waiting terminat
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!