TicTacToe Project

Hello, I am working on a project for my programming course and am struggling to get started. Here are the instructions for the project. If anyone could be of some help it would be greatly appreciated
Programming and Problem Solving
CSIS 2610
Fall Semester 2018 — CRN 41441
Project 3 — Tic-Tac-Toe Player
Due date: Monday, November 19, 2018
Goal
Create a program that plays a game of tic-tac-toe between a human and the computer.
Details
The program should allow the computer to play either X (who moves first) or O (who moves second).
When it is the human’s turn to play, it should display the board and ask for a move. Display a tic-tactoe
board with filled-in squares displaying an X or O as appropriate and a digit 1–9 for any unfilled
squares. Squares are numbered 1, 2, 3 across the top row, 4–6 across the middle row and 7–9 across
the bottom row.
The human’s move must be validated; that is, make sure that the chosen square is unoccupied, to
prevent the human from cheating.
The computer should always select its move according to the following steps:
1. If the computer can win, select the winning square.
2. Otherwise, if the computer can block the human from winning, select the blocking square.
3. Otherwise, choose the center square (square 5) if it’s open.
4. Otherwise, choose any open corner square (squares 1, 3, 7 or 9).
5. Otherwise, choose any open square (squares 2, 4, 6 or 8).
Select the X player at random.
.Suggestions and Hints
• Use a variable board[3][3] to store the board. Since the board is needed by all parts of
the program, it can be a global variable.
• You will want to create the following functions:
– int score(int cell1,int cell2,int cell3)
Using +1 for an X, −1 for an O and 0 for an empty cell, add the values for the three
specified cells and return the sum.
– bool playerWins(char player)
Returns true if the given player has won, false if they have not currently won (note: this
doesn’t necessarily mean that the player has lost.)
Programming and Problem Solving Project 3 — Tic-Tac-Toe Fall 2018 — CRN 41441
– bool canWin(char player,int &square)
This function should look at the board and return true if the given player (’X’ or ’O’) can
win on this move and return false if the player cannot win on this move. Fill in the appropriate
square if the player can win on this move.
Hint: What’s the difference between canWin(’X’,sq) and canBlock(’O’,sq)?
– void printBoard(void)
Displays the current board (see above.)
– int getComputerMove(char player)
Gets the computer’s move as either X or O according to the algorithm described above.
– int getHumanMove(char player)
Gets the human’s move as either X or O. Also validates the move to make sure it’s legal.
to get started, organize the requirements by what you can do and when. for example, you can't check for a winner before you have a board and the ability to populate the board.

so make a board; the instructions say how they want this done.
then figure out how to display the board -- pay attention to how it looks when there is a blank square vs a symbol, make it look nice for both.
then figure out how to take turns and get user input.
then work on validation of input
then work on winning conditions but leave for now have it as human vs human and play it yourself a few times to validate wins/draws
do the AI part last.
Topic archived. No new replies allowed.