This is my code:
public Move makeMove(int[][] board)
(... more code ...)
int[][] nextMove = board.clone(); nextMove[i][j] = 1; int nextMaxMove = maxMove( nextMove ); System.out.println( next max move: " + nextMaxMove + " " + maxMove( board ) );
int[][] board is an 8x8 board, and I'm trying to figure out the best move in a board game.
When I found a list of equal good moves, I want to check what opportunities my opponent gave to other moves that I can make. So, I clone() board , edit the clone nextMove[i][j] = 1 and call the function maxMove on the new board.
println is for debugging, and I get the same result for maxMove( nextMove ); and maxMove( board ) , this is wrong. It appears that nextMove remains unchanged ..
source share