13 package host.labyrinth;
39 assert (row >= 0 && row<
Session.
boardSize) :
"Row coordinate must be in the range [0, Session.boardSize)";
40 assert (col >= 0 && col<
Session.
boardSize) :
"Column coordinate must be in the range [0, Session.boardSize)";
64 :
"TileId must be in the range of [0, Session.boardSize^2)";
109 assert (row >= 0 && row<
Session.
boardSize) :
"Row coordinate must be in the range [0, Session.boardSize)";
110 assert (col >= 0 && col<
Session.
boardSize) :
"Column coordinate must be in the range [0, Session.boardSize)";
129 :
"TileId must be in the range of [0, Session.boardSize^2)";
134 this.tileId = p.getId();
195 return s.getSupplyId();
206 if (s.getSupplyId() == supplyId)
228 :
"TileId must be in the range of [0, Session.boardSize^2)";
234 assert (x >= 0 && x<
Session.
boardSize) :
"X(column) coordinate must be in the range [0, Session.boardSize)";
239 assert (y >= 0 && y<
Session.
boardSize) :
"Y(row) coordinate must be in the range [0, Session.boardSize)";
int tileId
The unique identifier of the tile.
This class is the representation of the supplies in the game.
static final int RIGHT
East direction.
int hasWalls()
Checks if the tile has walls and return the number of them.
void clearWall(int direction)
Clears the tile's wall in the requested direction.
Class to hold constant values for entire application.
void pickSupply(Supply[] supplies, int supplyId)
Utility to find a supply in the supplies array and removes it.
Tile(int id, boolean up, boolean down, boolean left, boolean right)
The main constructor of the Tile constructed from tileId.
Helper C++-like enumerator class to hold direction.
boolean hasWall(int direction)
Checks if the tile has wall in the requested direction.
void setLeft(boolean left)
boolean down
Indicator of a wall in the south side of the tile.
int x
The x coordinate(column) of the tile as if the board lies in the 1st quadrant.
This class is the representation of the board's tile.
int getId()
Read access to id coordinate.
Position position(int row, int col)
Set the position of the tile from a (row, column) pair.
int getRow()
Read access to virtual row coordinate.
int getCol()
Read access to virtual column coordinate.
static int toRow(int id)
Takes Id coordinate and return the corresponding row coordinate.
Tile(int row, int col, boolean up, boolean down, boolean left, boolean right)
The main constructor of the Tile constructed from (row,column)
Tile(Tile t)
A deep copy constructor.
int y
The y coordinate(row) of the tile as if the board lies in the 1st quadrant.
static int toCol(int id)
Takes Id coordinate and return the corresponding column coordinate.
An Application wide board position implementation holding just the id coordinate. ...
Position position(int tileId)
Set the position of the tile from a tileId.
int hasSupply(Supply[] supplies)
Utility to check if the tile has a supply.
void setWall(int direction)
Sets the tile's wall in the requested direction.
static final int noSupply
Number to indicate the absent of supply.
static int toID(int row, int col)
Takes row and column coordinates and return the calculated Id coordinate.
void setTileId(int tileId)
boolean right
Indicator of a wall in the right side of the tile.
Application wide object to hold settings like values for the session.
static int boardSize
Default board's size (if no one set it via command line)
static final int LEFT
West direction.
static final int UP
North direction.
void setRight(boolean right)
static final int DOWN
South direction.
boolean up
Indicator of a wall in the north side of the tile.
void setDown(boolean down)
boolean left
Indicator of a wall in the left side of the tile.