Release for version 2
This commit is contained in:
@@ -218,7 +218,13 @@ class Board {
|
||||
|
||||
/** @return the size of each site of the board. */
|
||||
int size () { return N; }
|
||||
|
||||
|
||||
/**
|
||||
* Boards utility to give access to other player moves.
|
||||
*
|
||||
* @param playerId The id of player who asks
|
||||
* @return The moves data of all other players
|
||||
*/
|
||||
int[][] getOpponentMoves (int playerId) {
|
||||
int[][] ret = new int[moves.size()-1][Const.moveItems];
|
||||
int ii= 0, ri =0;
|
||||
@@ -229,12 +235,26 @@ class Board {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility function to create player IDs
|
||||
* @return The generated player id.
|
||||
*/
|
||||
int generatePlayerId () {
|
||||
moves.add(null);
|
||||
return moves.size() -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to update the moves of each player.
|
||||
*
|
||||
* This function is used by the players to update their position on the board.
|
||||
* After that a player can read other player positions using getOpponentMoves()
|
||||
* @see getOpponentMoves()
|
||||
*
|
||||
* @param m Reference to new move data
|
||||
* @param playerId The id of the player who update his/her data.
|
||||
*/
|
||||
void updateMove(int[] m, int playerId) {
|
||||
moves.set(playerId, Arrays.stream(m).boxed().toArray(Integer[]::new));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user