Class AbstractPosition

java.lang.Object
chesspresso.position.AbstractPosition
All Implemented Interfaces:
ImmutablePosition
Direct Known Subclasses:
AbstractMutablePosition, CompactPosition

public abstract class AbstractPosition extends Object implements ImmutablePosition
Version:
$Revision: 1.1 $
Author:
Bernhard Seybold
  • Field Details

    • HASH_ALL_MASK

      protected static long HASH_ALL_MASK
    • HASH_TOPLAY_MASK

      protected static long HASH_TOPLAY_MASK
    • HASH_TOPLAY_MULT

      protected static long HASH_TOPLAY_MULT
    • s_hashMod

      protected static long[][] s_hashMod
    • s_hashCastleMod

      protected static long[] s_hashCastleMod
    • s_hashEPMod

      protected static long[] s_hashEPMod
  • Constructor Details

    • AbstractPosition

      public AbstractPosition()
  • Method Details

    • getStartPositionHashCode

      protected static long getStartPositionHashCode()
    • isWhiteToPlay

      public static boolean isWhiteToPlay(long hashCode)
    • getHashCode

      public long getHashCode()
      Description copied from interface: ImmutablePosition
      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
      Specified by:
      getHashCode in interface ImmutablePosition
      Returns:
      a 64bit hash code
    • hashCode

      public final int hashCode()
      Description copied from interface: ImmutablePosition
      Returns a 32bit hash code of the current position. 32 bit is not enough to distinguish positions reliably, use only if collisions are handled.
      Specified by:
      hashCode in interface ImmutablePosition
      Overrides:
      hashCode in class Object
      Returns:
      a 32bit hash code
    • isStartPosition

      public final boolean isStartPosition()
      Description copied from interface: ImmutablePosition
      Returns whether the represented position is the startposition
      Specified by:
      isStartPosition in interface ImmutablePosition
      Returns:
      whether the represented position is the startposition
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getFEN

      public String getFEN()
      Description copied from interface: ImmutablePosition
      Return the FEN representation of the current position FEN
      Specified by:
      getFEN in interface ImmutablePosition
      Returns:
      the FEN representation of the current position
    • isCastlePossible

      public boolean isCastlePossible(int castle)
    • isSquarePossibleEPSquare

      public boolean isSquarePossibleEPSquare(int sqi)
    • isLegal

      public boolean isLegal()
      Description copied from interface: ImmutablePosition
      Return whether the current position is legal.
      Specified by:
      isLegal in interface ImmutablePosition
      Returns:
      whether the current position is legal
    • validate

      public void validate() throws IllegalPositionException
      Description copied from interface: ImmutablePosition
      Validates the internal state. Used for debugging and testing.
      Specified by:
      validate in interface ImmutablePosition
      Throws:
      IllegalPositionException - if the internal state is illegal
    • toString

      public String toString()
      Overrides:
      toString in class Object