Cute Chess 0.1
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

◆ Move() [1/2]

Chess::Move::Move ( )
inline

Creates an empty Move (null move).

◆ Move() [2/2]

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

◆ isNull()

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

Returns true if this is a null move.

◆ operator!=()

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

Returns true if other is different from this move.

◆ operator==()

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

Returns true if other is equal to this move.

◆ promotion()

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.

◆ sourceSquare()

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.

◆ targetSquare()

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

The target square.


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