I keep getting a false
boolean value from the following comparison:
public boolean getHz1() {
return board[0][0] == board[0][1]
&& board[0][1] == board[0][2]
&& board[0][0] != null
&& board[0][1] != null
&& board[0][2] != null;
}
The relevant call in the driver class is:
do {
System.out.println("Your turn: ");
g1.play(s.nextInt(), s.nextInt(), s.next());
System.out.println(g1.getHz1());
} while (g1.getHz1() == false)
The "play" method takes 2 integers and a string value to put in the array, in this case "x". When I print out the board[0][0]
, board[0][1]
and board[0][2]
, all contain the string "x", but getHz1
still returns false
.