From 9eb1a379853b088df0ab3a4beae4e79eaead4823 Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sat, 23 Jan 2021 18:55:48 -0500 Subject: Fixed some important bugs --- include/negamax.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'include/negamax.c') diff --git a/include/negamax.c b/include/negamax.c index bc912ad..e1c2991 100644 --- a/include/negamax.c +++ b/include/negamax.c @@ -17,15 +17,9 @@ uint64_t *zobrist = NULL; static int negamax_init_zobrist(void) { if (zobrist != NULL) return EXIT_FAILURE; zobrist = malloc(sizeof(uint64_t)*board_size*board_size*16*3*2); - for (int l=0; l>= 1; + if (count) { + colour_stack_t c = colours[l]; + enum STONE_VARIANT s = STONE_AT(l); + for (uint8_t h=0; h>= 1; + } } } return result; @@ -61,7 +56,8 @@ uint64_t negamax_compute_zobrist(void) { // Movement steps, orderd with the enum: UP DOWN LEFT RIGHT static int8_t deltas[4]; -void negamax_init_size(void) { +void negamax_init(const uint8_t new_board_size) { + board_size = new_board_size; deltas[0] = +board_size; deltas[1] = -board_size; deltas[2] = -1; @@ -129,7 +125,9 @@ static enum WIN_TYPE w; float negamax(const uint8_t cur_depth, float alpha, float beta, const float colour) { + uint64_t hash = negamax_compute_zobrist(); + if (cnn1986_cache_seek(hash, &alpha) == EXIT_FAILURE) { const uint8_t black = (ply & 1), material = (black) ? black_count : white_count, -- cgit v1.3.1