CoordinateSystem implements Serializable { public short at(int r, int c) { assert isValidOneDimensionalCoordinate(r) : "Invalid row: " + r; assert isValidOneDimensionalCoordinate(c) : "Invalid column: " + c; return (short) ((r + 1) * south + (c + 1) * EAST); } private  CoordinateSystem(int width); static String columnToString(int column); static CoordinateSystem forWidth(int width); short at(int r, int c); short at(String label); int column(short p); short[] getAllPointsOnBoard(); int getArea(); short getFirstPointBeyondBoard(); short getFirstPointBeyondExtendedBoard(); short getMaxMovesPerGame(); short[] getNeighbors(short p); int getWidth(); boolean isOnBoard(short p); boolean isValidOneDimensionalCoordinate(int c); int manhattanDistance(short p, short q); int row(short p); String rowToString(int row); String toString(short p); static final int EAST_NEIGHBOR; static final int MAX_POSSIBLE_BOARD_WIDTH; static final short NO_POINT; static final int NORTH_NEIGHBOR; static final int NORTHEAST_NEIGHBOR; static final int NORTHWEST_NEIGHBOR; static final short PASS; static final short RESIGN; static final int SOUTH_NEIGHBOR; static final int SOUTHEAST_NEIGHBOR; static final int SOUTHWEST_NEIGHBOR; static final int WEST_NEIGHBOR; static final int FIRST_DIAGONAL_NEIGHBOR; static final int FIRST_ORTHOGONAL_NEIGHBOR; static final int LAST_DIAGONAL_NEIGHBOR; static final int LAST_ORTHOGONAL_NEIGHBOR; }
@Test public void testAt() { assertEquals(c19.at("b19"), c19.at(0, 1)); assertEquals(c5.at("b5"), c5.at(0, 1)); assertEquals(CoordinateSystem.PASS, c5.at("PASS")); assertEquals(CoordinateSystem.RESIGN, c5.at("RESIGN")); }