10 package host.labyrinth;
34 assert (row >= 0 && row<
Session.
boardSize) :
"Row coordinate must be in the range [0, Session.boardSize)";
35 assert (col >= 0 && col<
Session.
boardSize) :
"Column coordinate must be in the range [0, Session.boardSize)";
53 :
"TileId must be in the range of [0, Session.boardSize^2)";
103 assert (row >= 0 && row<
Session.
boardSize) :
"Row coordinate must be in the range [0, Session.boardSize)";
104 assert (col >= 0 && col<
Session.
boardSize) :
"Column coordinate must be in the range [0, Session.boardSize)";
123 :
"TileId must be in the range of [0, Session.boardSize^2)";
152 assert (x >= 0 && x<
Session.
boardSize) :
"X(column) coordinate must be in the range [0, Session.boardSize)";
157 assert (y >= 0 && y<
Session.
boardSize) :
"Y(row) coordinate must be in the range [0, Session.boardSize)";
163 :
"TileId must be in the range of [0, Session.boardSize^2)";
This class is the representation of the supplies in the game.
Class to hold constant values for entire application.
int supplyId
The unique identifier of the tile.
Supply(int id, int row, int col)
The main constructor of the Supply constructed from (row,column)
Position position(int row, int col)
Set the position of the supply from a (row, column) pair.
void removeSupply()
Marks the supply removed.
int supplyTileId
The Id of the tile on the board, in witch the supply is located.
int x
The x coordinate of the tile as if the board lies in the 1st quadrant.
int getId()
Read access to id coordinate.
int getRow()
Read access to virtual row coordinate.
Position position(int tileId)
Set the position of the supply from a tileId.
int getCol()
Read access to virtual column coordinate.
static int toRow(int id)
Takes Id coordinate and return the corresponding row coordinate.
Supply(Supply s)
A deep copy constructor.
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. ...
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.
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)
int supplyId(int sID)
Set the supplyId.
void setSupplyTileId(int tileId)
int y
The y coordinate of the tile as if the board lies in the 1st quadrant.
Supply(int id, int tileId)
A second constructor of the Supply constructed from supplyTileId.