algorithm - How can I make a for loop in java for the computer to make a winning move in tictactoe? -
i trying figure out how can implement loop check if computer can make winning move on 3 3 tic tac toe, if computer should make move. above code should check whether of rows match condition, not sure missing. please me out. thanks.
for(int = 0; < 3; ++i) { for(int j = 0; j < 3; ++j){ if(button[i][j].gettext().equals(button[i][j+1]) && button[i][j+1].gettext().equals("x")) { button[i][j].settext("o"); } } }
thanks.
Comments
Post a Comment