Did commenting
This commit is contained in:
parent
4cb2eecac4
commit
c5bad831e6
|
@ -128,6 +128,15 @@ public class MalteAI implements Player{
|
|||
return weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates basic weight for two opposing directions in a position on the board.
|
||||
* The sequences are analysed in order to find patterns in them, that influence the
|
||||
* weight.
|
||||
*
|
||||
* @param x The first sequence.
|
||||
* @param y The second sequence.
|
||||
* @return The calculated weight.
|
||||
*/
|
||||
private double getBaseWeightForSequences(Sequence x, Sequence y) {
|
||||
double W_PRIORITY_1 = 2 << 8;
|
||||
double W_PRIORITY_2 = 2 << 6;
|
||||
|
@ -197,7 +206,11 @@ public class MalteAI implements Player{
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the last empty Position in this column.
|
||||
*
|
||||
* @param board The current board.
|
||||
* @param column The column to dive into.
|
||||
* @return The position on top of the first piece in this column.
|
||||
*/
|
||||
private Position getLastEmpty(int[][] board, int column) {
|
||||
if (board[column][0] != 0) {
|
||||
|
@ -212,7 +225,10 @@ public class MalteAI implements Player{
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns whether this position is in the boundaries of the board.
|
||||
*
|
||||
* @param pos The Position to be checked.
|
||||
* @return Is the position on the board.
|
||||
*/
|
||||
private boolean isPosOnBoard(Position pos) {
|
||||
if (pos.getPosX() <= Game.GAME_COLUMNS - 1 &&
|
||||
|
@ -225,7 +241,11 @@ public class MalteAI implements Player{
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the ID at the given Position on the given board.
|
||||
*
|
||||
* @param board The current game's board.
|
||||
* @param pos The position to be checked.
|
||||
* @param board[pos.X][pos.Y];
|
||||
*/
|
||||
private int getIDFromBoard(int[][] board, Position pos) {
|
||||
return board[pos.getPosX()][pos.getPosY()];
|
||||
|
|
Loading…
Reference in a new issue