Skip to content

Commit

Permalink
Allow moves violating superko to be played; only enforce basic ko rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
alreadydone committed Oct 27, 2018
1 parent 322cf17 commit 10ada67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/featurecat/lizzie/rules/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/featurecat/lizzie/rules/BoardHistoryList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 10ada67

Please sign in to comment.