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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -