I just don't even know how to start this. Our teacher is making us make a tic tac toe game for our assignment. What I particularly need help with is how to go about setting up the board and designating the sports the user will use.
Printable View
I just don't even know how to start this. Our teacher is making us make a tic tac toe game for our assignment. What I particularly need help with is how to go about setting up the board and designating the sports the user will use.
I don't think that we'll be able to give you much help until you can tell more details about your problem and ask a more specific question. Also my experience with folks who state "I just don't know how to start..." is that they are much better off if they arrange a meeting with their instructor for some intense face-to-face help.
Okay well one thing in particular I need assistance with is how would I go about assigning X or O to a certain value to be represented by the board.
- - - is how I set up my board. How can I put X to be in the middle, or on the right, or top right?
- - -
- - -
- - -
- - -
- - -
translates to
[0] [1] [2]
[3] [4] [5]
[6] [7] [8]
translates to
int[] grid = new int[9]
translates to
for(int i = 0; i < grid.length; i++) {
doSomethingCoolTo(grid[i]);
}
translates to
[0,0] [0,1] [0,2]
[1,0] [1,1] [1,2]
[2,0] [2,1] [2,2]
translates to
int[][] grid = new int[rows*cols];
translates to
for(int i = 0; i < rows; i++) {
for(int j = 0; j < cols; j++) {
doSomethingCoolTo(grid[i][j]);
}
}