|
tartan 1.2.2.1
Chess API
|
Generic board memeber API. More...
#include <board.hpp>
Classes | |
| class | Position |
| Piece position at the Board. More... | |
| class | Turn |
| Generic Piece Turn on Board. More... | |
| class | TurnMap |
| List of Turn objects. More... | |
Public Types | |
| enum class | Color { Black = 0 , White = 1 } |
| Piece color. More... | |
Public Member Functions | |
| Color | color () const |
| Piece color. | |
| Color | setColor (Color col) |
| Set the color. | |
| const Position & | position () const |
| Piece Position. | |
| Position & | position () |
| Piece Position. | |
| Position | setPosition (const Position &) |
| Set Piece position. | |
| virtual Position | move (const Position &to) |
| Move piece. | |
| virtual TurnMap | moveMap (int mode=0) const =0 |
| Generic moves. | |
| const Board * | board () const |
| Piece board. | |
| Board * | board () |
| Piece board. | |
| Board * | setBoard (Board *b) |
| Set Piece Board. | |
| std::size_t | movesMade () const |
| Moves count. | |
| std::size_t | turnIndex () const |
| Current turn index. | |
| Piece (const Position &pos={1, 1}, Color col=Color::White) | |
| Construct new Piece. | |
Static Public Member Functions | |
| static TurnMap | diagonalMoves (const Piece *p) |
| Construct diagonal moves TurnMap. | |
| static TurnMap | straightMoves (const Piece *p) |
| Construct straight moves (up, down, left, right) TurnMap. | |
Protected Attributes | |
| Color | p_color |
| Piece color. | |
| Position | p_position |
| Piece Position. | |
| Board * | p_board = nullptr |
| Piece Board. | |
| std::size_t | p_movesMade = 0 |
| Turns count Count of turns Piece have made. | |
| std::size_t | p_turnIndex = 0 |
| Last turn index. | |
Generic board memeber API.
This class should be inherited and used to describe piece in new board.
|
strong |
Piece color.
|
inline |
|
static |
Move piece.
Changes the position() value, uses board() interface to move piece to new location at the underlying Board.
| to | new Position value |
|
pure virtual |
Generic moves.
mode in Your Board class. It's value will be passed to function and influence it's behaivor in some way.| mode | optional mode constant to influence the moveMap() behaivor in child classes. |
Implemented in tt::chess::Pawn, tt::chess::Knight, tt::chess::Bishop, tt::chess::Rook, tt::chess::Queen, and tt::chess::King.
|
inline |
|
inline |
|
inline |
| Piece::Color tt::Piece::setColor | ( | Color | col | ) |
|
static |
|
inline |
Current turn index.
|
protected |
|
protected |
Piece color.
|
protected |
|
protected |
Last turn index.
Board::turnIndex() value at the moment when Piece performed some Turn