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.

Answers

Answer 1

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


Related Questions

What is Game Theory?
Study of strategic decision making
elements of support for effective support of a system
the imitation of the operation of real-world process or system over time
decentralized communications model

Answers

Answer:

the branch of mathematics concerned with the analysis of strategies for dealing with competitive situations where the outcome of a participant's choice of action depends critically on the actions of other participants

Explanation:

In simple terms Game theory is the study of how and why people make decisions.

what is the principle that producers are entitled to make more money from a business than they invest

Answers

Answer: profit motive

Explanation: i don’t have and explanation but i just did it on apex and got it right

The user documents are stored in _______ format.

Answers

The user documents are stored in _______ format.

A. qvd.

B.  qvw

C.  None of the options

D.  qvs.

Answer:

B.  qvw

Explanation:

Given the options available, it can be inferred that the application the question is referring to is called QlikView which is a software application that is used for analytics explanation. This software applications saves documents created in a file extension specifically known as "QVW."

Hence, the right answer is that: in QlikView, the user documents are stored in QVW format.

The user documents are stored in QVW format.

It may well be deduced that perhaps the program referred to something throughout the question would be QlikView, a software platform utilized for analytics explanations or presentations.QVW documents seem to be QlikView layout software consisting incorporate presentations, charts, leading components, load scripts, expressions, as well as workplaces used in information displays.

Thus the above answer is right.

Learn more about the QVW format here:

https://brainly.com/question/10205740

