I have to implement a tic - tac -toe game in C. The board has to be stored in an array 1D or 2D. The problem I'm having is that I don't see how I can store the game board AND the moves in the same array. This is what I have so far but, The professor wants the board and the moves stored in the same array. How can I do that? What I have below looks like "the best" way to do it. I hope I'm just misunderstandin g what he wants. Here is a link to the assignment on his webpage, click project 3 on the left side to view the assignment
Code:
int main(void){ int row,col; int board[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; printf("\n\n"); printf("\t %d |%d|%d \n",board[0][0],board[0][1],board[0][2]); printf("\t ----------\n"); printf("\t %d |%d |%d \n",board[1][0],board[1][1],board[1][2]); printf("\t ----------\n"); printf("\t %d | %d |%d \n\n",board[2][0],board[2][1],board[2][2]);
Comment