-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathTimeControl.h
41 lines (34 loc) · 1.13 KB
/
TimeControl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef TIMECONTROL_H_INCLUDED
#define TIMECONTROL_H_INCLUDED
#include <array>
#include "Timing.h"
class TimeControl {
public:
/*
Initialize time control. Timing info is per GTP and in centiseconds
*/
TimeControl(int boardsize = 19,
int maintime = 30 * 60 * 100,
int byotime = 0, int byostones = 25,
int byoperiods = 0);
void start(int color);
void stop(int color);
int max_time_for_move(int color);
void adjust_time(int color, int time, int stones);
void set_boardsize(int boardsize);
void display_times();
int get_remaining_time(int color);
void reset_clocks();
private:
int m_maintime;
int m_byotime;
int m_byostones;
int m_byoperiods;
int m_moves_expected;
std::array<int, 2> m_remaining_time; /* main time per player */
std::array<int, 2> m_stones_left; /* stones to play in byo period */
std::array<int, 2> m_periods_left; /* byo periods */
std::array<bool, 2> m_inbyo; /* player is in byo yomi */
std::array<Time, 2> m_times; /* storage for player times */
};
#endif