aboutsummaryrefslogtreecommitdiff
path: root/src/ctaklm.c
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2021-01-14 15:09:39 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commitc1773e2712c5878e5f40e47e4a463a14724f55a8 (patch)
tree9150b948e1023ec6d60ac1ad6ff2f3e63e531078 /src/ctaklm.c
parent2a7b485265997d62625dc0ee5d8e91ede1c5f99f (diff)
Better trained weights, an important oversight in minimax (steps <=)
I still can't tell whether if ((ply & 1) == 0) this = this - 1.0; is correct.
Diffstat (limited to 'src/ctaklm.c')
-rw-r--r--src/ctaklm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ctaklm.c b/src/ctaklm.c
index cf7d0c4..c361f70 100644
--- a/src/ctaklm.c
+++ b/src/ctaklm.c
@@ -235,12 +235,12 @@ handle_turn(char *line) {
return EXIT_SUCCESS;
}
-static int human = 1;
+static int human;
static void
new_game(uint8_t size) {
reset_state(size);
- human = 0;
+ human = 1;
printf("New %dx%d game!\n",size,size);
if (gamelog) gamelog = realloc(gamelog, sizeof(char));
else gamelog = malloc(sizeof(char));
@@ -317,7 +317,7 @@ ct1986_turn(const uint8_t max_depth) {
fflush(stdout);
// Run the minimax
float minimax = ct1986_generate(max_depth);
- if (minimax < -infty) {
+ if (minimax <= -infty) {
puts("] Opponent concedes!");
} else {
printf("] Result: %s (%.3f)\n",
@@ -410,7 +410,7 @@ main(int argc, char **argv) {
if (human && line == NULL) {
playing = 0;
} else {
- ct1986_turn(1);
+ ct1986_turn(3);
human = 1;
}
}