From 8149803c3bd44bf5fd550981ae54b3387e76d78d Mon Sep 17 00:00:00 2001 From: Hiraoka Date: Sat, 6 Nov 2021 21:10:10 +0900 Subject: [PATCH] fix wrong getCoord further --- src/main/java/featurecat/lizzie/gui/BoardRenderer.java | 6 +++--- src/main/java/featurecat/lizzie/rules/Board.java | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/BoardRenderer.java b/src/main/java/featurecat/lizzie/gui/BoardRenderer.java index 76351c04d..9d834454d 100644 --- a/src/main/java/featurecat/lizzie/gui/BoardRenderer.java +++ b/src/main/java/featurecat/lizzie/gui/BoardRenderer.java @@ -1849,9 +1849,9 @@ public void drawEstimateRect(ArrayList 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); diff --git a/src/main/java/featurecat/lizzie/rules/Board.java b/src/main/java/featurecat/lizzie/rules/Board.java index f51fe40ab..4a38fe69a 100644 --- a/src/main/java/featurecat/lizzie/rules/Board.java +++ b/src/main/java/featurecat/lizzie/rules/Board.java @@ -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}; }