@Test public void onGridOutPointsTest() { Grid grid = new Grid(session, 3, 2); int x = -1; int y = -1; while (y < 2) { while (x < 4) { assertThat(grid.onGrid(x, y)).isFalse(); x++; } x = -1; y += 3; } x = -1; y = -1; while (x < 4) { while (y < 3) { assertThat(grid.onGrid(x, y)).isFalse(); y++; } y = -1; x += 4; } }
public boolean onGrid(int x, int y) { return x >= 0 && x < width && y >= 0 && y < height; }
Grid implements Entity { public boolean onGrid(int x, int y) { return x >= 0 && x < width && y >= 0 && y < height; } }
Grid implements Entity { public boolean onGrid(int x, int y) { return x >= 0 && x < width && y >= 0 && y < height; } Grid(GameSession session, int width, int height); }
Grid implements Entity { public boolean onGrid(int x, int y) { return x >= 0 && x < width && y >= 0 && y < height; } Grid(GameSession session, int width, int height); int getWidth(); int getHeight(); GameSession getSession(); void place(int x, int y, Tileable tileable); Tile get(int x, int y); boolean onGrid(int x, int y); }
Grid implements Entity { public boolean onGrid(int x, int y) { return x >= 0 && x < width && y >= 0 && y < height; } Grid(GameSession session, int width, int height); int getWidth(); int getHeight(); GameSession getSession(); void place(int x, int y, Tileable tileable); Tile get(int x, int y); boolean onGrid(int x, int y);  }