aboutsummaryrefslogtreecommitdiff
path: root/src/match.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/match.c')
-rw-r--r--src/match.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/match.c b/src/match.c
index 1c706cd..49ff9c9 100644
--- a/src/match.c
+++ b/src/match.c
@@ -14,7 +14,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with ct. If not, see <https://www.gnu.org/licenses/>.
+ along with ctak. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
@@ -37,7 +37,7 @@
static inline float five_cand(tak_state_p state) {
static float cur_board[FIVE_INP_NUM] NN_ALIGNED;
- nn_prepare_input(cur_board, state);
+ nn_prepare_input(cur_board, state, cand_five_embedding);
return eval_net(cur_board, FIVE_INP_NUM, &cand_five_dense_weights[0][0],
cand_five_dense_biases, cand_five_logit_weights, cand_five_logit_bias,
FIVE_DENSE_NUM);
@@ -46,7 +46,7 @@ static inline float five_cand(tak_state_p state) {
static inline float six_cand(tak_state_p state) {
static float cur_board[SIX_INP_NUM] NN_ALIGNED;
- nn_prepare_input(cur_board, state);
+ nn_prepare_input(cur_board, state, cand_six_embedding);
return eval_net(cur_board, SIX_INP_NUM, &cand_six_dense_weights[0][0],
cand_six_dense_biases, cand_six_logit_weights, cand_six_logit_bias,
SIX_DENSE_NUM);
@@ -107,16 +107,16 @@ static int play_game(const nn_function current_fn, const nn_function cand_fn,
switch (state->won) {
case WIN_DRAW:
- return -1;
- case WIN_FLAT_BLACK:
+ return -1;
+ case WIN_FLAT_BLACK:
case WIN_ROAD_BLACK:
return C_BLACK;
case WIN_FLAT_WHITE:
case WIN_ROAD_WHITE:
return C_WHITE;
default:
- fprintf(stderr, "match: game did not end cleanly (won=%d)\n", state->won);
- return -2;
+ // ply cap reached with no winner: a draw
+ return -1;
}
}
@@ -124,7 +124,7 @@ static int play_game(const nn_function current_fn, const nn_function cand_fn,
// Main
// ===================================================================
-const char *license =
+const char *usage =
"match, one Tak game of the current weights against the candidate.\n\
\n \
usage: match <size> <eps> <depth>\n\
@@ -137,14 +137,11 @@ nn_train.py runs many of these in parallel to score the candidate against the cu
\n\
Copyright (C) 2026, tslil clingman\n\
\n\
-This program is free software: you can redistribute it and/or modify\n\
-it under the terms of the GNU General Public License as published by\n\
-the Free Software Foundation, either version 3 of the License, or\n\
-(at your option) any later version.";
+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.";
int main(int argc, char **argv) {
if (argc != 4) {
- puts(license);
+ puts(usage);
return EXIT_FAILURE;
}
@@ -179,9 +176,7 @@ int main(int argc, char **argv) {
const int winner = play_game(current_fn, cand_fn, current_fn_colour, eps10000);
const char *name;
- if (winner == -2)
- name = "abort";
- else if (winner == -1)
+ if (winner == -1)
name = "draw";
else if (winner == (int)current_fn_colour)
name = "current";