Help with a Tic Tac Toe Game.

I have this code that I am suppose to use to make a simple tic tac toe game. But i am just lost and need some direction of what to do next. Any ideas is appreciated. Thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  #include "stdafx.h"
#include <iostream>

using namespace std;

void Instructions();
void chooseSquare(char, char[], int);
void printBoard(char[], int);
bool isGameOver(char[], int);

int main()
{
	int gameCycle = 0;
	char player1 = 'O';
	char player2 = 'X';
	bool gameOver = false;
	char curPlayer = 'X';
	const int ROWS = 3;
	const int COLUMNS = 3;
	const int ENTRIES = 9;
	char board[ENTRIES] = {' ', ' ', ' ', ' ', ' ', \
							' ', ' ', ' ', ' '};
	char board3x3[ROWS][COLUMNS];


	for (int ent = 0; ent < ENTRIES; ent++) {
		int i, j;
		j = ent%COLUMNS;
		i = ent/ROWS;
		board3x3[i][j] = ' ';
	}

	for  (int i = 0; i < ROWS; i++) {
		for (int j = 0; j < COLUMNS; j++) {
			int index = i * ROWS + COLUMNS;
			board[index] = ' ';
		}
	}

	Instructions();

	while (!gameOver && gameCycle < ENTRIES) {
		chooseSquare(curPlayer, board, ENTRIES);
		printBoard(board, ENTRIES);

		gameOver = isGameOver(board, ENTRIES);
		// Switch player
		if (curPlayer == 'X')
			curPlayer = 'O';
		else
			curPlayer = 'X';

		gameCycle++;
	}
	
	if(gameOver) {
		cout << "\nConratulations: " << curPlayer << endl;
	}
	else {
		cout << "Cat Scratch!!!" << endl;
	}

	return 0;
}

void Instructions()
{

}

void chooseSquare(char curPlayer, char board[], int ENTRIES)
{

}

void printBoard(char brd[], int ent)
{

}

bool isGameOver(char brd[], int ent)
{

}
Last edited on
Topic archived. No new replies allowed.