Class SimplePosition

java.lang.Object
test.SimplePosition
All Implemented Interfaces:
IGamePosition<SimplePosition>, Serializable

public class SimplePosition extends Object implements 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 Details

    • 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

      public void addChild(SimplePosition child)
    • addChild

      public SimplePosition addChild(boolean maximising, double lowerbound, double upperbound)
    • addAdversarial

      public SimplePosition addAdversarial(double lowerbound, double upperbound)
    • addNonAdversarial

      public SimplePosition addNonAdversarial(double lowerbound, double upperbound)
    • clearChildren

      public void clearChildren()
    • next

      public Collection<SimplePosition> next()
      Specified by:
      next in interface IGamePosition<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: IGamePosition
      The 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:
      upperbound in interface IGamePosition<SimplePosition>
      Returns:
      The upper-bound value for this game position
    • lowerbound

      public double lowerbound()
      Description copied from interface: IGamePosition
      The 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:
      lowerbound in interface IGamePosition<SimplePosition>
      Returns:
      The lower-bound value for this game position
    • maximising

      public boolean maximising()
      Specified by:
      maximising in interface IGamePosition<SimplePosition>
      Returns:
      true if the current player-to-move is maximising the score, or false if it is minimising the score.
    • hash

      public long hash()
      Description copied from interface: IGamePosition
      This 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:
      hash in interface IGamePosition<SimplePosition>
      Returns:
      a 64-bit zobrist hash or other kind of game-state hash that represents this state.
    • toString

      public String toString()
      Overrides:
      toString in class Object