This class represents the game's player who cheats.
More...
|
|
int | supplyInDirection (int currentPos, int direction) |
| Utility to get the distance of a possible supply in some direction. More...
|
|
int | opponetInDirection (int currentPos, int direction) |
| Utility to get the distance of a possible opponent in some direction. More...
|
|
double | evaluate (int currentPos, int direction) |
| This is the main move evaluation function. More...
|
|
int | getNextMove (int currentPos) |
|
int [] | move (int id) |
| HeuristicPlayer's move. More...
|
|
void | statistics () |
| Prints round information for the player. More...
|
|
void | final_statistics () |
| Prints final statistics for the player. More...
|
|
| Player (String name, boolean champion, Board board, int row, int column) |
| Create a new player and put him at the row-column coordinates. More...
|
|
| Player (String name, boolean champion, Board board, int tileId) |
| Create a new player and put him at the row-column coordinates. More...
|
|
int [] | move (int id) |
| Player's move. More...
|
|
void | statistics () |
| Prints round information for the player. More...
|
|
void | final_statistics () |
| Prints final statistics for the player. More...
|
|
int | playerTileId () |
| Utility to access player's tileID. More...
|
|
int | playerRow () |
| Utility to access player's row position (row coordinate) More...
|
|
int | playerCol () |
| Utility to access player's column position (column coordinate) More...
|
|
int | getPlayerId () |
|
String | getName () |
|
Board | getBoard () |
|
int | getScore () |
|
int | getX () |
|
int | getY () |
|
boolean | getChampion () |
|
int [] | getDirCounter () |
|
ArrayList< Integer[]> | getPath () |
|
void | setPlayerId (int id) |
|
void | setName (String name) |
|
void | setBoard (Board board) |
|
void | setScore (int score) |
|
void | setX (int x) |
|
void | setY (int y) |
|
void | setChampion (boolean champion) |
|
|
int | directionOfMax (double[] eval, int[] eval_dir, int N) |
| A small utility to extract the direction of maximum evaluation result. More...
|
|
boolean | isUnevaluated (double[] eval, int N) |
| A small utility to check if there is at least one evaluation result in the eval array. More...
|
|
This class represents the game's player who cheats.
Definition at line 19 of file HeuristicPlayer.java.
◆ HeuristicPlayer() [1/2]
host.labyrinth.HeuristicPlayer.HeuristicPlayer |
( |
String |
name, |
|
|
boolean |
champion, |
|
|
Board |
board, |
|
|
int |
row, |
|
|
int |
column |
|
) |
| |
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 32 of file HeuristicPlayer.java.
◆ HeuristicPlayer() [2/2]
host.labyrinth.HeuristicPlayer.HeuristicPlayer |
( |
String |
name, |
|
|
boolean |
champion, |
|
|
Board |
board, |
|
|
int |
tileId |
|
) |
| |
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 43 of file HeuristicPlayer.java.
◆ directionOfMax()
int host.labyrinth.HeuristicPlayer.directionOfMax |
( |
double [] |
eval, |
|
|
int [] |
eval_dir, |
|
|
int |
N |
|
) |
| |
|
private |
A small utility to extract the direction of maximum evaluation result.
We search into the eval
results and find the index of the maximum evaluation. Then we return the direction of eval_dir
matrix at the same index we found.
- Parameters
-
eval | Array with evaluation results for each direction |
eval_dir | Array with the matching direction to eval array |
N | The size of both arrays |
- Returns
- The direction of maximum evaluation. If
eval
is empty returns the first item eval
[0]
- Note
- This function should not be called if there is at least one evaluation result in
eval
Definition at line 235 of file HeuristicPlayer.java.
◆ evaluate()
double host.labyrinth.HeuristicPlayer.evaluate |
( |
int |
currentPos, |
|
|
int |
direction |
|
) |
| |
|
package |
This is the main move evaluation function.
- Parameters
-
currentPos | The current position of the player (before the move to evaluate) |
direction | The direction (a.k.a. the move) to evaluate |
- Returns
- A signed real number. The higher the output, the higher the evaluation.
Definition at line 94 of file HeuristicPlayer.java.
◆ final_statistics()
void host.labyrinth.HeuristicPlayer.final_statistics |
( |
| ) |
|
|
package |
◆ getNextMove()
int host.labyrinth.HeuristicPlayer.getNextMove |
( |
int |
currentPos | ) |
|
|
package |
◆ isUnevaluated()
boolean host.labyrinth.HeuristicPlayer.isUnevaluated |
( |
double [] |
eval, |
|
|
int |
N |
|
) |
| |
|
private |
A small utility to check if there is at least one evaluation result in the eval
array.
- Parameters
-
eval | The array to check |
N | The size of the array |
- Returns
- True if there is none, false otherwise
Definition at line 253 of file HeuristicPlayer.java.
◆ move()
int [] host.labyrinth.HeuristicPlayer.move |
( |
int |
id | ) |
|
|
package |
HeuristicPlayer's move.
A player of this kind cheats. He does not throw a dice to get a direction. In contrary he calculates his next move very carefully. 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 supplyId in case player picked one (Const.noSupply otherwise).
Definition at line 151 of file HeuristicPlayer.java.
◆ opponetInDirection()
int host.labyrinth.HeuristicPlayer.opponetInDirection |
( |
int |
currentPos, |
|
|
int |
direction |
|
) |
| |
|
package |
Utility to get the distance of a possible opponent in some direction.
- Parameters
-
currentPos | The current position of the player |
direction | The direction to check |
- Returns
- The distance or Const.noOpponent
Definition at line 74 of file HeuristicPlayer.java.
◆ statistics()
void host.labyrinth.HeuristicPlayer.statistics |
( |
| ) |
|
|
package |
◆ supplyInDirection()
int host.labyrinth.HeuristicPlayer.supplyInDirection |
( |
int |
currentPos, |
|
|
int |
direction |
|
) |
| |
|
package |
Utility to get the distance of a possible supply in some direction.
- Parameters
-
currentPos | The current position of the player |
direction | The direction to check |
- Returns
- The distance or Const.noSupply
Definition at line 57 of file HeuristicPlayer.java.
The documentation for this class was generated from the following file: