aboutsummaryrefslogtreecommitdiff
path: root/src/ct1986.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ct1986.c')
-rw-r--r--src/ct1986.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/ct1986.c b/src/ct1986.c
index e440255..2b0ffb5 100644
--- a/src/ct1986.c
+++ b/src/ct1986.c
@@ -2,7 +2,7 @@
#include <string.h>
#include <tak.h>
-#include <negamax_cnn1986.h>
+#include <negamax.h>
#include <lcdlib.h>
static char *gamelog = 0;
@@ -83,11 +83,11 @@ new_game(uint8_t size) {
gamelog[0] = 0;
}
-// Set up output function for negamax_cnn1986
+// Set up output function for negamax
static uint8_t perc;
inline void
-negamax_cnn1986_display_progress(const uint8_t depth) {
+negamax_display_progress(const uint8_t depth) {
if (depth == 0) {
perc++;
lcd_printf_line(L_OVERWRITE, "Computing: %d%%", perc*4);
@@ -95,12 +95,12 @@ negamax_cnn1986_display_progress(const uint8_t depth) {
}
static int
-negamax_cnn1986_turn() {
+negamax_turn() {
// Prepare progress bar
lcd_put_line(L_SCROLL, "Computing: 0%");
// Run the minimax
perc = 0;
- float minimax = negamax_cnn1986_generate();
+ float minimax = negamax_generate();
// Failed to find a move?
if (minimax < -infty) {
lcd_printf_line(L_SCROLL, "%s concedes!",
@@ -109,8 +109,8 @@ negamax_cnn1986_turn() {
} else {
lcd_printf_line(L_SCROLL, "%s: %s",
(ply & 1) ? "Black" : "White",
- negamax_cnn1986_ptn);
- return handle_turn(negamax_cnn1986_ptn);
+ negamax_ptn);
+ return handle_turn(negamax_ptn);
}
}
@@ -125,9 +125,9 @@ input_is_not_turn(const char *line) {
case 'l': { do_game_log(); break; }
case 'n': { new_game(5); break; }
case 's': {
- negamax_cnn1986_search_depth = line[1] - '0';
+ negamax_search_depth = line[1] - '0';
lcd_printf_line(L_SCROLL, "Search depth: %d",
- negamax_cnn1986_search_depth);
+ negamax_search_depth);
break;
}
case 'B': { human = 1; new_game(5); break; }
@@ -145,10 +145,8 @@ main(int argc, char **argv) {
if (lcd_begin() != EXIT_SUCCESS)
return EXIT_FAILURE;
- cnn1986_max_num_cached = 500;
- negamax_cnn1986_search_depth = 3;
- negamax_cnn1986_cache_threshold = 2;
- negamax_cnn1986_search_depth = 3;
+ negamax_init_size();
+ negamax_search_depth = 3;
new_game(5);
@@ -176,7 +174,7 @@ main(int argc, char **argv) {
}
}
if (playing) {
- negamax_cnn1986_turn();
+ negamax_turn();
human = 0;
}
}