13 package host.labyrinth;
15 import java.util.ArrayList;
42 this.
path =
new ArrayList<Integer[]>();
65 this.
path =
new ArrayList<Integer[]>();
100 int supplyFlag =0, moveFlag =0;
107 ret[0] = next.
getId();
120 ret[0], diceDirection, moveFlag, supplyFlag,
132 if (!
path.isEmpty()) {
133 Integer[] last =
path.get(
path.size()-1);
134 String who = String.format(
"%12s",
name);
135 System.out.print(who +
": score[" +
score +
"]" +
", dice =" + last[1] +
", tileId =" + last[0] +
" (" +
Position.
toRow(last[0]) +
", " +
Position.
toCol(last[0]) +
")");
137 System.out.println(
" *Can not move.");
138 else if (last[3] != 0)
139 System.out.println(
" *Found a supply.");
141 System.out.println(
"");
188 assert (x >= 0 && x<
Session.
boardSize) :
"X(column) coordinate must be in the range [0, Session.boardSize)";
192 assert (y >= 0 && y<
Session.
boardSize) :
"Y(row) coordinate must be in the range [0, Session.boardSize)";
217 protected ArrayList<Integer[]>
path;
static final int RIGHT
East direction.
void setBoard(Board board)
This class is the representation of the games's board.
Class to hold constant values for entire application.
ArrayList< Integer[]> getPath()
void setChampion(boolean champion)
void setName(String name)
int playerCol()
Utility to access player's column position (column coordinate)
void setDirCounter(int[] dirCounter)
Helper C++-like enumerator class to hold direction.
boolean champion
Champion indicate a player who plays against the Minotaur.
static final int End
Iterator style end of range direction (one place after the last)
int playerTileId()
Utility to access player's tileID.
int x
The column coordinate of the player on the board.
This class represents the game's player.
Board board
Reference to the session's boards.
Player(String name, boolean champion, Board board, int row, int column)
Create a new player and put him at the row-column coordinates.
void setPath(ArrayList< Integer[]> path)
int [] move(int id)
Player's move.
void statistics()
Prints round information for the player.
void final_statistics()
Prints final statistics for the player.
Helper C++ like enumerator class for direction ranged loops.
int getId()
Read access to id coordinate.
static final int moveItems
The number of items return by move()
int getRow()
Read access to virtual row coordinate.
int y
The row coordinate of the player on the board.
int getCol()
Read access to virtual column coordinate.
static int toRow(int id)
Takes Id coordinate and return the corresponding row coordinate.
int score
The current score of the player.
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. ...
int generatePlayerId()
Utility function to create player IDs.
int dice()
A plain fair dice functionality provided by the board.
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)
boolean isWalkable(int tileId, int direction)
Predicate to check if a direction is Walkable.
static final int LEFT
West direction.
static final int UP
North direction.
static final int noOpponent
Number to indicate the absent of supply.
void updateMove(int[] m, int playerId)
Utility to update the moves of each player.
String name
The name of the player.
static final int DOWN
South direction.
int playerRow()
Utility to access player's row position (row coordinate)
ArrayList< Integer[]> path
our history.
int tryPickSupply(int tileId)
Try to pick supply from a tile.
int playerId
The unique identifier of the player.
Player(String name, boolean champion, Board board, int tileId)
Create a new player and put him at the row-column coordinates.