-
Notifications
You must be signed in to change notification settings - Fork 2
/
scrabble_facade.hpp
72 lines (56 loc) · 2.29 KB
/
scrabble_facade.hpp
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
64
65
66
67
68
69
70
71
72
#ifndef scrabble_facade_h
#define scrabble_facade_h
#include "scrabble_config.hpp"
#include <string>
#include <memory>
class Scrabble_Game;
/**
* This class acts as the outside world's only interface to this library.
* In order words, entities outside this package would only need to make
* calls to the methods below in order to use the program.
*
* Other languages can call into this libray via the scrabble C function
*/
extern "C" {
void c_scrabble(PyObject* py,
const int num_players, const char** players,
const int num_ais, const char** ais,
const char* load_game,
const char* dictionary,
const char* board,
const char* tiles,
const int random_seed,
const bool gui);
}
////////////////////////////////////////////////////////////////////////////////
struct Scrabble_Facade
////////////////////////////////////////////////////////////////////////////////
{
/**
* play - Creates and runs the game according to the options encoded in the arguments.
*/
static void play(PyObject* py,
const std::vector<std::string>& players,
const std::vector<std::string>& ais,
const std::string& dictionary,
const Board_Type board,
const Piece_Source_Type tileset,
const int random_seed,
const Output_Type output);
/**
* load - Loads and resumes a game by file
*/
static void load(PyObject* py,
const std::string& save_path,
const int random_seed,
const Output_Type output);
static std::shared_ptr<Scrabble_Game> get_test_game(const int* random_seed=nullptr);
static std::shared_ptr<Scrabble_Game> load_test_game(const std::string& save_path, const int* random_seed=nullptr);
private:
static std::shared_ptr<Scrabble_Game> create_game(const Scrabble_Config& config);
static std::shared_ptr<Scrabble_Game> load_game(const std::string& save_path,
PyObject* py = nullptr,
const int* random_seed=nullptr,
const Output_Type=TEXT);
};
#endif