Cute Chess  0.1
Public Member Functions | List of all members
Chess::Move Class Reference

A small and efficient chessmove class. More...

#include <move.h>

Public Member Functions

bool isNull () const
 
 Move ()
 
 Move (int sourceSquare, int targetSquare, int promotion=0)
 
bool operator!= (const Move &other) const
 
bool operator== (const Move &other) const
 
int promotion () const
 
int sourceSquare () const
 
int targetSquare () const
 

Detailed Description

A small and efficient chessmove class.

This class is designed to be used internally by Board objects, and to store minimal information about the move. A Board object is needed to verify the move's legality or to convert it to a string.

The source and target squares have an integer format specific to a certain type of chess variant. The Board class has methods for converting between these integers and the generic Square type.

See also
Piece
Board
GenericMove

Constructor & Destructor Documentation

Chess::Move::Move ( )
inline

Creates an empty Move (null move).

Chess::Move::Move ( int  sourceSquare,
int  targetSquare,
int  promotion = 0 
)
inline

Creates a new Move object with at least a source square and a target square.

Member Function Documentation

bool Chess::Move::isNull ( ) const
inline

Returns true if this is a null move.

bool Chess::Move::operator!= ( const Move other) const
inline

Returns true if other is different from this move.

bool Chess::Move::operator== ( const Move other) const
inline

Returns true if other is equal to this move.

int Chess::Move::promotion ( ) const
inline

Type of the promotion piece.

A value of 0 means no promotion. If this move is a piece drop, the promotion type denotes the type of the dropped piece.

int Chess::Move::sourceSquare ( ) const
inline

The source square.

A value of 0 means that this move is a piece drop, a special move allowed by some variants.

int Chess::Move::targetSquare ( ) const
inline

The target square.


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