【发布时间】:2019-11-17 18:40:23
【问题描述】:
当我递归备份时,我的板子全乱了。
如何在不总是复制的情况下返回上一个棋盘(我的 minimax 需要快速性能)
我的代码:
for all possible moves:
board.apply(move);
int currentScore = minimax(board, depth - 1, false); // recursive call
int newScore = Math.max(value, currentScore);
// Undo move on the board or create a temp board for recursive calls, as the recursive calls will mess up the current board
board.undo(move);
我想到了 Board 类中的 undo 方法,它可以移动并撤消它,但这会让我回到我当前的董事会吗?
【问题讨论】: