Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong getCoord which leads analysis hangs when enable katago ownership in rectangle board #827

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/featurecat/lizzie/gui/BoardRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1849,9 +1849,9 @@ public void drawEstimateRect(ArrayList<Double> estimateArray, boolean isZen) {
// KataGo's estimates are for player to move, not for black.
if (!Lizzie.board.getHistory().isBlacksTurn()) estimate = -estimate;
}
int[] c = Lizzie.board.getCoord(i);
int x = c[1];
int y = c[0];
int[] c = Lizzie.board.getCoordKataGo(i);
int x = c[0];
int y = c[1];
int stoneX = scaledMarginWidth + squareWidth * x;
int stoneY = scaledMarginHeight + squareHeight * y;
// g.setColor(Color.BLACK);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/featurecat/lizzie/rules/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ public static int[] getCoord(int index) {
return new int[] {x, y};
}

public static int[] getCoordKataGo(int index) {
int x = index % Board.boardWidth;
int y = (index - x) / Board.boardWidth;
return new int[] {x, y};
}

/**
* Converts a named coordinate eg C16, T5, K10, etc to an x and y coordinate
*
Expand Down