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

Details of a board transition caused by a move. More...

#include <boardtransition.h>

Classes

struct  Drop
 A piece drop. More...
 
struct  Move
 Movement on the board. More...
 

Public Member Functions

void addDrop (const Piece &piece, const Square &target)
 
void addMove (const Square &source, const Square &target)
 
void addReservePiece (const Piece &piece)
 
void addSquare (const Square &square)
 
 BoardTransition ()
 
void clear ()
 
QList< Dropdrops () const
 
bool isEmpty () const
 
QList< Movemoves () const
 
QList< Piecereserve () const
 
QList< Squaresquares () const
 

Detailed Description

Details of a board transition caused by a move.

This class stores information about the movement of pieces and changed squares on a chessboard. Two types of information are stored: movement, and changed squares and reserve pieces. The latter type of information is sufficient for updating the state of a graphical board, and the former can be used to display or animate the actual chessmove.

See also
Board::makeMove()

Constructor & Destructor Documentation

Chess::BoardTransition::BoardTransition ( )

Creates a new empty BoardTransition object.

Member Function Documentation

void Chess::BoardTransition::addDrop ( const Piece piece,
const Square target 
)

Adds a new piece drop of piece to target.

void Chess::BoardTransition::addMove ( const Square source,
const Square target 
)

Adds a new "move" from source to target.

void Chess::BoardTransition::addReservePiece ( const Piece piece)

Adds a new changed reserve piece.

If piece already exists in the transition, this function does nothing.

void Chess::BoardTransition::addSquare ( const Square square)

Adds a new changed square.

If square already exists in the transition, this function does nothing.

void Chess::BoardTransition::clear ( )

Clears all data, ie. empties the transition.

QList< BoardTransition::Drop > Chess::BoardTransition::drops ( ) const

Returns a list of piece drops.

bool Chess::BoardTransition::isEmpty ( ) const

Returns true if there are no transitions.

QList< BoardTransition::Move > Chess::BoardTransition::moves ( ) const

Returns a list of "moves".

One chessmove can involve several moving pieces, and the actual chessmove may not be on the returned list.

QList< Piece > Chess::BoardTransition::reserve ( ) const

Returns a list of changed piece reserves.

QList< Square > Chess::BoardTransition::squares ( ) const

Returns a list of changed squares.


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