From 81213c273fd874aba95c45bd692e14079ebce434 Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sun, 15 Jan 2023 16:03:37 +0100 Subject: new neural network arch (faster + better) & minor changes + fixes Gone is the convolutional neural network, for it turns out not only is it more difficult to train, but all of the extra information about board layers didn't make much of a difference at this size. So cnn1986 has been replaced by nn1986, a standard, two-layer, dense nn configured as a binary classifier and (mis)used in that capacity. Note: total number of parameters is unchanged. HARK: this new nn exposes a bug somewhere in ctak. Run ctlm with self-play to see the completely borked board state at the end. --- src/ctlm.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/ctlm.c') diff --git a/src/ctlm.c b/src/ctlm.c index e5ce2d5..a8bc194 100644 --- a/src/ctlm.c +++ b/src/ctlm.c @@ -235,41 +235,41 @@ static int handle_turn(char *line) { case GAME_END: { // Did it end this turn? if (new_win) { - switch (won) { - case WIN_DRAW: { - end_game(line, "1/2-1/2"); - break; - } - case WIN_FLAT_BLACK: { - end_game(line, "0-F"); - break; - } - case WIN_FLAT_WHITE: { - end_game(line, "F-0"); - break; - } - case WIN_ROAD_BLACK: { - end_game(line, "0-R"); - break; - } - case WIN_ROAD_WHITE: { - end_game(line, "R-0"); - break; - } - } + switch (won) { + case WIN_DRAW: { + end_game(line, "1/2-1/2"); + break; + } + case WIN_FLAT_BLACK: { + end_game(line, "0-F"); + break; + } + case WIN_FLAT_WHITE: { + end_game(line, "F-0"); + break; + } + case WIN_ROAD_BLACK: { + end_game(line, "0-R"); + break; + } + case WIN_ROAD_WHITE: { + end_game(line, "R-0"); + break; + } + } } puts("Enter `new' to play again."); if (!new_win) - return EXIT_FAILURE; + return EXIT_FAILURE; break; } // Valid, append to game log case ACT_OK: { append_to_gamelog(line, 0); if (auto_board) - print_board(); + print_board(); if (auto_info) - print_info(); + print_info(); break; } } @@ -383,7 +383,7 @@ static int negamax_turn(void) { static int input_is_not_turn(const char *line) { if (!strcmp(line, "help")) { - puts("Valid commands: auto (board|info), board, depth [0-9], eval,\ + puts("Valid commands: auto (board|info), board, depth [0-9], eval, \ help, info, load , log, new, play (b|w), self-play, square\ , tps, ."); } else if (!strcmp(line, "board")) { @@ -391,7 +391,7 @@ help, info, load , log, new, play (b|w), self-play, square\ } else if (!strcmp(line, "info")) { print_info(); } else if (!strcmp(line, "eval")) { - float eval = cnn1986_evaluate_black_win() * 100; + float eval = nn1986_evaluate_black_win() * 100; if (ply & 1) { printf("Black heuristic chance: %s%.2f%s\n", blk, eval, rst); } else { -- cgit v1.3.1