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

#include <SideState.h>

+ Collaboration diagram for SideState:

Public Member Functions

 SideState ()
 
void friendlyMove (Move m, Piece promotion=Pawn)
 
void enemyMove (Move m, Bitboard enemyPawns)
 
bool isLegal (Move m, Bitboard enemyPieces, Bitboard enemyPawnsEnPassant)
 
bool isCastle (Move m)
 
bool isAttacking (Square sq, Bitboard enemyPieces)
 
long heuristic ()
 
Square firstPawn ()
 
Square firstRook ()
 
Square firstKnight ()
 
Square firstBishop ()
 
Square firstQueen ()
 
Square firstKing ()
 
Square next ()
 

Public Attributes

bool rooksMoved [2]
 
bool kingMoved
 
bool hasCastled
 
Bitboard pawns
 
Bitboard rooks
 
Bitboard bishops
 
Bitboard knights
 
Bitboard queen
 
Bitboard king
 
Bitboard enPassant
 
Bitboard attack
 
Bitboard nextBoard
 
int nextPiece
 

Detailed Description

A representation of a side (white or black). The representation of each side is the same - each thinks he/she is White (bottom of the board). The BoardState object rotates queries, moves and responses depending on whether this side is actually white or black.

Definition at line 44 of file SideState.h.

Constructor & Destructor Documentation

SideState::SideState ( )

Constructor. Starts the state in the normal starting position.

Definition at line 76 of file SideState.cc.

References rooksMoved.

Member Function Documentation

Square SideState::firstPawn ( )

Accessors for pieces.

Definition at line 92 of file SideState.cc.

References nextBoard, and pawns.

Referenced by BoardState::firstPawn(), and isAttacking().

+ Here is the caller graph for this function:

void SideState::friendlyMove ( Move  m,
Piece  promotion = Pawn 
)

Lets a move be made, regardless of legality.

Definition at line 239 of file SideState.cc.

References attack, Bitboard::clear(), pawns, and Bitboard::set().

Referenced by BoardState::move().

+ Here is the caller graph for this function:

bool SideState::isAttacking ( Square  sq,
Bitboard  enemyPieces 
)

Queries.

Definition at line 139 of file SideState.cc.

References firstPawn(), pawns, and Bitboard::set().

Referenced by BoardState::isLegal().

+ Here is the caller graph for this function:

bool SideState::isCastle ( Move  m)

Evaluates to true if the given Move is a castle.

Definition at line 187 of file SideState.cc.

bool SideState::isLegal ( Move  m,
Bitboard  enemyPieces,
Bitboard  enemyPawnsEnPassant 
)

Evaluates to true if the given Move is legal.

Definition at line 194 of file SideState.cc.

References pawns, and rooksMoved.

Referenced by BoardState::isLegal().

+ Here is the caller graph for this function:

Member Data Documentation

Bitboard SideState::attack

All squares attacked by all pieces.

Definition at line 112 of file SideState.h.

Referenced by friendlyMove().

Bitboard SideState::nextBoard

Bitboard for the next() function.

Definition at line 117 of file SideState.h.

Referenced by firstPawn().

Bitboard SideState::pawns
bool SideState::rooksMoved[2]

General state.

Definition at line 93 of file SideState.h.

Referenced by BoardState::firstPawn(), isLegal(), BoardState::save(), and SideState().


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