/*
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 .
*/
#ifndef NN_H
#define NN_H
#include
#include
// Number of cell states: empty, then {black, white} x {flat, standing, road}
#define NN_N_EMB 7
// ===================================================================
// Input encoding
// ===================================================================
// somewhat internal, important for generating training data
void nn_cell_idxs(uint8_t *out, tak_state_p state);
void nn_prepare_head(float out_head[3], tak_state_p state);
void nn_prepare_input(float *cur_board, tak_state_p state,
const float embedding[NN_N_EMB]);
int nn_last_cell_idxs(uint8_t *out, tak_state_p state);
// ===================================================================
// Network
// ===================================================================
float eval_net(const float *board, const unsigned int n_inp,
const float *w, const float *biases,
const float *logit_w, const float logit_b,
const unsigned int n_dense);
// Evaluators for the two built-in networks.
float five_nn_fn(tak_state_p state);
float six_nn_fn(tak_state_p state);
#endif