Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
action_history.h
Go to the documentation of this file.
1#ifndef ACTION_HISTORY_H
2#define ACTION_HISTORY_H
3
4#include "ccfwd.h"
5#include "in_game_time.h"
6#include "piece_action.h"
7
8#include <iosfwd>
9#include <vector>
10
17{
18public:
20 const std::vector<std::pair<in_game_time, piece_action>>& timed_actions = {}
21 );
22
24 void add_action(const in_game_time& in_game_time, const piece_action& action) noexcept;
25
28 const auto& get() const noexcept { return m_timed_actions; }
29
30private:
31
33 std::vector<std::pair<in_game_time, piece_action>> m_timed_actions;
34
35};
36
38std::vector<piece_action> collect_actions_in_timespan(
39 const action_history& history,
40 const in_game_time from,
41 const in_game_time to
42);
43
46
49
51int get_n_piece_actions(const action_history& r) noexcept;
52
61 const in_game_time when
62);
63
64const piece_action& get_last_action(const action_history& history);
65
66bool has_actions(const action_history& history) noexcept;
67
76 const in_game_time when
77);
78
79
82
84action_history merge_action_histories(const std::vector<action_history> histories);
85
88
89std::string to_str(const action_history& history) noexcept;
90
91bool operator==(const action_history& lhs, const action_history& rhs) noexcept;
92
93std::ostream& operator<<(std::ostream& os, const action_history& history) noexcept;
94
95#endif // ACTION_HISTORY_H
std::string to_str(const action_history &history) noexcept
Definition action_history.cpp:272
bool operator==(const action_history &lhs, const action_history &rhs) noexcept
Definition action_history.cpp:284
action_history create_action_history_from_pgn(const pgn_game_string &s)
Create an action history from a PGN string.
Definition action_history.cpp:49
void test_action_history()
Test this class and its free functions.
Definition action_history.cpp:184
bool is_enpassantable(const action_history &action_history, const in_game_time when)
Can this piece (i.e.
Definition action_history.cpp:138
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.
Definition action_history.cpp:83
const piece_action & get_last_action(const action_history &history)
Definition action_history.cpp:99
action_history create_action_history_from_game(const game &g)
Create an action history from a game.
Definition action_history.cpp:39
action_history merge_action_histories(const std::vector< action_history > histories)
Combine action histories and sort these.
Definition action_history.cpp:165
int get_n_piece_actions(const action_history &r) noexcept
Get the number of moves in the action history.
Definition action_history.cpp:105
std::ostream & operator<<(std::ostream &os, const action_history &history) noexcept
Definition action_history.cpp:289
bool has_actions(const action_history &history) noexcept
Definition action_history.cpp:110
bool is_piece_selected(const action_history &h)
Is this piece selected, according to its action history.
Definition action_history.cpp:146
bool has_just_double_moved(const action_history &action_history, const in_game_time when)
Has this piece (i.e.
Definition action_history.cpp:115
The collected in-game times of actions, in chrononical order.
Definition action_history.h:17
void add_action(const in_game_time &in_game_time, const piece_action &action) noexcept
Add an action, when started.
Definition action_history.cpp:34
const auto & get() const noexcept
Get the collected in-game times of actions, in chrononical order.
Definition action_history.h:28
The game logic.
Definition game.h:28
The in-game time, in chess moves.
Definition in_game_time.h:16
A string that is a PGN notation string of a game.
Definition pgn_game_string.h:14
An action to be done by a piece.
Definition piece_action.h:18