Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
replay.h
Go to the documentation of this file.
1#ifndef REPLAY_H
2#define REPLAY_H
3
4#include "ccfwd.h"
5#include "delta_t.h"
6#include "in_game_time.h"
7#include "game_controller.h"
8#include "action_history.h"
10
11#include <iosfwd>
12
22class replay
23{
24public:
25 explicit replay(
26 const action_history& h = action_history(),
28 );
29
31 void do_move(const delta_t& dt = delta_t(1.0));
32
34 const auto& get_action_history() const noexcept { return m_action_history; }
35
37 const auto& get_game() const noexcept { return m_game_controller.get_game(); }
38
40 const auto& get_game_controller() const noexcept { return m_game_controller; }
41
43 const auto& get_index() const noexcept { return m_index; };
44
46 const auto& get_initial_game_controller() const noexcept { return m_initial_game_controller.get_value(); }
47
48 bool is_done() const noexcept;
49
51 void reset() noexcept;
52
53private:
54
56 read_only<action_history> m_action_history;
57
59 game_controller m_game_controller;
60
62 int m_index;
63
65 read_only<game_controller> m_initial_game_controller;
66};
67
73 const replay& r,
74 const delta_t& dt
75);
76
78 const replay& r
79) noexcept;
80
82int get_n_moves(const replay& r) noexcept;
83
85
87bool is_piece_at(
88 const replay& r,
89 const square& coordinat
90);
91
93void test_replay();
94
95bool operator==(const replay& lhs, const replay& rhs) noexcept;
96
97std::ostream& operator<<(std::ostream& os, const replay& r) noexcept;
98
99#endif // REPLAY_H
The collected in-game times of actions, in chrononical order.
Definition action_history.h:17
A change of in_game_time}.
Definition delta_t.h:12
The class that acts as a controller for game}.
Definition game_controller.h:31
const game & get_game() const noexcept
Get the game.
Definition game_controller.h:48
Definition game_statistics_in_time.h:8
The in-game time, in chess moves.
Definition in_game_time.h:16
A copyable read-only value.
Definition read_only.h:14
const T & get_value() const
Definition read_only.h:21
A replay.
Definition replay.h:23
const auto & get_game_controller() const noexcept
Get the current state of the game.
Definition replay.h:40
const auto & get_initial_game_controller() const noexcept
Get the current state of the game.
Definition replay.h:46
void reset() noexcept
Rewind back to the start.
Definition replay.cpp:170
const auto & get_game() const noexcept
Get the current state of the game.
Definition replay.h:37
const auto & get_action_history() const noexcept
Get the history of actions, from a replay.
Definition replay.h:34
const auto & get_index() const noexcept
The index of the next move to do in the action history.
Definition replay.h:43
void do_move(const delta_t &dt=delta_t(1.0))
Do a move or do nothing, for 1 time unit.
Definition replay.cpp:24
bool is_done() const noexcept
Definition replay.cpp:137
A chess square.
Definition square.h:58
int get_n_moves(const replay &r) noexcept
Get the number of moves in the replay.
Definition replay.cpp:110
const in_game_time & get_in_game_time(const replay &r) noexcept
Definition replay.cpp:103
replay get_played_scholars_mate()
Definition replay.cpp:115
bool is_piece_at(const replay &r, const square &coordinat)
Determine if there is a piece at the coordinat.
Definition replay.cpp:165
void test_replay()
Test this class and its free functions.
Definition replay.cpp:176
game_statistics_in_time extract_game_statistics_in_time(const replay &r, const delta_t &dt)
Extract the game statistics over time.
Definition replay.cpp:75