I need to create a program for this, but I don't even know where to start with it. Any help would be appreciated.

Tic-tac-toe, originally called noughts and crosses (and still known as this in Britain and Australia), Xs and Os (in Ireland) and X and 0 (in India) is a pencil-and-paper game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game. A (no winner) occurs when all the cells on the grid has been filled with tokens and neither player has achieved a win.
The following example game is won by the first player, X:

Create a program to play tic-tac-toe with you. Assume the computer is always the first player (using token x) and you are the second player (using token o).

1. Use a 3x3 array to represent the 3x3 grid for each game.
2. Write a function called nextMove to enter the next x token for the computer (the first player). Function nextMove must use a random number generator to determine the location (x coordinate and y coordinate) of the x token on the board. Use call by reference for nextMove to return x and y values.
3. Write a function called checkWin to check and see whether you or the computer wins the game. Here, you must pass the array to checkWin which will determine whether a player has won.
4. Write a function called printBoard to print the tokens on the board. Use "-" to represent each grid where no token has been entered. For example, a possible board with tokens can be:
x - o
x o -
o x -
5. When the game starts, your program use function nextMove to enter a x token, and then prompts the second player (it is you) to enter an o token. After each token is entered, your program must print the current board content using function printBoard, and also check whether a player is won using function checkWin.
6. When a game is over, your program erase the board and prompts the second player whether he/she would like to play another game. The program terminates when player 2 does not like to play any longer.
Topic archived. No new replies allowed.