Skip to content

Commit

Permalink
Refactoring to avoid modification of SGFParser
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Feb 9, 2021
1 parent 1e6ba97 commit d58e38e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/featurecat/lizzie/rules/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ public void place(int x, int y, Stone color, boolean newBranch, boolean changeMo
Stone[] stones = history.getStones().clone();
Zobrist zobrist = history.getZobrist();
Optional<int[]> lastMove = Optional.of(new int[] {x, y});
boolean isNewSubBranch = newBranch && !history.getData().firstBranch;
boolean isNewSubBranch =
newBranch && (history.getCurrentHistoryNode().numberOfChildren() > 0);
boolean isMissingMoveMNNumber = history.getMoveMNNumber() < 0;
int moveNumber = history.getMoveNumber() + 1;
int moveMNNumber =
Expand Down
1 change: 0 additions & 1 deletion src/main/java/featurecat/lizzie/rules/BoardData.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class BoardData {
public boolean verify;

public double winrate;
public boolean firstBranch;
private int playouts;
public int engineIndex;
public double komi;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/featurecat/lizzie/rules/SGFParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ private static BoardHistoryList parseValue(

String blackPlayer = "", whitePlayer = "";

int previousDepth = -1;
// Support unicode characters (UTF-8)
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
Expand All @@ -182,8 +181,6 @@ private static BoardHistoryList parseValue(
if (!inTag) {
subTreeDepth += 1;
// Initialize the step count
Lizzie.board.getData().firstBranch = previousDepth < subTreeDepth;
previousDepth = subTreeDepth;
subTreeStepMap.put(subTreeDepth, 0);
addPassForMove = true;
pendingProps = new HashMap<String, String>();
Expand Down

0 comments on commit d58e38e

Please sign in to comment.