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.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
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]);
}
}