Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Functions
action_history.cpp File Reference
#include "action_history.h"
#include "delta_t.h"
#include "game_controller.h"
#include "pgn_game_string.h"
#include "chess_move.h"
#include "pieces.h"
#include "game.h"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <regex>
#include <sstream>
Include dependency graph for action_history.cpp:

Functions

action_history create_action_history_from_game (const game &g)
 Create an action history from a game.
 
action_history create_action_history_from_pgn (const pgn_game_string &s)
 Create an action history from a PGN string.
 
std::vector< piece_actioncollect_actions_in_timespan (const action_history &history, const in_game_time from, const in_game_time to)
 Collect all the actions that started in the timespan.
 
const piece_actionget_last_action (const action_history &history)
 
int get_n_piece_actions (const action_history &r) noexcept
 Get the number of moves in the action history.
 
bool has_actions (const action_history &history) noexcept
 
bool has_just_double_moved (const action_history &history, const in_game_time when)
 Has this piece (i.e.
 
bool is_enpassantable (const action_history &action_history, const in_game_time when)
 Can this piece (i.e.
 
bool is_piece_selected (const action_history &h)
 Is this piece selected, according to its action history.
 
action_history merge_action_histories (const std::vector< action_history > histories)
 Combine action histories and sort these.
 
void test_action_history ()
 Test this class and its free functions.
 
std::string to_str (const action_history &history) noexcept
 
bool operator== (const action_history &lhs, const action_history &rhs) noexcept
 
std::ostream & operator<< (std::ostream &os, const action_history &history) noexcept
 

Function Documentation

◆ collect_actions_in_timespan()

std::vector< piece_action > collect_actions_in_timespan ( const action_history history,
const in_game_time  from,
const in_game_time  to 
)

Collect all the actions that started in the timespan.

◆ create_action_history_from_game()

action_history create_action_history_from_game ( const game g)

Create an action history from a game.

◆ create_action_history_from_pgn()

action_history create_action_history_from_pgn ( const pgn_game_string s)

Create an action history from a PGN string.

◆ get_last_action()

const piece_action & get_last_action ( const action_history history)

◆ get_n_piece_actions()

int get_n_piece_actions ( const action_history r)
noexcept

Get the number of moves in the action history.

◆ has_actions()

bool has_actions ( const action_history history)
noexcept

◆ has_just_double_moved()

bool has_just_double_moved ( const action_history action_history,
const in_game_time  when 
)

Has this piece (i.e.

a pawn) just finish a double move forward last time unit? Only pawns can do this, e.g. e2-e4 or e7-e5 For example, when at t=0.5, e2-e4 is played, from t=1.5 to t=2.5 this function will return true. Before that, the piece was moving After that, it was too long ago for en-passant

◆ is_enpassantable()

bool is_enpassantable ( const action_history action_history,
const in_game_time  when 
)

Can this piece (i.e.

a pawn) be captured by en-passant? Only pawns can do this, e.g. e2-e4 or e7-e5 For example, when at t=0.5, e2-e4 is played, from t=1.5 to t=2.5 this function will return true. Before that, the piece was moving After that, it was too long ago for en-passant

◆ is_piece_selected()

bool is_piece_selected ( const action_history h)

Is this piece selected, according to its action history.

◆ merge_action_histories()

action_history merge_action_histories ( const std::vector< action_history histories)

Combine action histories and sort these.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const action_history history 
)
noexcept

◆ operator==()

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

◆ test_action_history()

void test_action_history ( )

Test this class and its free functions.

◆ to_str()

std::string to_str ( const action_history history)
noexcept