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 further #1

Merged
merged 1 commit into from
Nov 7, 2021
Merged
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
10 changes: 8 additions & 2 deletions src/main/java/featurecat/lizzie/rules/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ public static int getIndex(int x, int y) {
}

public static int[] getCoord(int index) {
int y = index % Board.boardWidth;
int x = (index - y) / Board.boardWidth;
int y = index % Board.boardHeight;
int x = (index - y) / Board.boardHeight;
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};
}

Expand Down