Java Programming home > 1.14: zylab training: Interleaved input/output Н zyBooks catalog Try submitting it for grading (click "Submit mode", then "Submit for grading"). Notice that the test cases fail. The first test case's highlighting indicates that output 3 and newline were not expected. In the second test case, the-5 and newline were not expected 2 Remove the code that echoes the user's input back to the output, and submit again. Now the test cases should all pass 0/2 ACTIVITY 1.14.1: zylab training: Interleaved input/output DoubleNum.java Load default template 1 import java.util.Scanner; 3 public class DoubleNum public static void main(String args) { Scorner sehr = new Scanner(System.in); int x; 7 System.out.println("Enter x: "); 9 - scnr .nextInto: 10 11 System.out.println(); // Student mistakenly is echoing the input to output to match example 12 System.out.println("x doubled is".02 Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed Input values in the first box, then click Run program and observe the programs cutout in the second be Enter program input (optional) of your code requires input values, provide them here Ad Cat

Answers

Answer:

The following are the code to this question:

code:

System.out.println(x);  //use print method to print value.

Explanation:

In the given question, it simplifies or deletes code in the 11th line. This line has a large major statement.  

In the case, the tests fail because only 1 line of output is required by the tester, but two lines are obtained instead.

It's to demonstrate that the input/output or testing requirements function throughout the model.

which of the following characters cannot be used in filename?​

Answers

Answer:

# pound. % percent. & ampersand. { left curly bracket. } right curly bracket. ...

< left angle bracket. > right angle bracket. * asterisk. ? question mark. ...

$ dollar sign. ! exclamation point. ' single quotes. " double quotes. ...

+ plus sign. ` backtick. | pipe. = equal sign.

Explanation: You will get an error if you try to use these characters in a file name. - Google.

This is C++
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet. Store this value using a const double variable. (2 pts)
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.514286 gallons
(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon. (2 pts)
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.514286 gallons
Cans needed: 1 can(s)

Answers

Answer:

#include <cmath>

#include<iostream>

using namespace std;

int main()

{

double height, width;

cout<<"Enter wall height (feet): ";

cin>>height;

cout<<"Enter wall width (feet):  ";

cin>>width;

//1

double area;

area = width * height;

cout<<"Wall area: "<<area<<" square feet"<<"\n";

//2

const double gallon = area/350.0;

cout<<"Paint needed: "<<gallon<<" gallons"<<"\n";

//3

cout << "Cans needed :" << round(gallon) << " can(s)";  

return 0;

}

Explanation:

This line declares the height and width as double

double height, width;

This line prompts user for height

cout<<"Enter wall height (feet): ";

This line gets user input for height

cin>>height;

This line prompts user for width

cout<<"Enter wall width (feet):  ";

This line gets user input for width

cin>>width;

//1  Question 1 begins here

This line declares area as double

double area;

The line calculates area

area = width * height;

The line prints the calculated area

cout<<"Wall area: "<<area<<" square feet"<<"\n";

//2  Question 2 begins here

This line declares and calculates gallon as a constant double variable

const double gallon = area/350.0;

This line prints the calculated gallon

cout<<"Paint needed: "<<gallon<<" gallons"<<"\n";

//3  Question 3 begins here

This line rounds gallon to nearest whole number and prints the result

cout << "Cans needed :" << round(gallon) << " can(s)";  

Given the list of customer segments below please create a new list of the names of the segments only using(a) a for loop(b) a list comprehension(c) a map().List would look something like ['Wallstreet','Gambler','Parents'] but of course using each tool as listed:segments = [{'name': 'Wallstreet', 'average_spend': 82.01}, {'name': 'Gambler', 'average_spend': 107.00}, {'name': 'Parents', 'average_spend': 10.52}]

Answers

Answer:

new_segment = [ ]

for segment in segments:

   new_segment.append({'name': segment, 'average_spend': money})

print( new_segment)

Using list comprehension:

new_segment =[{'name': segment, 'average_spend': money}  for segment in segments]

Using map():

def listing(a):

   contain =  {'name': segment, 'average_spend': money}

   return contain

new_segment = [ ]

new_segment.append(map( listing, segment))

print(list(new_segment)

Explanation:

The python codes above create a list of dictionaries in all instances using for loop, for loop in list comprehension and the map function which collect two arguments .

Which of the following is typically used in a flowchart to indicate a decision?
a. square
b. rectangle
c. diamond
d. oval

Answers

Diamond is typically used in a flowchart or indicate a decision.

Decisions in flowcharts are indicated by diamonds.

What are flowcharts?

It is a pictorial or symbolic representation of the processes involved in achieving an aim.

In flowcharts, the following apply:

Ovals represent the beginning or end of a processRectangles represent key steps in the processArrows are used to indicate the flow or direction of the processDiamonds represent decision-making. When one of the available options has to be taken.

More on flowcharts can be found here: https://brainly.com/question/14598590

#SPJ2

What is a characteristic of maintaining logs in a system? A. Logging prevents security violations, but only deals with passive monitoring. B. Logging provides access control by authenticating user credentials. C. Logging helps an administrator to detect security breaches and vulnerable points in a network

Answers

Answer:

The correct answer is C

Explanation:

When analysed, logs can help to forestall security breaches to a network it can also help to identify and resolve any vulnerabilities within the system.

Due to the number of logs generated daily, it is almost impracticable to constantly monitor all logs generated by the system.

Cheers!

A computer has 38 address lines. How many locations in Mega bytes can it address?

Answers

Answer:

The computer can address 34359,738368 megabytes

Explanation:

Given

Address Lines (n) = 38

Required

Determine the number of location it can address

Number of addressable locations (N) in bits is calculated as thus

[tex]N = 2^n.[/tex]

Substitute 38 for n

[tex]N = 2^{38}[/tex]

[tex]N = 274877906944\ bits[/tex]

Next; is to convert from bits to megabytes

Start by converting to bytes

1 bit = 0.125 bytes;

So;

[tex]N = 274877906944 * 0.125\ bytes[/tex]

[tex]N = 34359738368\ bytes[/tex]

Convert from byte to megabyte

[tex]1\ byte = 10^{-6}\ megabyte[/tex]

So;

[tex]N = 34359738368\ * 10^{-6}\ MB[/tex]

[tex]N = 34359,738368\ MB[/tex]

Hence, the computer can address 34359,738368 megabytes

When a hardware or software interrupt occurs, the CPU calls________

Answers

Answer:

Operating system

Explanation:

An interrupt is the signal sent to the processor that interrupts the current process. It may be generated by a hardware device or a software program.With each interrupt the CPU hardware does exactly the same thing, which is what enables operating systems to take control of the current user operation.

What is programming blocks?

Answers

Answer:

In computer programming, a block or code block is a lexical structure of source code which is grouped togethe

Explanation:

Which of the following best describes how computing devices represent information? A. A computer will either represent information as bits or bytes but not both B. A computer represents data as a byte which is either a 0 or a 1 C. A computer represents data as bits which is either a 0 or a 1 D. A computer represents information as bits which contain 8 bytes.

Answers

Answer:

The Answer is B

Explanation:

The reason the answer is B is because "bytes" are the correct form of storing memory in 0's and 1's.

Using concepts of data representation in a computer, it is found that the correct option is:

C. A computer represents data as bits which is either a 0 or a 1.

-----------------

In computer science, it is a common saying that "everything inside a computer is either a 0 or 1".The unit of measure that only has 0s and 1s is bits.If we load a file, either text or image, all the values at each position on the file are composed by 0's and 1's, for example.Thus, option C is correct.

A similar problem is given at https://brainly.com/question/17399642

What are some options available in the Spelling and Grammar Checker? Check all that apply. Redo Undo Ignore All Ignore Once AutoFormat Add to Dictionary Readability statistic

Answers

Answer:

Ignore all, Ignore once, and Add to Dictionary.

So 3,4, and 6.

Explanation:

Just took it.

The options available in the Spelling and Grammar Checker include Ignore All, Ignore Once, and Add to Dictionary.

Spelling and Grammar Checker

It is a feature on Microsoft word that enables users to check for spelling and grammar errors in their works.

Depending on if the feature is activated, words or sentences with spellings or grammatical errors are underlined in red.

Users have the option of selecting ignore once to ignore a particular spelling or grammatical error, ignore all to ignore all the spellings and grammatical errors in the document, or add to the dictionary in order to include a flagged word into the dictionary.

More on spelling and grammar checkers can be found here: https://brainly.com/question/16798012

#SPJ2

Check
Which of these tasks can be accomplished when the drop-down menu of the Bullets icon is clicked? Check all that
apply.

Answers

Which of these tasks can be accomplished when the drop-down menu of the Bullets icon is clicked? Check all that

apply.

Indent the ideas in the bulleted list.

Change the number level of the list.

Choose the bullet to be used in the list.

Define the new bullet to be used in the list.

Pick the number format to be used in the list.

Answer:

Choose the bullet to be used in the list.

Define the new bullet to be used in the list.

Explanation:

When using Microsoft Word text editor, when the drop-down menu of the bullet icon is clicked, the following tasks can be accomplished which are to choose the bullet to be used in the list and define the new bullet to be used in the list.

A bullet is used to identify or list out important items, sometimes in ascending order, and are used to organize information to make the important points easy to pick out.

Answer:

Choose the bullet to be used in the list.

Define the new bullet to be used in the list.

Explanation:

.

Which of the following are offered by most
professional organizations? Check all of the boxes
that apply.
a code of conduct
access to resources, conferences, and job
boards
help with troubleshooting computer issues
skills validation

Answers

Answer:

1. A code of conduct

2. Access to resources, conferences,and, job boards

4. skills validation

Explanation:

I just answered it

A code of conduct is a collection of regulations describing an individual party's or organization's norms, standards, and duties or right procedures. The correct options are A, B, and D.

What is a code of conduct?

A code of conduct is a collection of regulations describing an individual party's or organization's norms, standards, and duties or right procedures. The most prevalent policy within a company is a code of conduct. This policy outlines the company's beliefs, standards, and moral and ethical expectations for workers and third-party interactions with the firm.

From the given set of options, the options that are offered by most professional organizations are,

A code of conductAccess to resources, conferences, and job boardsSkills validation

Hence, the correct options are A, B, and D.

Learn more about the Code of Conduct here:

https://brainly.com/question/12990307

#SPJ2

When you want to use the current backup of all of the files, which option should be selected?

Answers

Answer:

To use the current backup of all the files, the option to select is Browse for Folders.

This gives you access to select the most current back up with the latest timestamp.

Cheers!

How to see the range of values of vty lines?

Answers

Answer:

To get the range of very lines in a switch or a router, in the global mode, type " line very" and the question mark after the space. It displays the ranges of valid very lines in the device.

Explanation:

Routers and switches are intermediate components of a computer network. They are used to connect various nodes and networks. For a remote connection, they use the virtual interface called vty to connect to computers for management purposes. These vty lines allows for SSH and telnet access from workstations and the range of very lines are predetermined and limited and varies for all switches and routers.

Online servers that can be accessed through the internet are an example of RAM.
O True
O False

Answers

Answer:

False

Explanation:

Answer:

The answer is False because I just took a test

Which of the following is the fundamental unit of the virtualized client in an IaaS deployment? a)Workload b)Workspace c)Work unit

Answers

Answer:

a. Workload

Explanation:

The most fundamental unit of the virtualized client in an IaaS deployment is the workload because it simulates the potential of a certain server to perform a specific amount of work given.

When should the architect begin the analysis?

Answers

Answer:

Right after the end user and the customer finalize the negotiations.

Explanation:

The architect's analysis is extremely important to ensure that a system acts correctly and efficiently. This analysis is carried out together with the implementation of codes and security systems, which will be responsible for the defense of the system. This analysis should begin immediately after the end user and the customer have completed negotiations that define all the requirements and information necessary to start the project.

The Active Directory Users and Computers tool can be used to:______.

Answers

Answer:

add users, reset passwords, enable dial-In access, and manage computersin the domain.

Explanation:

Active Directory Users and Computers is an administrative tool, that is used to perform or carry out various tasks relating to administration processes. It can be utilized in the administration of an organization memberships and company server.

Hence, the Active Directory Users and Computers tool can be used to add users, reset passwords, enable dial-In access, and manage computers in the domain.

Which section from the article BEST explains why humans could benefit from studying a particular type of extremophile?​

Answers

Answer:

The study of extremophiles provides an understanding of the physicochemical parameters defining life on Earth and may provide insight into how life on Earth originated. The postulations that extreme environmental conditions existed on primitive Earth and that life arose in hot environments have led to the theory.­NASA is studying an extremophile, Deinococcus radiodurans, which is extremely resistant to radiation. This microbe can withstand doses of radiation 500 percent higher than would be lethal to humans.

Hope this helped you!

Explanation:

Which firmware security standard can be used to store disk encryption keys?A. SLAB. TPMC. UEFID. USB

Answers

Answer:

Option B (TPM) is the appropriate choice.

Explanation:

A TPM seems to be a specific form of the protected crypto operating system which seems to be a specialized piece of hardware being used to perform cryptographic techniques such as collecting encrypted data to classified material that is typically was used to validate hardware by either the host machine.The pairing is kept or inside the chip as well as therefore can not be software-accessed.

Other alternatives given weren't concerning the circumstance mentioned. So the response to the above seems to be the right one.

Which of the following is no longer necessary when you use HTML5 to develop Webpages? Please Hurry This Is For An Assignment due in 15 minutes :>

Answers

Answer:

Installing a third-party plug-in to include video

Explanation:

Referencing Microsoft Word:1. How can you save a document created using Word 2016 in a PDF format? Explain the process step by step.2. Assuming you are on the home tab, explain which tabs and buttons you would need to select to open a new blank document?3. Assuming you are on the home tab, explain which tabs and buttons you would need to select to add the "Quick Print" icon to the Quick Access Toolbar.4. Assuming you are on the home tab, explain which tabs and buttons you would need to select to add a bibliography to the document.5. Assuming you are on the home tab, explain which tabs and buttons you would need to select to put a picture within your document?6. Assuming you are on the home tab, explain which tabs and buttons you would need to select to change the page orientation to Landscape?7. What is the purpose of the "ribbon"?8. The Help button from previous versions of Office has been replaced by what words and what symbol?

Answers

Answer:

Referencing Microsoft Word:

1. How can you save a document created using Word 2016 in a PDF format? Explain the process step by step.

Step 1: Click on File Tab

Step 2: Click on Save As Button

Step 3: Select File Location for the document

Step 4: Name the document

Step 5: Save type: Select pdf

Step 6: Save

2. Assuming you are on the home tab, explain which tabs and buttons you would need to select to open a new blank document?

Step 1: Click on File Tab

Step 2: Click on New Button

Step 3: Select or Click Blank Document

3. Assuming you are on the home tab, explain which tabs and buttons you would need to select to add the "Quick Print" icon to the Quick Access Toolbar.

Step 1: Click on File Tab

Step 2: Select Options Button

Step 3: Select Quick Access Toolbar

Step 4: Select Quick Print

Step 5: Click on Add

4. Assuming you are on the home tab, explain which tabs and buttons you would need to select to add a bibliography to the document.

Step 1: References Tab

Step 2: Click Bibliography

Step 3: Insert Bibliography or create as required.  

5. Assuming you are on the home tab, explain which tabs and buttons you would need to select to put a picture within your document?

Step 1: Click on File Tab

Step 2: Click the Open Button

Step 3: Click on Library

Step 4: Select Picture Location

Step 5: Select Picture

Step 6: Click Add

6. Assuming you are on the home tab, explain which tabs and buttons you would need to select to change the page orientation to Landscape?

Step 1: Click Layout Tab

Step 2: Select Orientation

Step 3: Click Landscape

7. What is the purpose of the "ribbon"?

The "ribbon" contains the 8 tabs on the Quick Access Toolbox: File, Home, Insert, Page Layout, References, Mailings, Review, and View.  The "ribbon" groups these specific command categories called tabs.

8. The Help button from previous versions of Office has been replaced by what words and what symbol?

It has been replaced with the lightbulb symbol with these words: “Tell me what you want to do…”  And you can also type Alt + Q to get the same help assistance.

Explanation:

The ribbon is a user interface element created by Microsoft and includes the roll of tabs and buttons.  The Ribbon tabs and buttons bring your favorite commands into the open by showing multiple commands grouped in specific categories.

There are eight tabs along on the ribbon: File, Home, Insert, Page Layout, References, Mailings, Review, and View. Each tab relates to different activities that you can carry out when creating a document.  For example, if you want to save a new document, you click on the File tab which takes you to the Save As button where you choose the file location and save as required.

Overlay analysis is ____________, taking in data from two or more layers to create a single output layer.

Answers

Explanation:

Overlay analysis is an approach, taking in data from two or more layers to create a single output layer.

For example, if we have a layer of land use and a layer of soil fertility, we can derive from the two layers the percentage of agricultural land developed over fertile soil.

Mention five specific techniques you can use to improve your written documents.

Answers

Answer:

The answer is below

Explanation:

There are various techniques an individual can use to improve his or her written documents, some of which considered to be specific are:

1. Understand the targeted readers.

2. Do not be ambiguous or avoid ambiguity

3. Always use active voice pattern whenever possible

4. Perform second reading, and edit where necessary

5. Avoid repetition of words too often.

Which of the following is the correct representation of -780,030,000 in exponential notation?

Answers

The answer is -7.8003 x 10^8

A maintenance schedule lists the procedure for defragmenting your hard drive true or false

Answers

I think it's true not sure sorry if it's wrong

Answer:

false

can i has brainliest

Explanation:

Other Questions
Solve for A.F = m a HELP ME PLEASE!!!!!!!!!! Help please! answer brainliest Point V is on line segment UW. Given VW = x, UV = 3x 1, andUW = 5x 5, determine the numerical length of VW. The area of a rectangular wall of a barn is 216 square feet. Its length is 6 feet longer than twice its width. Find the length and width of the wall of the barn ____________________ is an example of environmental change. a. Native Americans hunting rabbits and mice b. Native religious traditions changing over time c. Spanish settlement increasing d. none of the above _______ believed that quality stemmed from "constancy of purpose," and that managers should stress teamwork,be helpful rather than simply give orders,and make employees feel comfortable about asking questions.A) Frank and Lillian GilbrethB) Henri FayolC) Max WeberD) Mary Parker FollettE) W.Edwards Deming I need help with the following question. What is the capacity of a 3 cubic foot carton in cubic inches? in the excerpt. How does the author provide details to suggest that Stanley's mother often chooses to focus on the positive side of a situation In a experimental investigation, the variable that the researcher changes or manipulates in order to see the its effects is called the Walter was impressed with the rabbit hutch Sarah had built. He said her construction skills were admirable. What group sought to reform the Church of England from within during the 16th century? Describe them. How did the Cuban Missile Crisis of 1962 come to an end?A)The Soviet Union removed its nuclear missiles from Cuba.B)American forces were defeated by the Cuban army at the Bay of Pigs.C)The United States installed nuclear missiles in FloridaD)Both the United States and Soviet Union agreed to stop making missiles. 4 more than the product of a number and 9 is 12. which argument best explains the charge of an atomic nucleus?O Anatomic nucles is positively charged because it is composed of neutrons.O Anatomic nucles is positively charged because iis composed of protons.O Anatomic nucleus is negatively charged because tis composed of electrons.O Anatomic nucleus is reganely charged because tis composed of neutrons. Equation of Line y =-32-4ime whats 55mph to km/min? can someone explain to to me with the work so i can understand how to solve this Solve for x: -19= - 4x+1 - 6x Given the vector equation ????(t)=(43t)????+(5+t)????+(3t)????, rewrite this in terms of the parametric equations for the line.x(t)=y(t)=z(t)= Peter created this number pattern: 9, 18, 27, 36 Martha says the rule for Peter's pattern is Multiply by 2. Peter disagrees and says that the rule is Add 9. Who is correct? Justify your response.