aboutsummaryrefslogtreecommitdiff
path: root/include/ct1986.c
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-18 11:44:50 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commitc1750c0cb93a7b4ba70e1342eaa7c62e659f1dc5 (patch)
tree3c1510d3ba1a01413303c88a583f1da5f54bd751 /include/ct1986.c
parent28e1df6d45fb04cbc5e25bd079098c9682ac8b0c (diff)
Finally fixed memory order of weights!
Diffstat (limited to 'include/ct1986.c')
-rw-r--r--include/ct1986.c17
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