Skip to content

Commit

Permalink
Merge pull request #354 from TFiFiE/patch-1
Browse files Browse the repository at this point in the history
Fixed inversion of named y-coordinate.
  • Loading branch information
featurecat authored Oct 1, 2018
2 parents d7fd4c6 + dfe6101 commit 562abd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/featurecat/lizzie/rules/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static int[] convertNameToCoordinates(String namedCoordinate) {
}
// coordinates take the form C16 A19 Q5 K10 etc. I is not used.
int x = alphabet.indexOf(namedCoordinate.charAt(0));
int y = Integer.parseInt(namedCoordinate.substring(1)) - 1;
int y = BOARD_SIZE - Integer.parseInt(namedCoordinate.substring(1));
return new int[]{x, y};
}

Expand All @@ -86,7 +86,7 @@ public static int[] convertNameToCoordinates(String namedCoordinate) {
*/
public static String convertCoordinatesToName(int x, int y) {
// coordinates take the form C16 A19 Q5 K10 etc. I is not used.
return alphabet.charAt(x) + "" + (y + 1);
return alphabet.charAt(x) + "" + (BOARD_SIZE - y);
}

/**
Expand Down

0 comments on commit 562abd9

Please sign in to comment.