Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Public Member Functions | List of all members
chess_move Class Reference

A chess move. More...

#include <chess_move.h>

Public Member Functions

 chess_move (const pgn_move_string &pgn_str, const fen_string &fen_str=create_fen_string_of_standard_starting_position())
 Moves always happen on a board.
 
const auto & get_action_type () const noexcept
 The type of action this move is.
 
const auto & get_castling_type () const noexcept
 Get the castling type.
 
const auto & get_color () const noexcept
 Get the color of the player that did this move.
 
const auto & get_from () const noexcept
 Get the source/from square, e.g.
 
const auto & get_pgn_str () const noexcept
 Get the original PGN string back.
 
const auto & get_promotion_type () const noexcept
 Get the promotion type.
 
const auto & get_to () const noexcept
 Get the target square, e.g.
 
const auto & get_piece_type () const noexcept
 The type of chess piece.
 
const auto & get_winner () const noexcept
 Get the winner.
 
bool is_capture () const noexcept
 Is this move a capture? E.g.
 

Detailed Description

A chess move.

A chess move, e.g. 'e4'.

Note
This called is called chess_move instead of move to avoid conflicts with ‘std::move’`.

Constructor & Destructor Documentation

◆ chess_move()

chess_move::chess_move ( const pgn_move_string pgn_str,
const fen_string fen_str = create_fen_string_of_standard_starting_position() 
)
explicit

Moves always happen on a board.

Member Function Documentation

◆ get_action_type()

const auto & chess_move::get_action_type ( ) const
inlinenoexcept

The type of action this move is.

◆ get_castling_type()

const auto & chess_move::get_castling_type ( ) const
inlinenoexcept

Get the castling type.

Will be empty if this move is not a promotion

◆ get_color()

const auto & chess_move::get_color ( ) const
inlinenoexcept

Get the color of the player that did this move.

◆ get_from()

const auto & chess_move::get_from ( ) const
inlinenoexcept

Get the source/from square, e.g.

'b1' in 'Pc3'.

Result will be empty when winning (e.g. '1-0')

◆ get_pgn_str()

const auto & chess_move::get_pgn_str ( ) const
inlinenoexcept

Get the original PGN string back.

◆ get_piece_type()

const auto & chess_move::get_piece_type ( ) const
inlinenoexcept

The type of chess piece.

Result will be empty when castling (e.g. 'O-O') or winning (e.g. '1-0')

◆ get_promotion_type()

const auto & chess_move::get_promotion_type ( ) const
inlinenoexcept

Get the promotion type.

Will be empty if this move is not a promotion

◆ get_to()

const auto & chess_move::get_to ( ) const
inlinenoexcept

Get the target square, e.g.

'e4' in 'Pxe4'. Result will be empty when castling (e.g. 'O-O') or winning (e.g. '1-0')

See also
use the free function get_from} to determine the square where the pieces comes from

◆ get_winner()

const auto & chess_move::get_winner ( ) const
inlinenoexcept

Get the winner.

  • If this is empty, the game is still on-going.
  • If this has 1 element, that color is the winner.
  • If this has 2 elements, the game ended in a draw.

◆ is_capture()

bool chess_move::is_capture ( ) const
inlinenoexcept

Is this move a capture? E.g.

'Qxf7' is a capture


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