Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I will be grateful if solved and explained in detail for me to learn and understand the program. thank you C++ Competence Samue References Mailings

I will be grateful if solved and explained in detail for me to learn and understand the program. thank you

image text in transcribedimage text in transcribed

C++ Competence Samue References Mailings Review View Help C# Competence Program Description: In this design project, you will implement a Tic-Tac-Toe game between a user and the computer. Tic-tac-Toe is a game that two parties play taking turns to mark a space (with X and O) in a 3x3 board. The player that wins succeeds to placing three marks on a line (horizontal, vertical, or diagonal). There is NO requirement for strategy or logic in how the computer selects its move the computer's move (play) can be random. Design Specifications: NOTE: This design cannot use arrays. This design cannot use global variables. . Basic Implementation: For the basic implementation, the user is the first player and the computer is the second player. Additionally, the user gets the marker 'X' and the computer gets the marker 'O'. To receive full credit for the basic implementation, you must meet the following design specifications: Function to draw the tic-tac-toe board (1): The Tic-Tac-Toe game requires a function that draws the Tic-Tac-Toe board. This function will get called repeatedly until either all the nine spaces on the board have been played or a player wins. Initially, the nine spaces will have numbers associated with their position, as shown in the screen shot below. After each play, the chosen space will show either an 'X or an 'O' to designate the space was taken. Function to check the input is within the valid range (2): As a Tic-Tac-Toe board has only 9 spaces, if the input value is less than 1 or greater than 9 then an error message should be displayed (for example, "Invalid input: the position indicator has to be in the range of 1 to 9", as shown in the screen shot below). This error checking should be performed every time the user enters a number, om a w DOLL A1757 fan, the bright of Hig barometeras C++ Competence Samud References Mailings Review View Help Function to check the designated space is available (3): After passing the input validation test, the program has to check if the designated space is available. Create a function to examine whether the selected space is available. Use the fact that the occupied space (which were previously played) have either 'X' or 'O' character instead of the space number (1 through 9). When the selected space is available, mark it with 'X' or 'O' of the player; if not, either ask the user to enter another number (as shown in the example below) or pick another random space (when it is the computer's turn to play). In the example below, the space "6" that the user designates is already taken. The character "o" in the space means that the computer placed the marker there. Therefore, the program asks the user to enter another value, and this time the user enters "3", whose corresponding space is available. Play will continue until an available space is selected. Function to check if we have a winner (and the program should end) (4): Whenever a new space is marked, the program should check whether there is a winner. If there is a winner, the winner is displayed, and the program is terminated. If not, it will continue to play. Create a main() program (5): The main() will play the complete Tic-Tac-Toe game including all the fore mentioned functions. The main() will play a new game if requested by the user. Other functions may be added as needed but are not required. Better Implementation: To receive full credit for the better implementation, you must meet the following design specifications: Ask the user to flip a coin to determine who (either the user or the computer) should play first. Ask the user to choose their own marker, between 'X' and 'O'. Create a tally of user wins, losses and cats' games. o a w DOLL C++ Competence Samue References Mailings Review View Help C# Competence Program Description: In this design project, you will implement a Tic-Tac-Toe game between a user and the computer. Tic-tac-Toe is a game that two parties play taking turns to mark a space (with X and O) in a 3x3 board. The player that wins succeeds to placing three marks on a line (horizontal, vertical, or diagonal). There is NO requirement for strategy or logic in how the computer selects its move the computer's move (play) can be random. Design Specifications: NOTE: This design cannot use arrays. This design cannot use global variables. . Basic Implementation: For the basic implementation, the user is the first player and the computer is the second player. Additionally, the user gets the marker 'X' and the computer gets the marker 'O'. To receive full credit for the basic implementation, you must meet the following design specifications: Function to draw the tic-tac-toe board (1): The Tic-Tac-Toe game requires a function that draws the Tic-Tac-Toe board. This function will get called repeatedly until either all the nine spaces on the board have been played or a player wins. Initially, the nine spaces will have numbers associated with their position, as shown in the screen shot below. After each play, the chosen space will show either an 'X or an 'O' to designate the space was taken. Function to check the input is within the valid range (2): As a Tic-Tac-Toe board has only 9 spaces, if the input value is less than 1 or greater than 9 then an error message should be displayed (for example, "Invalid input: the position indicator has to be in the range of 1 to 9", as shown in the screen shot below). This error checking should be performed every time the user enters a number, om a w DOLL A1757 fan, the bright of Hig barometeras C++ Competence Samud References Mailings Review View Help Function to check the designated space is available (3): After passing the input validation test, the program has to check if the designated space is available. Create a function to examine whether the selected space is available. Use the fact that the occupied space (which were previously played) have either 'X' or 'O' character instead of the space number (1 through 9). When the selected space is available, mark it with 'X' or 'O' of the player; if not, either ask the user to enter another number (as shown in the example below) or pick another random space (when it is the computer's turn to play). In the example below, the space "6" that the user designates is already taken. The character "o" in the space means that the computer placed the marker there. Therefore, the program asks the user to enter another value, and this time the user enters "3", whose corresponding space is available. Play will continue until an available space is selected. Function to check if we have a winner (and the program should end) (4): Whenever a new space is marked, the program should check whether there is a winner. If there is a winner, the winner is displayed, and the program is terminated. If not, it will continue to play. Create a main() program (5): The main() will play the complete Tic-Tac-Toe game including all the fore mentioned functions. The main() will play a new game if requested by the user. Other functions may be added as needed but are not required. Better Implementation: To receive full credit for the better implementation, you must meet the following design specifications: Ask the user to flip a coin to determine who (either the user or the computer) should play first. Ask the user to choose their own marker, between 'X' and 'O'. Create a tally of user wins, losses and cats' games. o a w DOLL

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

----

Answered: 1 week ago