The Pedigree Project  0.1
Public Member Functions | Public Attributes | List of all members
BoardState Class Reference

#include <BoardState.h>

+ Collaboration diagram for BoardState:

Public Member Functions

 BoardState ()
 
void move (Move m, Side s, Piece promotion=Pawn)
 
bool isLegal (Move m, Side s)
 
bool canCastle (Side side)
 
bool inCheck (Side side)
 
bool inCheckmate (Side side)
 
bool underAttack (Square sq, Side side)
 
bool rightCastleSquaresFree (Side side)
 
bool leftCastleSquaresFree (Side side)
 
Square firstPawn (Side s, Bitboard *b=NULL)
 
Square nextPawn (Side s, Bitboard *b=NULL)
 
Square firstRook (Side s, Bitboard *b=NULL)
 
Square nextRook (Side s, Bitboard *b=NULL)
 
Square firstKnight (Side s, Bitboard *b=NULL)
 
Square nextKnight (Side s, Bitboard *b=NULL)
 
Square firstBishop (Side s, Bitboard *b=NULL)
 
Square nextBishop (Side s, Bitboard *b=NULL)
 
Square firstQueen (Side s, Bitboard *b=NULL)
 
Square nextQueen (Side s, Bitboard *b=NULL)
 
Square firstKing (Side s, Bitboard *b=NULL)
 
void swapSides ()
 
long heuristic (Side side)
 
void dump ()
 
bool load (int minPly, Side toPlay, MoveList &ml, long &h)
 
void save (int ply, Side toPlay, long h, MoveList &ml)
 
void savePartial ()
 
void uncache (Side toPlay)
 
uint32_t hash ()
 
uint32_t hash2 ()
 

Public Attributes

SideState white
 
SideState black
 
bool whiteInCheck
 
bool whiteCheckStateCalculated
 
bool blackInCheck
 
bool blackCheckStateCalculated
 
bool whiteInMate
 
bool whiteMateStateCalculated
 
bool blackInMate
 
bool blackMateStateCalculated
 
long cachedHash
 
bool hashCalculated
 
long cachedHash2
 
bool hash2Calculated
 

Detailed Description

Stores the state of the board.

Definition at line 33 of file BoardState.h.

Constructor & Destructor Documentation

BoardState::BoardState ( )

Constructs a new BoardState. This defaults to the starting position.

Definition at line 31 of file BoardState.cc.

Member Function Documentation

bool BoardState::canCastle ( Side  side)

Queries

void BoardState::dump ( )

For debug purposes.

Definition at line 657 of file BoardState.cc.

References SideState::pawns, Bitboard::rotate180(), and Bitboard::set().

Square BoardState::firstPawn ( Side  s,
Bitboard b = NULL 
)

Accessors for pieces. Also returns possible moves/attacks in the given bitboard if it is non-NULL.

Definition at line 260 of file BoardState.cc.

References SideState::firstPawn(), SideState::pawns, SideState::rooksMoved, and Bitboard::rotate180().

Referenced by isLegal(), and save().

+ Here is the caller graph for this function:

long BoardState::heuristic ( Side  side)

Get the static heuristic for this state, for 'side'.

Definition at line 649 of file BoardState.cc.

bool BoardState::isLegal ( Move  m,
Side  s 
)

Is the given Move by Side s legal?

Definition at line 73 of file BoardState.cc.

References firstPawn(), SideState::isAttacking(), SideState::isLegal(), move(), SideState::pawns, and Bitboard::rotate180().

bool BoardState::load ( int  minPly,
Side  toPlay,
MoveList &  ml,
long &  h 
)

Attempts to find this state in the global StateStore.

Definition at line 704 of file BoardState.cc.

void BoardState::move ( Move  m,
Side  s,
Piece  promotion = Pawn 
)

Performs a Move m, by Side s.

Definition at line 49 of file BoardState.cc.

References SideState::friendlyMove(), SideState::pawns, and Bitboard::rotate180().

Referenced by isLegal().

+ Here is the caller graph for this function:

void BoardState::save ( int  ply,
Side  toPlay,
long  h,
MoveList &  ml 
)

Saves this state into the global StateStore.

Definition at line 709 of file BoardState.cc.

References firstPawn(), and SideState::rooksMoved.

void BoardState::swapSides ( )

Swaps sides.

Definition at line 642 of file BoardState.cc.


The documentation for this class was generated from the following files: