Hello, I need a help with making a Tic Tac Toe game in C++ Here are detailed ins
ID: 3576265 • Letter: H
Question
Hello,
I need a help with making a Tic Tac Toe game in C++
Here are detailed instructions that NEED to be followed:
You need to develop a program in which a human plays against the computer.
1. Validate user input at every opportunity.
a. Do not allow number entries less than 0
b. Do not allow number entries greater than 8
c. Do not allow non-numeric entries
2. Do not use global variables in the development of the program
3. You may use global constants in the development of the program
4. Use one-dimensional arrays to keep track of the game:
a. Computer moves
b. Human moves
5. Use functions to pass arrays and implement other program requirements.
6. The program must be developed using functions so that the main() function consists mostly of function calls
7. Computer must be aggressive and take every opportunity to win the game if and when the human makes errors (using "if" statements)
8. The main() function must use a loop to keep the user in the program until he/she wants to quit.
9. You may not use infinite loops: for(;;) or while(true)
10. You may not use the break statement to exit loops
Below is a list of functions to use in the development of this project:
splashScreen()//displays game and developer’s information
askForUserNames()//requests for username
validateUserName()//validate username
switchPlayer()//switch from one player to another
resetGame()//reset the game when one concludes; this includes filling the array with vales 0-8
displayGrid()//display the grid after each player makes a move
playerMakeMove()//prompts player to make a move, invokes validatePlayersMove, checkPositionAvailability
validatePlayersMove()//validates that user entry X is such that 0<=X<=8
checkPositionAvailability()//check that the position selected by the user is available
checkWin()//check for a winning player
checkTie()//check for a tie
makeBestMove()//select best option
computerMakeMove()//used to make the move, in other words populate the array
Program Flow
1. At the start of the game, an initial “Splash” screen must be displayed which includes:
a. The game’s title
b. Your name
2. Be sure to validate user entries; no white space, no numbers X, such that 0<=X<=8, no alpha characters.
3. The computer will choose a spot immediately after the human.
4. Don’t allow the human to select a square which is already in use (the human chose a position already in use)
5. A winner is detected when one occurs and a request to play again is made. Don’t forget to validate!
A tie is detected when one occurs.
6. Program ends when players don’t want to play anymore
PLEASE NOTE: THIS IS A FINAL WORK. FOLLOWING ALL INSTRUCTIONS AND PROGRAM FLOW ABOVE IS VERY IMPORTANT
Thank you!
C:UserslfloreslalDesktop Project1Debug Project1.exe TIC TAC TOE By Prof E Flores Press any key to continueExplanation / Answer
You should notice that if you use a C++11 compliant compiler you can use a std::vector instead of the C-like array. This is not available for Visual Studio 2012, but is supported in Visual Studio 2013.
The game logic will be implemented in a class called tictactoe_game. At a minimum, the class should have the following state:
During the game we will need to know whether the game is started, finished, and if finished if any of the players won or the game ended in a draw. The tictactoe_game provides three methods for this:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.