cwchess::CastleFlags Class Reference

A class to keep track of castling rights. More...

#include <CastleFlags.h>

List of all members.

Public Member Functions

bool can_castle (Color const& color) const
 Return TRUE if color is still allowed to castle at all (not taking into account checks).
bool can_castle_short (Color const& color) const
 Return TRUE if color is still allowed to castle short (not taking into account checks).
bool can_castle_long (Color const& color) const
 Return TRUE if color is still allowed to castle long (not taking into account checks).
void set_check (Color const& color, bool check)
bool in_check (Color const& color) const
bool has_moved (Code const& code, Index const& index)
 Return TRUE if code at index is marked as having moved.

Friends

class ChessPosition

Detailed Description

A class to keep track of castling rights.

This class is for internal use. ChessPosition takes cares of keeping track of castling rights and the user should never have to access or use this class.

Each ChessPosition has one CastleFlags member that keeps track of which rook and king moved. Castling is only allowed when neither, the king nor the rook used to castle, did move.

This object has no notion of temporary reasons why castling might not be allowed. However, two unused bits are used to store whether or not white/black is in check (that is not used for the castling part though).

Definition at line 63 of file CastleFlags.h.


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

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.