This class represents the game's player.
More...
This class represents the game's player.
Definition at line 21 of file Player.java.
◆ Player() [1/2]
host.labyrinth.Player.Player |
( |
String |
name, |
|
|
boolean |
champion, |
|
|
Board |
board, |
|
|
int |
row, |
|
|
int |
column |
|
) |
| throws Exception |
|
package |
Create a new player and put him at the row-column coordinates.
- Parameters
-
name | The name of the player |
champion | Flag to indicate if a player is a champion |
board | Reference to the board of the game |
row | The row coordinate of initial player position |
column | The column coordinate of initial player's position |
Definition at line 40 of file Player.java.
◆ Player() [2/2]
host.labyrinth.Player.Player |
( |
String |
name, |
|
|
boolean |
champion, |
|
|
Board |
board, |
|
|
int |
tileId |
|
) |
| throws Exception |
|
package |
Create a new player and put him at the row-column coordinates.
- Parameters
-
name | The name of the player |
champion | Flag to indicate if a player is a champion |
board | Reference to the board of the game |
tileId | The tileId coordinate of player's initial position |
Definition at line 63 of file Player.java.
◆ final_statistics()
void host.labyrinth.Player.final_statistics |
( |
| ) |
|
|
package |
◆ getBoard()
Board host.labyrinth.Player.getBoard |
( |
| ) |
|
|
package |
◆ getChampion()
boolean host.labyrinth.Player.getChampion |
( |
| ) |
|
|
package |
◆ getDirCounter()
int [] host.labyrinth.Player.getDirCounter |
( |
| ) |
|
|
package |
◆ getName()
String host.labyrinth.Player.getName |
( |
| ) |
|
|
package |
◆ getPath()
ArrayList<Integer[]> host.labyrinth.Player.getPath |
( |
| ) |
|
|
package |
◆ getPlayerId()
int host.labyrinth.Player.getPlayerId |
( |
| ) |
|
|
package |
◆ getScore()
int host.labyrinth.Player.getScore |
( |
| ) |
|
|
package |
◆ getX()
int host.labyrinth.Player.getX |
( |
| ) |
|
|
package |
◆ getY()
int host.labyrinth.Player.getY |
( |
| ) |
|
|
package |
◆ move()
int [] host.labyrinth.Player.move |
( |
int |
id | ) |
|
|
package |
Player's move.
A player first throws a dice to get a random direction. Then checks if the direction is walkable. If it is, then goes to that tile and update player's data. If the player is a champion then he also picks up a possible supply from the tile.
- Parameters
-
id | The id of the starting tile. |
- Returns
- An array containing player's final position and possible supply of that position. The array format is:
-
int[0]: The tileId of the final player's position.
-
int[1]: The row of the final player's position.
-
int[2]: The column of the final player's position.
-
int[3]: The dice/direction of the move.
Definition at line 100 of file Player.java.
◆ playerCol()
int host.labyrinth.Player.playerCol |
( |
| ) |
|
|
package |
Utility to access player's column position (column coordinate)
Definition at line 169 of file Player.java.
◆ playerRow()
int host.labyrinth.Player.playerRow |
( |
| ) |
|
|
package |
Utility to access player's row position (row coordinate)
Definition at line 167 of file Player.java.
◆ playerTileId()
int host.labyrinth.Player.playerTileId |
( |
| ) |
|
|
package |
Utility to access player's tileID.
Definition at line 165 of file Player.java.
◆ setBoard()
void host.labyrinth.Player.setBoard |
( |
Board |
board | ) |
|
|
package |
◆ setChampion()
void host.labyrinth.Player.setChampion |
( |
boolean |
champion | ) |
|
|
package |
◆ setDirCounter()
void host.labyrinth.Player.setDirCounter |
( |
int [] |
dirCounter | ) |
|
|
package |
◆ setName()
void host.labyrinth.Player.setName |
( |
String |
name | ) |
|
|
package |
◆ setPath()
void host.labyrinth.Player.setPath |
( |
ArrayList< Integer[]> |
path | ) |
|
|
package |
◆ setPlayerId()
void host.labyrinth.Player.setPlayerId |
( |
int |
id | ) |
|
|
package |
◆ setScore()
void host.labyrinth.Player.setScore |
( |
int |
score | ) |
|
|
package |
◆ setX()
void host.labyrinth.Player.setX |
( |
int |
x | ) |
|
|
package |
◆ setY()
void host.labyrinth.Player.setY |
( |
int |
y | ) |
|
|
package |
◆ statistics()
void host.labyrinth.Player.statistics |
( |
| ) |
|
|
package |
Prints round information for the player.
Definition at line 140 of file Player.java.
◆ board
Board host.labyrinth.Player.board |
|
protected |
Reference to the session's boards.
Definition at line 220 of file Player.java.
◆ champion
boolean host.labyrinth.Player.champion |
|
protected |
Champion indicate a player who plays against the Minotaur.
Definition at line 224 of file Player.java.
◆ dirCounter
int host.labyrinth.Player.dirCounter[] |
|
protected |
◆ MOVE_COLUMN
final int host.labyrinth.Player.MOVE_COLUMN = 2 |
|
staticpackage |
The index of column information.
Definition at line 26 of file Player.java.
◆ MOVE_DATA_SIZE
final int host.labyrinth.Player.MOVE_DATA_SIZE = 4 |
|
staticpackage |
Helper variables to keep track of the move() return values.
- See also
- move() The move return data array size
Definition at line 23 of file Player.java.
◆ MOVE_DICE
final int host.labyrinth.Player.MOVE_DICE = 3 |
|
staticpackage |
The index of dice information.
Definition at line 27 of file Player.java.
◆ MOVE_ROW
final int host.labyrinth.Player.MOVE_ROW = 1 |
|
staticpackage |
The index of row information.
Definition at line 25 of file Player.java.
◆ MOVE_TILE_ID
final int host.labyrinth.Player.MOVE_TILE_ID = 0 |
|
staticpackage |
Index of the tileId information of the move.
Definition at line 24 of file Player.java.
◆ name
String host.labyrinth.Player.name |
|
protected |
◆ path
ArrayList<Integer[]> host.labyrinth.Player.path |
|
protected |
our history.
The integer[] format is:
-
Integer[0]: tileId - The tile id we choose for the move
-
Integer[1]: dice - The dice (a.k.a direction) of move
-
Integer[2]: moveStatus - True if it was successful (we can move in that direction)
-
Integer[3]: tookSupply - True if we took supply
-
Integer[4]: upCounter - Accumulator to count all the up moves
-
Integer[5]: righrCounter - Accumulator to count all the right moves
-
Integer[6]: downCounter - Accumulator to count all the down moves
-
Integer[7]: leftCounter - Accumulator to count all the left moves
-
Integer[8]: SupDistance - The distance of the nearest supply (only for heuristic players)
-
Integer[9]: OppDistance - The distance of the nearest opponent (only for heuristic players)
}
Definition at line 226 of file Player.java.
◆ playerId
int host.labyrinth.Player.playerId |
|
protected |
The unique identifier of the player.
Definition at line 218 of file Player.java.
◆ score
int host.labyrinth.Player.score |
|
protected |
The current score of the player.
Definition at line 221 of file Player.java.
int host.labyrinth.Player.x |
|
protected |
The column coordinate of the player on the board.
Definition at line 222 of file Player.java.
int host.labyrinth.Player.y |
|
protected |
The row coordinate of the player on the board.
Definition at line 223 of file Player.java.
The documentation for this class was generated from the following file: