File: TwoGtp.h

package info (click to toggle)
pentobi 29.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,892 kB
  • sloc: cpp: 25,719; javascript: 875; xml: 40; makefile: 13; sh: 6
file content (63 lines) | stat: -rw-r--r-- 1,477 bytes parent folder | download | duplicates (3)
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
63
//-----------------------------------------------------------------------------
/** @file twogtp/TwoGtp.h
    @author Markus Enzenberger
    @copyright GNU General Public License version 3 or later */
//-----------------------------------------------------------------------------

#ifndef TWOGTP_TWOGTP_H
#define TWOGTP_TWOGTP_H

#include <array>
#include "GtpConnection.h"
#include "Output.h"
#include "libpentobi_base/Board.h"

using namespace std;
using libpentobi_base::Board;
using libpentobi_base::Color;
using libpentobi_base::Variant;

//-----------------------------------------------------------------------------

class TwoGtp
{
public:
    TwoGtp(const string& black, const string& white, Variant variant,
           unsigned nu_games, Output& output, bool quiet,
           const string& log_prefix, bool fast_open);

    void run();

    void set_save_interval(double seconds) { m_output.set_save_interval(seconds); }

private:
    bool m_quiet;

    bool m_fast_open;

    Variant m_variant;

    unsigned m_nu_games;

    Board m_bd;

    Output& m_output;

    GtpConnection m_black;

    GtpConnection m_white;

    array<string, Color::range> m_colors;

    float get_result(unsigned player_black);

    void play_game(unsigned game_number);

    void send_both(const string& cmd);

    static double send_cputime(GtpConnection& gtp_connection);
};

//-----------------------------------------------------------------------------

#endif // TWOGTP_TWOGTP_H