chesspresso.position
Class CompactPosition

java.lang.Object
  |
  +--chesspresso.position.AbstractPosition
        |
        +--chesspresso.position.CompactPosition
All Implemented Interfaces:
ImmutablePosition

public class CompactPosition
extends AbstractPosition

An implementation of the position interface. The class is optimized for memory footprint. Each instance uses only 36 bytes for internal representation (plus some overhead for java internals).

Version:
$Revision: 1.1 $
Author:
Bernhard Seybold

Field Summary
 
Fields inherited from class chesspresso.position.AbstractPosition
HASH_ALL_MASK, HASH_TOPLAY_MASK, HASH_TOPLAY_MULT, s_hashCastleMod, s_hashEPMod, s_hashMod
 
Fields inherited from interface chesspresso.position.ImmutablePosition
ALL_CASTLES, BLACK_CASTLE, BLACK_LONG_CASTLE, BLACK_SHORT_CASTLE, NO_CASTLES, WHITE_CASTLE, WHITE_LONG_CASTLE, WHITE_SHORT_CASTLE
 
Constructor Summary
CompactPosition()
           
CompactPosition(ImmutablePosition position)
           
 
Method Summary
 int getCastles()
          Return the still allowed castles as mask.
 int getHalfMoveClock()
          Return the number of moves since the last capture and the last pawn move.
 int getPlyNumber()
          Return the current ply number.
 int getSqiEP()
          Return the current en passant square.
 int getStone(int sqi)
          Return the stone currently on the given square.
 int getToPlay()
          Return the player whose turn it is.
 
Methods inherited from class chesspresso.position.AbstractPosition
equals, getFEN, getHashCode, getStartPositionHashCode, hashCode, isCastlePossible, isLegal, isSquarePossibleEPSquare, isStartPosition, isWhiteToPlay, toString, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompactPosition

public CompactPosition()

CompactPosition

public CompactPosition(ImmutablePosition position)
Method Detail

getStone

public int getStone(int sqi)
Description copied from interface: ImmutablePosition
Return the stone currently on the given square.

Parameters:
sqi - the square
Returns:
the stone of the given square

getSqiEP

public int getSqiEP()
Description copied from interface: ImmutablePosition
Return the current en passant square.

Returns:
the current en passant square, NO_SQUARE if none

getCastles

public int getCastles()
Description copied from interface: ImmutablePosition
Return the still allowed castles as mask.

Returns:
the still allowed castles as mask.

getToPlay

public int getToPlay()
Description copied from interface: ImmutablePosition
Return the player whose turn it is.

Returns:
the player whose turn it is

getPlyNumber

public int getPlyNumber()
Description copied from interface: ImmutablePosition
Return the current ply number.

Returns:
the current ply number, starting at play no. 0

getHalfMoveClock

public int getHalfMoveClock()
Description copied from interface: ImmutablePosition
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