private boolean southWestCheck() { TileEmpty empty = new TileEmpty(this); if (tileAt(1, 12).getClass().equals(empty.getClass())) { return false; } return true; }
private boolean northEastCheck() { TileEmpty empty = new TileEmpty(this); if (tileAt(12, 1).getClass().equals(empty.getClass())) { return false; } return true; }
private boolean northWallCheck() { TileEmpty empty = new TileEmpty(this); for (int x = 2; x < 12; x++) { if (tileAt(x, 1).getClass().equals(empty.getClass())) { return false; } } return true; }
private boolean eastWallCheck() { TileEmpty empty = new TileEmpty(this); for (int y = 2; y < 12; y++) { if (tileAt(12, y).getClass().equals(empty.getClass())) { return false; } } return true; }
private boolean middleCheck() { TileEmpty empty = new TileEmpty(this); for (int x = 2; x < 12; x++) { for (int y = 2; y < 12; y++) { if (tileAt(x, y).getClass().equals(empty.getClass())) { return false; } } } return true; }
/*This method places a given tile at the given x and y position if and only if the x and y values are actual board positions and the tile already there is empty * The method then checks whether or not that placement was a legal move or not, stores that information so that the game knows whether or not it can commit that move * It returns true if the tile was successfully placed, even if it was an illegal placement, and returns false if the tile was not place(i.e. there was already a tile there or the given x and y were not legitimate values) */ public boolean placeTile(int x, int y, Tile tile) { TileEmpty empty = new TileEmpty(this); if (x > 0 && x < 13 && y > 0 && y < 13 && (!(x == 6 && y == 6)) && (!(x == 6 && y == 7)) && (!(x == 7 && y == 6)) && (!(x == 7 && y == 7))) { if (tileAt(x, y).getClass().equals(empty.getClass())) { _board[x][y] = tile; _currentX = x; _currentY = y; setTileIsLegal(x, y, tile); return true; } } return false; }