From c1750c0cb93a7b4ba70e1342eaa7c62e659f1dc5 Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Mon, 18 Jan 2021 11:44:50 -0500 Subject: Finally fixed memory order of weights! --- include/ct1986.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'include/ct1986.c') diff --git a/include/ct1986.c b/include/ct1986.c index 97be8e5..d5325be 100644 --- a/include/ct1986.c +++ b/include/ct1986.c @@ -41,7 +41,7 @@ ct1986_evaluate_black_win(void) { for (uint8_t kx = 0; kx < KERN_SIZE; kx++) { for (uint8_t c = 0; c < KERN_CHAN; c++) { // Where we are on the board - const uint8_t loc = kx+by+(ky+bx)*5; + const uint8_t loc = kx+bx+(ky+by)*5; // Look up what's on the board at this location, and // multiply it. For c=0 we have to do some extra work float lookup = 0; @@ -171,13 +171,10 @@ ct1986_minimax(const uint8_t cur_depth, const uint8_t max_depth, enum E_RESULT r; const uint8_t black = (ply & 1), - material = (black) ? black_count : white_count; - - uint8_t cap = 0, flat = material & 127, standing = 0; - if (ply > 2) { - if (material & 128) cap = 1; - if (material & 127) standing = 1; - } + material = (black) ? black_count : white_count, + flat = material & 127, + cap = (ply > 2 && (material & 128)), + standing = (ply > 2 && (material & 127)); // 1.0 is a `certain' black win, -1.0 is a `certain' white win. float optimal = (min) ? infty : -infty; @@ -266,8 +263,8 @@ ct1986_minimax(const uint8_t cur_depth, const uint8_t max_depth, } } } - } else if (count == 0) { - // Empty square, try the three placements. + } else if (material && count == 0) { + // Empty square, try placements if (flat) { // Generate the placement -- cgit v1.3.1