forked from leela-zero/leela-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimeControl.h
62 lines (49 loc) · 1.88 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
This file is part of Leela Zero.
Copyright (C) 2017 Gian-Carlo Pascutto
Leela Zero is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Leela Zero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Leela Zero. If not, see <http://www.gnu.org/licenses/>.
*/
#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 = 60 * 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();
void reset_clocks();
std::string to_text_sgf();
private:
void display_color_time(int color);
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