diff --git a/src/main/java/featurecat/lizzie/rules/Board.java b/src/main/java/featurecat/lizzie/rules/Board.java index 0fd26780f..4d94b243f 100644 --- a/src/main/java/featurecat/lizzie/rules/Board.java +++ b/src/main/java/featurecat/lizzie/rules/Board.java @@ -399,7 +399,7 @@ public void place(int x, int y, Stone color, boolean newBranch) { 0); // don't make this coordinate if it is suicidal or violates superko - if (isSuicidal > 0 || history.violatesSuperko(newState)) return; + if (isSuicidal > 0 || history.violatesKoRule(newState)) return; // update leelaz with board position if (Lizzie.frame.isPlayingAgainstLeelaz diff --git a/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java b/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java index 7de27a1a2..44cab87ca 100644 --- a/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java +++ b/src/main/java/featurecat/lizzie/rules/BoardHistoryList.java @@ -190,6 +190,12 @@ public boolean violatesSuperko(BoardData data) { return false; } + public boolean violatesKoRule(BoardData data) { + BoardHistoryNode previous = this.head.previous(); + // check if the current position is identical to the position two moves ago + return previous != null && data.zobrist.equals(previous.getData().zobrist); + } + /** * Returns the root node *