Question: Create a C++ program.Your task is to develop a tic-tac-toe game.The game is one where a human may play against the computer. PROGRAM REQUIREMENTS 1.
Create a C++ program.Your task is to develop a tic-tac-toe game.The game is one where a human may play against the computer. PROGRAM REQUIREMENTS
1. The program prompts users for their names and ensures (validates) them; users are allowed to enter a single username consisting of alpha chars ONLY.
2. Use one-dimensional arrays to keep track of the game: a. Human moves in the case of option one. b. Computer moves as well in the case of option two.
3. Use functions to pass arrays and implement other program requirements such as input validation, checking to ensure that places selected by users are available on the game board.
4. Validate user input at every opportunity. a. Do not allow number entries less than 0 or entries greater than 8 (in the case you are using numbers 0-8 on the grid. b. Do not allow number entries less than 0 or entries greater than 8 (in the case you are using numbers 1-9 on the grid. c. Do not allow non-numeric entries.
5. The program must be developed using functions so that the main() function consists mostly of function calls.
6. Below is a suggested list of functions for you to consider in the development of this project:
a. splashScreen()//displays game and developers information
b. askForUserNames()//requests for username
c. validateUserName()//validate username
d. switchPlayer()//switch from one player to another
e. resetGame()//reset the game when one concludes; this includes filling the array with vales 0-8
f. displayGrid()//display the grid after each player makes a move
g. playerMakeMove()//prompts player to make a move, invokes validatePlayersMove, checkPositionAvailability
h. validatePlayersMove()//validates that user entry X is such that 0<=X<=8
i. checkPositionAvailability()//check that the position selected by the user is available
j. checkWin()//check for a winning player k. checkTie()//check for a tie
7. In the case of option two, additional functions you may want to consider are: a. makeBestMove()//select best option b. computerMakeMove()//used to make the move, in other words populate the array
8. The main() function must use a loop to keep the user in the program until he/she wants to quit. Users should be allowed to play as many games as they want.
9. You must use meaningful variable names.
10. You must comment your code.
11. You must use variables of the correct type and initialize them with a proper value.
12. Your program must detect a winner if there is one
13. Your program must determine if a tie occurs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
