in main
{
create board and intialize to E
declare plays and initialize to 1
declare no Winner and initialze to true
while(plays < 9 && no Winner)
{
make play
++plays
winner = win()
if(winner != 'C')
no Winner is false
}
if plays == 10
draw
else
if winner == 'X'
cout X won
else
cout O won
}
char win(char ** ttt)
{
char result == 'C';
//check rows
for each row
if(first element != 'E')
if(first element equals second element and first equals third)
result = first element
break;
if(result == 'C')
check columns
if(result == 'C')
check diagonals
return result
}
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
It's shorthand to stand for a 2 dimensional array. It would mean something like:
char win(char board[3][3])
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396