Package b2p.model
Interface IState
-
- All Known Implementing Classes:
BitSetState
public interface IStateInterface defining the state of the game- Author:
- Alessandro Buldini, Alessandro Pomponio, Federico Zanini
-
-
Field Summary
Fields Modifier and Type Field Description static intboardDimensionThe board is a 9x9 square
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanblackHasWon()Checks if the black has won the gameIStateclone()java.util.List<IAction>getAvailableKingMoves()Gets all the available moves for the kingjava.util.List<IAction>getAvailablePawnMoves()Gets all the available moves for the pawnsB2PBitSetgetBlackPawns()Accesses the private field black pawnsB2PBitSetgetBoard()Accesses the private field boardintgetHeuristicValue()Returns the heuristic value for a player in the current turnintgetHeuristicValueForPlayer(it.unibo.ai.didattica.competition.tablut.domain.State.Turn player)Returns the heuristic value for a given player in the current turnB2PBitSetgetKing()Accesses the private field kingit.unibo.ai.didattica.competition.tablut.domain.State.TurngetTurn()Accesses the private field turnB2PBitSetgetWhitePawns()Accesses the private field white pawnsbooleanisWinningState()Checks if the current state is a winning statevoidperformMove(int from, int to)Performs a given action using a specified from and a specified tovoidperformMove(IAction action)Performs a given action usingBitSetPositionfrom andBitSetPositiontovoidperformMove(java.lang.String from, java.lang.String to)Performs a given action using a specifiedBitSetPositionfrom and a specifiedBitSetPositiontovoidsetTurn(it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn)Sets the private field turn valueIStatesimulateMove(IAction action)Simulates a specified move from a givenIActionbooleanwhiteHasWon()Checks if the white has won the game
-
-
-
Field Detail
-
boardDimension
static final int boardDimension
The board is a 9x9 square- See Also:
- Constant Field Values
-
-
Method Detail
-
getTurn
it.unibo.ai.didattica.competition.tablut.domain.State.Turn getTurn()
Accesses the private field turn- Returns:
- the current turn
- See Also:
State.Turn
-
setTurn
void setTurn(it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn)
Sets the private field turn value- Parameters:
turn- is a Turn data type- See Also:
State.Turn
-
getBlackPawns
B2PBitSet getBlackPawns()
Accesses the private field black pawns- Returns:
- B2PBitSet containing black pawns
- See Also:
B2PBitSet
-
getWhitePawns
B2PBitSet getWhitePawns()
Accesses the private field white pawns- Returns:
- B2PBitSet containing white pawns
- See Also:
B2PBitSet
-
getKing
B2PBitSet getKing()
Accesses the private field king- Returns:
- B2PBitSet containing the king
- See Also:
B2PBitSet
-
getBoard
B2PBitSet getBoard()
Accesses the private field board- Returns:
- B2PBitSet containing the board
- See Also:
B2PBitSet
-
isWinningState
boolean isWinningState()
Checks if the current state is a winning state- Returns:
Trueif it is a winning state
-
blackHasWon
boolean blackHasWon()
Checks if the black has won the game- Returns:
Trueif black has won
-
whiteHasWon
boolean whiteHasWon()
Checks if the white has won the game- Returns:
Trueif white has won
-
simulateMove
IState simulateMove(IAction action)
Simulates a specified move from a givenIAction- Parameters:
action- IAction representing the action to simulate- Returns:
- A copy of the
BitSetStateafter the move is performed - See Also:
IAction
-
performMove
void performMove(IAction action)
Performs a given action usingBitSetPositionfrom andBitSetPositionto- Parameters:
action- IAction representing the action to perform- See Also:
IAction,BitSetPosition
-
performMove
void performMove(java.lang.String from, java.lang.String to)Performs a given action using a specifiedBitSetPositionfrom and a specifiedBitSetPositionto- Parameters:
from- String representing the starting positionto- String representing the final position- See Also:
BitSetPosition
-
performMove
void performMove(int from, int to)Performs a given action using a specified from and a specified to- Parameters:
from- Integer representing the starting positionto- Integer representing the final position
-
getAvailablePawnMoves
java.util.List<IAction> getAvailablePawnMoves()
Gets all the available moves for the pawns- Returns:
- A
Listof possible actions - See Also:
IAction
-
getAvailableKingMoves
java.util.List<IAction> getAvailableKingMoves()
Gets all the available moves for the king- Returns:
- A
Listof possible actions - See Also:
IAction
-
getHeuristicValue
int getHeuristicValue()
Returns the heuristic value for a player in the current turn- Returns:
- the heuristic value for a player in the current turn
- See Also:
State.Turn
-
getHeuristicValueForPlayer
int getHeuristicValueForPlayer(it.unibo.ai.didattica.competition.tablut.domain.State.Turn player)
Returns the heuristic value for a given player in the current turn- Parameters:
player- is a Turn object- Returns:
- the heuristic value for a given player in the current turn
- See Also:
State.Turn
-
clone
IState clone()
-
-