diff --git a/src/main/java/featurecat/lizzie/rules/Board.java b/src/main/java/featurecat/lizzie/rules/Board.java index 8239be7f..603c950d 100644 --- a/src/main/java/featurecat/lizzie/rules/Board.java +++ b/src/main/java/featurecat/lizzie/rules/Board.java @@ -412,6 +412,7 @@ public void pass(Stone color, boolean newBranch, boolean dummy, boolean changeMo Stone[] stones = history.getStones().clone(); Zobrist zobrist = history.getZobrist(); int moveNumber = history.getMoveNumber() + 1; + int moveMNNumber = nextMoveMNNumber(newBranch); int[] moveNumberList = newBranch && history.getNext(true).isPresent() ? new int[Board.boardWidth * Board.boardHeight] @@ -432,6 +433,7 @@ public void pass(Stone color, boolean newBranch, boolean dummy, boolean changeMo 0.0, 0, 0.0); + newState.moveMNNumber = moveMNNumber; newState.dummy = dummy; // update leelaz with pass @@ -451,6 +453,12 @@ public void pass() { pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE); } + private int nextMoveMNNumber(boolean newBranch) { + boolean isNewSubBranch = newBranch && (history.getCurrentHistoryNode().numberOfChildren() > 0); + boolean isMissingMoveMNNumber = history.getMoveMNNumber() < 0; + return isNewSubBranch ? 1 : isMissingMoveMNNumber ? -1 : history.getMoveMNNumber() + 1; + } + /** * Places a stone onto the board representation. Thread safe * @@ -519,12 +527,8 @@ public void place(int x, int y, Stone color, boolean newBranch, boolean changeMo Stone[] stones = history.getStones().clone(); Zobrist zobrist = history.getZobrist(); Optional lastMove = Optional.of(new int[] {x, y}); - boolean isNewSubBranch = - newBranch && (history.getCurrentHistoryNode().numberOfChildren() > 0); - boolean isMissingMoveMNNumber = history.getMoveMNNumber() < 0; int moveNumber = history.getMoveNumber() + 1; - int moveMNNumber = - isNewSubBranch ? 1 : isMissingMoveMNNumber ? -1 : history.getMoveMNNumber() + 1; + int moveMNNumber = nextMoveMNNumber(newBranch); int[] moveNumberList = newBranch && history.getNext(true).isPresent() ? new int[Board.boardWidth * Board.boardHeight]