File: GtpEngine.h

package info (click to toggle)
pentobi 18.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,912 kB
  • sloc: cpp: 26,729; javascript: 907; xml: 49; sh: 35; makefile: 21; java: 11
file content (57 lines) | stat: -rw-r--r-- 1,725 bytes parent folder | download
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
//-----------------------------------------------------------------------------
/** @file pentobi_gtp/GtpEngine.h
    @author Markus Enzenberger
    @copyright GNU General Public License version 3 or later */
//-----------------------------------------------------------------------------

#ifndef PENTOBI_GTP_GTP_ENGINE_H
#define PENTOBI_GTP_GTP_ENGINE_H

#include "libpentobi_gtp/GtpEngine.h"
#include "libpentobi_mcts/Player.h"

using namespace std;
using libboardgame_gtp::Arguments;
using libboardgame_gtp::Response;
using libpentobi_base::PlayerBase;
using libpentobi_base::Variant;
using libpentobi_mcts::Player;
using libpentobi_mcts::Search;

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

class GtpEngine
    : public libpentobi_gtp::GtpEngine
{
public:
    explicit GtpEngine(
            Variant variant, unsigned level = 5, bool use_book = true,
            const string& books_dir = "", unsigned nu_threads = 0);

    ~GtpEngine() override;

    void cmd_param(Arguments args, Response& response);
    void cmd_get_value(Response& response);
    void cmd_move_values(Response& response);
    void cmd_name(Response& response);
    void cmd_selfplay(Arguments args);
    void cmd_save_tree(Arguments args);
    void cmd_version(Response& response);

    Player& get_mcts_player();

    /** @see Player::use_cpu_time() */
    void use_cpu_time(bool enable);

private:
    unique_ptr<PlayerBase> m_player;

    void create_player(Variant variant, unsigned level,
                       const string& books_dir, unsigned nu_threads);

    Search& get_search();
};

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

#endif // PENTOBI_GTP_GTP_ENGINE_H