Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Classes | Functions
chess_move.h File Reference
#include "castling_type.h"
#include "piece_type.h"
#include "square.h"
#include "pgn_move_string.h"
#include "fen_string.h"
#include <string>
#include <vector>
#include <optional>
#include <iosfwd>
Include dependency graph for chess_move.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  chess_move
 A chess move. More...
 

Functions

std::optional< squareget_from (const fen_string &s, const pgn_move_string &m)
 Get the square the piece doing the move came from, if any.
 
square get_from_for_bishop (const fen_string &s, const pgn_move_string &m)
 Get the square the bishop doing the move came from.
 
square get_from_for_king (const fen_string &s, const pgn_move_string &m)
 Get the square the king doing the move came from.
 
square get_from_for_knight (const fen_string &s, const pgn_move_string &m)
 Get the square the knight doing the move came from.
 
square get_from_for_pawn (const fen_string &s, const pgn_move_string &m)
 Get the square the pawn doing the move came from.
 
square get_from_for_queen (const fen_string &s, const pgn_move_string &m)
 Get the square the queen doing the move came from.
 
square get_from_for_rook (const fen_string &s, const pgn_move_string &m)
 Get the square the rook doing the move came from.
 
bool is_capture (const chess_move &move) noexcept
 Get if the move is a capture.
 
bool is_castling (const chess_move &move) noexcept
 Get if the move is a castling.
 
bool is_draw (const chess_move &move) noexcept
 Get if the move is a win.
 
bool is_simple_move (const chess_move &move) noexcept
 Get if the move is a move, i.e.
 
bool is_promotion (const chess_move &move) noexcept
 Get if the move is a promotion.
 
bool is_win (const chess_move &move) noexcept
 Get if the move is a win.
 
void test_chess_move ()
 Test this class and its free functions.
 
bool operator== (const chess_move &lhs, const chess_move &rhs) noexcept
 
std::ostream & operator<< (std::ostream &os, const chess_move &m) noexcept
 

Function Documentation

◆ get_from()

std::optional< square > get_from ( const fen_string s,
const pgn_move_string m 
)

Get the square the piece doing the move came from, if any.

Even with, e.g., castling, it is the king at e1 that needed to be selected to do that move

◆ get_from_for_bishop()

square get_from_for_bishop ( const fen_string s,
const pgn_move_string m 
)

Get the square the bishop doing the move came from.

◆ get_from_for_king()

square get_from_for_king ( const fen_string s,
const pgn_move_string m 
)

Get the square the king doing the move came from.

Even with, e.g., castling for white, it is the king at e1 that needed to be selected to do that move

◆ get_from_for_knight()

square get_from_for_knight ( const fen_string s,
const pgn_move_string m 
)

Get the square the knight doing the move came from.

◆ get_from_for_pawn()

square get_from_for_pawn ( const fen_string s,
const pgn_move_string m 
)

Get the square the pawn doing the move came from.

◆ get_from_for_queen()

square get_from_for_queen ( const fen_string s,
const pgn_move_string m 
)

Get the square the queen doing the move came from.

◆ get_from_for_rook()

square get_from_for_rook ( const fen_string s,
const pgn_move_string m 
)

Get the square the rook doing the move came from.

◆ is_capture()

bool is_capture ( const chess_move move)
noexcept

Get if the move is a capture.

◆ is_castling()

bool is_castling ( const chess_move move)
noexcept

Get if the move is a castling.

◆ is_draw()

bool is_draw ( const chess_move move)
noexcept

Get if the move is a win.

◆ is_promotion()

bool is_promotion ( const chess_move move)
noexcept

Get if the move is a promotion.

◆ is_simple_move()

bool is_simple_move ( const chess_move move)
noexcept

Get if the move is a move, i.e.

if it moves one piece, without a capture, no castling, no promotion, no win and no draw

◆ is_win()

bool is_win ( const chess_move move)
noexcept

Get if the move is a win.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const chess_move m 
)
noexcept

◆ operator==()

bool operator== ( const chess_move lhs,
const chess_move rhs 
)
noexcept

◆ test_chess_move()

void test_chess_move ( )

Test this class and its free functions.