Class SimplePosition
java.lang.Object
test.SimplePosition
- All Implemented Interfaces:
IGamePosition<SimplePosition>,Serializable
A basic implementation of
IGamePosition which allows for adding of children to the tree and setting their values.
Modification of the tree beyond the addition of children is not supported. This class is meant for use in tests mainly,
and thus has limited functionality for other purposes.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final double(package private) final boolean(package private) SimplePosition(package private) final double -
Constructor Summary
ConstructorsConstructorDescriptionSimplePosition(boolean maximising, double lowerbound, double upperbound) SimplePosition(double lowerbound, double upperbound) SimplePosition(SimplePosition parent, boolean maximising, double lowerbound, double upperbound) -
Method Summary
Modifier and TypeMethodDescriptionaddAdversarial(double lowerbound, double upperbound) addChild(boolean maximising, double lowerbound, double upperbound) voidaddChild(SimplePosition child) addNonAdversarial(double lowerbound, double upperbound) voidlonghash()This method should be implemented with a hash that still remains different from similar states if a mask is applied to the hash.doubleThe lower-bound value is the lower bound on the game-theoretical mini-max value of this game position.booleannext()toString()doubleThe upper-bound value is the upper bound on the game-theoretical mini-max value of this game position.
-
Field Details
-
parent
SimplePosition parent -
lowerbound
final double lowerbound -
upperbound
final double upperbound -
maximising
final boolean maximising
-
-
Constructor Details
-
SimplePosition
public SimplePosition(SimplePosition parent, boolean maximising, double lowerbound, double upperbound) -
SimplePosition
public SimplePosition(boolean maximising, double lowerbound, double upperbound) -
SimplePosition
public SimplePosition(double lowerbound, double upperbound)
-
-
Method Details
-
addChild
-
addChild
-
addAdversarial
-
addNonAdversarial
-
clearChildren
public void clearChildren() -
next
- Specified by:
nextin interfaceIGamePosition<SimplePosition>- Returns:
- The collection of game positions directly reachable by moves from the current player to move in this game position.
-
upperbound
public double upperbound()Description copied from interface:IGamePositionThe upper-bound value is the upper bound on the game-theoretical mini-max value of this game position.For the maximising player this is the best value achievable under perfect play.
For the minimising player this is the worst-case value achievable under perfect play.
- Specified by:
upperboundin interfaceIGamePosition<SimplePosition>- Returns:
- The upper-bound value for this game position
-
lowerbound
public double lowerbound()Description copied from interface:IGamePositionThe lower-bound value is the lower bound on the game-theoretical mini-max value of this game position.For the maximising player this is the minimum value that can be guaranteed under perfect play.
For the minimising player this is the best value achievable under perfect play.
- Specified by:
lowerboundin interfaceIGamePosition<SimplePosition>- Returns:
- The lower-bound value for this game position
-
maximising
public boolean maximising()- Specified by:
maximisingin interfaceIGamePosition<SimplePosition>- Returns:
trueif the current player-to-move is maximising the score, orfalseif it is minimising the score.
-
hash
public long hash()Description copied from interface:IGamePositionThis method should be implemented with a hash that still remains different from similar states if a mask is applied to the hash. Commonly, a transposition table implementation may only use the first 20 to 26 bits of the hash to use as an index, so the hash should try to minimise collisions regardless of how many bits are included for the index.- Specified by:
hashin interfaceIGamePosition<SimplePosition>- Returns:
- a 64-bit zobrist hash or other kind of game-state hash that represents this state.
-
toString
-