aboutsummaryrefslogtreecommitdiff
path: root/src/ct1986.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ct1986.c')
-rw-r--r--src/ct1986.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/ct1986.c b/src/ct1986.c
index b930b13..49a1075 100644
--- a/src/ct1986.c
+++ b/src/ct1986.c
@@ -3,13 +3,13 @@
#include <string.h>
#include <tak.h>
-#include <minimax_cnn1986.h>
+#include <negamax_cnn1986.h>
const char* esc = "\x1B[L";
FILE *lcd = NULL;
static char *gamelog = 0;
-static int human, search_depth;
+static int human;
static void
write_line(const char *line) {
@@ -93,11 +93,10 @@ new_game(uint8_t size) {
gamelog[0] = 0;
}
-// Set up output function for ct1986
-
+// Set up output function for negamax_cnn1986
static uint8_t perc;
inline void
-ct1986_display_progress(const uint8_t depth) {
+negamax_cnn1986_display_progress(const uint8_t depth) {
if (depth == 0) {
perc++;
// back four spaces and clear line, followed by perc%
@@ -109,12 +108,12 @@ ct1986_display_progress(const uint8_t depth) {
}
static int
-ct1986_turn(const uint8_t search_depth) {
+negamax_cnn1986_turn() {
// Prepare progress bar
fputs("Computing: ", lcd); fflush(lcd);
// Run the minimax
perc = 0;
- float minimax = ct1986_generate(search_depth);
+ float minimax = negamax_cnn1986_generate();
fputc('\n', lcd); fflush(lcd);
// Failed to find a move?
if (minimax <= -infty) {
@@ -123,8 +122,8 @@ ct1986_turn(const uint8_t search_depth) {
} else {
fprintf(lcd, "%s: %s\n",
(ply & 1) ? "Black" : "White",
- ct1986_ptn);
- handle_turn(ct1986_ptn);
+ negamax_cnn1986_ptn);
+ handle_turn(negamax_cnn1986_ptn);
return EXIT_SUCCESS;
}
}
@@ -140,8 +139,8 @@ input_is_not_turn(const char *line) {
case 'l': { do_game_log(); break; }
case 'n': { new_game(5); break; }
case 'd': {
- search_depth = line[1] - '0';
- fprintf(lcd, "Search depth: %d\n", search_depth);
+ negamax_cnn1986_search_depth = line[1] - '0';
+ fprintf(lcd, "Search depth: %d\n", negamax_cnn1986_search_depth);
fflush(lcd);
break;
}
@@ -161,7 +160,7 @@ main(int argc, char **argv) {
if (lcd == NULL) return EXIT_FAILURE;
human = 0;
- search_depth = 1;
+ negamax_cnn1986_search_depth = 3;
new_game(5);
fprintf(lcd, "%sB", esc);
fflush(lcd);
@@ -188,7 +187,7 @@ main(int argc, char **argv) {
break;
}
}
- ct1986_turn(search_depth);
+ negamax_cnn1986_turn();
human = 0;
}