diff options
Diffstat (limited to 'include/ct1986.c')
| -rw-r--r-- | include/ct1986.c | 17 |
1 files changed, 7 insertions, 10 deletions
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 |
