Package b2p.model
Interface IState
-
- All Known Implementing Classes:
BitSetState
public interface IState
Interface defining the state of the game- Author:
- Alessandro Buldini, Alessandro Pomponio, Federico Zanini
-
-
Field Summary
Fields Modifier and Type Field Description static int
boardDimension
The board is a 9x9 square
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
blackHasWon()
Checks if the black has won the gameIState
clone()
java.util.List<IAction>
getAvailableKingMoves()
Gets all the available moves for the kingjava.util.List<IAction>
getAvailablePawnMoves()
Gets all the available moves for the pawnsB2PBitSet
getBlackPawns()
Accesses the private field black pawnsB2PBitSet
getBoard()
Accesses the private field boardint
getHeuristicValue()
Returns the heuristic value for a player in the current turnint
getHeuristicValueForPlayer(it.unibo.ai.didattica.competition.tablut.domain.State.Turn player)
Returns the heuristic value for a given player in the current turnB2PBitSet
getKing()
Accesses the private field kingit.unibo.ai.didattica.competition.tablut.domain.State.Turn
getTurn()
Accesses the private field turnB2PBitSet
getWhitePawns()
Accesses the private field white pawnsboolean
isWinningState()
Checks if the current state is a winning statevoid
performMove(int from, int to)
Performs a given action using a specified from and a specified tovoid
performMove(IAction action)
Performs a given action usingBitSetPosition
from andBitSetPosition
tovoid
performMove(java.lang.String from, java.lang.String to)
Performs a given action using a specifiedBitSetPosition
from and a specifiedBitSetPosition
tovoid
setTurn(it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn)
Sets the private field turn valueIState
simulateMove(IAction action)
Simulates a specified move from a givenIAction
boolean
whiteHasWon()
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:
True
if it is a winning state
-
blackHasWon
boolean blackHasWon()
Checks if the black has won the game- Returns:
True
if black has won
-
whiteHasWon
boolean whiteHasWon()
Checks if the white has won the game- Returns:
True
if 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
BitSetState
after the move is performed - See Also:
IAction
-
performMove
void performMove(IAction action)
Performs a given action usingBitSetPosition
from andBitSetPosition
to- 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 specifiedBitSetPosition
from and a specifiedBitSetPosition
to- 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
List
of possible actions - See Also:
IAction
-
getAvailableKingMoves
java.util.List<IAction> getAvailableKingMoves()
Gets all the available moves for the king- Returns:
- A
List
of 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()
-
-