diff options
| author | tslil clingman <tslil@posteo.de> | 2023-01-15 16:03:37 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | ee216c008a188a9436fedb85c70ee5d1719733b1 (patch) | |
| tree | f1d8fa5efd71851dd4f8d3e2b26b1f95a6086cb9 /src/ctlm.c | |
| parent | 7cf3a656d0c923dd92025c09747461f2f2d1bed0 (diff) | |
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.
Diffstat (limited to 'src/ctlm.c')
| -rw-r--r-- | src/ctlm.c | 54 |
1 files changed, 27 insertions, 27 deletions
@@ -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 <file.ptn>, log, new, play (b|w), self-play, square\ <col><row>, tps, <PTN>."); } else if (!strcmp(line, "board")) { @@ -391,7 +391,7 @@ help, info, load <file.ptn>, 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 { |
