Labyrinth
A labyrinth game assignment
|
Go to the documentation of this file.
13 package host.labyrinth;
89 ret[0] = next.
getId();
95 System.out.println(
name +
":\t*Found a supply. [score: " +
score +
"]");
99 System.out.println(
name +
":\t*Can not move.");
131 assert (
x >= 0 &&
x<
Session.
boardSize) :
"X(column) coordinate must be in the range [0, Session.boardSize)";
135 assert (
y >= 0 &&
y<
Session.
boardSize) :
"Y(row) coordinate must be in the range [0, Session.boardSize)";
static int toCol(int id)
Takes Id coordinate and return the corresponding column coordinate.
Class to hold constant values for entire application.
int playerId
The unique identifier of the player.
int x
The column coordinate of the player on the board.
int y
The row coordinate of the player on the board.
int tryPickSupply(int tileId)
Try to pick supply from a tile.
int getRow()
Read access to virtual row coordinate.
void setBoard(Board board)
void setName(String name)
Application wide object to hold settings like values for the session.
int score
The current score of the player.
boolean champion
Champion indicate a player who plays against the Minotaur.
Board board
Reference to the session's boards.
int dice()
A plain fair dice functionality provided by the board.
String name
The name of the player.
Player(int id, String name, boolean champion, Board board, int row, int column)
Create a new player and put him at the row-column coordinates.
int[] move(int id)
Player's move.
static int boardSize
Default board's size (if no one set it via command line)
static int toRow(int id)
Takes Id coordinate and return the corresponding row coordinate.
int playerTileId()
Utility to access player's tileID.
boolean isWalkable(int tileId, int direction)
Predicate to check if a direction is Walkable.
An Application wide board position implementation holding just the id coordinate.
int playerCol()
Utility to access player's column position (column coordinate)
void setChampion(boolean champion)
int playerRow()
Utility to access player's row position (row coordinate)
This class is the representation of the games's board.
int getCol()
Read access to virtual column coordinate.
Player(int id, String name, boolean champion, Board board, int tileId)
Create a new player and put him at the row-column coordinates.
static final int noSupply
Number to indicate the absent of supply.
int getId()
Read access to id coordinate.
This class represents the game's player.
static int toID(int row, int col)
Takes row and column coordinates and return the calculated Id coordinate.