aboutsummaryrefslogtreecommitdiff
path: root/include/pv.h
blob: 1754829efc040bb02eb64db80b1de23c1ed3d48a (plain)
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
/*
  This file is part of ctak.

  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
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  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
  along with ctak. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef PV_H
#define PV_H

#ifdef RECORD_PV

#include <stdint.h>

#include <tak.h>

#define PV_MAX_CELLS (6 * 6)

typedef struct pv_leaf_s {
  float head[2];
  uint8_t cells[PV_MAX_CELLS];
  uint8_t terminal;
  float terminal_value;
  float parity_sign;
} pv_leaf_t;

// Capture a horizon leaf (winner == 0xFF) or an exact terminal leaf.
//
// The cell indices are taken from the encoding of the most recent
// nn_prepare_input.
void pv_capture_leaf(pv_leaf_t *leaf, tak_state_p state, enum WIN_TYPE winner);

// Publish and retrieve the leaf selected by the full-depth root search
void pv_publish_leaf(const pv_leaf_t *leaf);
const pv_leaf_t *pv_get_leaf(void);

#endif

#endif