mcts.h 2.44 KB
Newer Older
1
2
/* tarot implements the rules of the tarot game
 * Copyright (C) 2018, 2019  Vivien Kraus
Vivien Kraus's avatar
Vivien Kraus committed
3
 *
4
5
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, version 3 of the License.
Vivien Kraus's avatar
Vivien Kraus committed
7
8
9
10
11
12
13
 *
 * This program 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
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Vivien Kraus's avatar
Vivien Kraus committed
15
 */
16

Vivien Kraus's avatar
Vivien Kraus committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef H_TAROT_MCTS_INCLUDED
#define H_TAROT_MCTS_INCLUDED
#include <stddef.h>
#include <tarot/player.h>
#ifdef __cplusplus
extern "C"
{
#endif                          /* __cplusplus */

  struct TarotMcts;
  typedef struct TarotMcts TarotMcts;

  struct TarotGameEvent;

  struct TarotGame;

  /**
   * tarot_mcts_construct:
35
   * @mem_out: (array length=max_mem):
Vivien Kraus's avatar
Vivien Kraus committed
36
37
   * @alignment: (out):
   */
Vivien Kraus's avatar
Vivien Kraus committed
38
39
  size_t tarot_mcts_construct (size_t max_mem, char *mem_out,
                               size_t *alignment, size_t max_pool);
Vivien Kraus's avatar
Vivien Kraus committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

  void tarot_mcts_copy (TarotMcts * dest, const TarotMcts * source);

  /**
   * tarot_mcts_alloc: (constructor)
   */
  TarotMcts *tarot_mcts_alloc (size_t max_mem);

  TarotMcts *tarot_mcts_dup (size_t new_max_mem, const TarotMcts * source);

  void tarot_mcts_free (TarotMcts * mcts);

  typedef enum
  {
    TAROT_MCTS_OK = 0,
    TAROT_MCTS_NONEXT,
    TAROT_MCTS_UNKNOWNNEXT,
    TAROT_MCTS_NODATA,
    TAROT_MCTS_NOMEM
  } TarotMctsError;

Vivien Kraus's avatar
Vivien Kraus committed
61
62
63
64
  /**
   * tarot_mcts_set_base:
   * @base: (type TarotGame):
   */
Vivien Kraus's avatar
Vivien Kraus committed
65
  TarotMctsError tarot_mcts_set_base (TarotMcts * mcts,
Vivien Kraus's avatar
Vivien Kraus committed
66
                                      const struct TarotGame *base);
Vivien Kraus's avatar
Vivien Kraus committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80

  /**
   * tarot_mcts_seed:
   * @seed: (array length=seed_size) (element-type char):
   */
  void tarot_mcts_seed (TarotMcts * mcts, size_t seed_size, const void *seed);

  /**
   * tarot_mcts_run:
   */
  TarotMctsError tarot_mcts_run (TarotMcts * mcts, size_t n_iterations);

  /**
   * tarot_mcts_get_best:
81
   * @returns: (type Tarot.GameEvent) (transfer none):
Vivien Kraus's avatar
Vivien Kraus committed
82
   */
83
  const struct TarotGameEvent *tarot_mcts_get_best (const TarotMcts * mcts);
Vivien Kraus's avatar
Vivien Kraus committed
84
85
86
87
88
89
90
91
92
93

#ifdef __cplusplus
}
#endif                          /* __cplusplus */

#endif                          /* not H_TAROT_MCTS_INCLUDED */

/* Local Variables: */
/* mode: c */
/* End: */