TIC TAC TOE ( plz follow all the instructions) C++ , need to using getline and c
ID: 663582 • Letter: T
Question
TIC TAC TOE ( plz follow all the instructions)
C++ , need to using getline and check all the values are correct.
Human plays against the computer (use one-dimensional arrays
In this option you will 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
8. The main() function must use a loop to keep the user in the program until he/she wants to quit.
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
Explanation / Answer
// Tic_Tac_Toe.cpp
#include <iostream>
#include<string>
#include<cstdlib>
using namespace std;
char square[10] = {'0','1','2','3','4','5','6','7','8'};
string name;
int splashScreen()//displays game and developer
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.