Interface ImmutablePosition

All Known Subinterfaces:
MoveablePosition, MutablePosition
All Known Implementing Classes:
AbstractMoveablePosition, AbstractMutablePosition, AbstractPosition, CompactPosition, LightWeightPosition, Position

public interface ImmutablePosition
Version:
$Revision: 1.1 $
Author:
Bernhard Seybold
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the still allowed castles as mask.
    Return the FEN representation of the current position FEN
    int
    Return the number of moves since the last capture and the last pawn move.
    long
    Returns a 64bit hash code of the current position. 64bit should be enough to disnstinguish positions with almost no collisions.
    int
    Return the current ply number.
    int
    Return the current en passant square.
    int
    getStone(int sqi)
    Return the stone currently on the given square.
    int
    Return the player whose turn it is.
    int
    Returns a 32bit hash code of the current position. 32 bit is not enough to distinguish positions reliably, use only if collisions are handled.
    boolean
    Return whether the current position is legal.
    boolean
    Returns whether the represented position is the startposition
    void
    Validates the internal state.
  • Field Details

  • Method Details

    • getStone

      int getStone(int sqi)
      Return the stone currently on the given square.
      Parameters:
      sqi - the square
      Returns:
      the stone of the given square
    • getSqiEP

      int getSqiEP()
      Return the current en passant square.
      Returns:
      the current en passant square, NO_SQUARE if none
    • getCastles

      int getCastles()
      Return the still allowed castles as mask.
      Returns:
      the still allowed castles as mask.
    • getToPlay

      int getToPlay()
      Return the player whose turn it is.
      Returns:
      the player whose turn it is
    • getPlyNumber

      int getPlyNumber()
      Return the current ply number.
      Returns:
      the current ply number, starting at play no. 0
    • getHalfMoveClock

      int getHalfMoveClock()
      Return the number of moves since the last capture and the last pawn move. This number is used for the 50-move rule.
      Returns:
      the number of moves since the last capture and the last pawn move
    • isLegal

      boolean isLegal()
      Return whether the current position is legal.
      Returns:
      whether the current position is legal
    • getFEN

      String getFEN()
      Return the FEN representation of the current position FEN
      Returns:
      the FEN representation of the current position
    • isStartPosition

      boolean isStartPosition()
      Returns whether the represented position is the startposition
      Returns:
      whether the represented position is the startposition
    • getHashCode

      long getHashCode()
      Returns a 64bit hash code of the current position. 64bit should be enough to disnstinguish positions with almost no collisions. TODO: add reference to paper
      Returns:
      a 64bit hash code
    • hashCode

      int hashCode()
      Returns a 32bit hash code of the current position. 32 bit is not enough to distinguish positions reliably, use only if collisions are handled.
      Overrides:
      hashCode in class Object
      Returns:
      a 32bit hash code
    • validate

      void validate() throws IllegalPositionException
      Validates the internal state. Used for debugging and testing.
      Throws:
      IllegalPositionException - if the internal state is illegal