I set up a two-dimensional array to hold the string values, either X or O, entered by the users.
private static String [][] ghettoBoard = new String [3][3];
My problem is in setting up the win/draw conditions. The only way I can think of to detect a win or a draw is (just the first example):
if ((ghettoBoard [0][0] == "X") && (ghettoBoard[0][1] == "X") && (ghettoBoard[0][2] == "X"))
This seems to work just fine. However, the thought of creating a similar if statement for every possible permutation of wins or draws is daunting. First of all, I'm lazy. Second, it seems horribly inefficient, and will lead to a big chunk of ungainly code. My problem is I simply don't know enough about accessing arrays and the information stored inside them. If anyone can direct me to the docs or methods that might help me accomplish this task, I would be HUGELY grateful. Alternatively, as I secretly suspect/fear, if this is the only way to get it done, that would be great to know too.

New Topic/Question
Reply




MultiQuote




|