aboutsummaryrefslogtreecommitdiff
path: root/include/negamax_cnn1986.c
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-21 01:31:22 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commite1c9a014420648b2799509016b4fc52dec19bc2d (patch)
treedc7ef6bc9902245506053b96c2348e0fff9cb836 /include/negamax_cnn1986.c
parent19359dde885243e2359f7c560ae801efccee7294 (diff)
Renaming
Diffstat (limited to 'include/negamax_cnn1986.c')
-rw-r--r--include/negamax_cnn1986.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/include/negamax_cnn1986.c b/include/negamax_cnn1986.c
index fafb38c..1a6d41a 100644
--- a/include/negamax_cnn1986.c
+++ b/include/negamax_cnn1986.c
@@ -5,8 +5,8 @@
// ===================================================================
const float infty = 3.0;
-char ct1986_ptn[9];
-uint8_t ct1986_search_depth = 3;
+char negamax_cnn1986_ptn[9];
+uint8_t negamax_cnn1986_search_depth = 3;
// ===================================================================
// Implementation of a small convolutional neural network
@@ -37,7 +37,7 @@ static union u_f fudge;
#define RELU(x) ((x) = ((x)<0)?0:(x))
float
-ct1986_evaluate_black_win(void) {
+cnn1986_evaluate_black_win(void) {
/* ------------------ *
* Convolution layer *
* ------------------ */
@@ -166,13 +166,13 @@ static const int8_t deltas[4] = { +5, -5, -1, +1};
else if (w == WIN_DRAW) val = infty/2.0; \
else val = -infty; \
val *= colour; \
- } else if (cur_depth == ct1986_search_depth) { \
+ } else if (cur_depth == negamax_cnn1986_search_depth) { \
/* We're at the bottom, evaluate */ \
- val = colour * ct1986_evaluate_black_win(); \
+ val = colour * cnn1986_evaluate_black_win(); \
} else { \
/* We're not at the bottom, recurse first */ \
next_ply(); \
- val = -ct1986_negamax(cur_depth + 1, -beta, -alpha, -colour); \
+ val = -negamax_cnn1986(cur_depth + 1, -beta, -alpha, -colour); \
previous_ply(); \
} \
{ reset }; \
@@ -186,8 +186,8 @@ static const int8_t deltas[4] = { +5, -5, -1, +1};
}
float
-ct1986_negamax(const uint8_t cur_depth, float alpha, float beta,
- const float colour) {
+negamax_cnn1986(const uint8_t cur_depth, float alpha, float beta,
+ const float colour) {
const uint8_t black = (ply & 1),
material = (black) ? black_count : white_count,
flat = material & 127,
@@ -298,7 +298,7 @@ ct1986_negamax(const uint8_t cur_depth, float alpha, float beta,
WIN_EVALUATE_OR_RECURSE({
// If we did update the optimal value, store
// this move
- generate_move(loc, dir, steps, drops, ct1986_ptn);
+ generate_move(loc, dir, steps, drops, negamax_cnn1986_ptn);
},{
// Reset the board data after recursing or
// before returning
@@ -338,7 +338,7 @@ ct1986_negamax(const uint8_t cur_depth, float alpha, float beta,
celldat[loc] = NUM_INC | STONE_FLAT;
WIN_EVALUATE_OR_RECURSE({
// If we did update the optimal value, store
- generate_place(loc, STONE_FLAT, ct1986_ptn);
+ generate_place(loc, STONE_FLAT, negamax_cnn1986_ptn);
},{
// Reset the state
celldat[loc] = 0;
@@ -353,7 +353,7 @@ ct1986_negamax(const uint8_t cur_depth, float alpha, float beta,
colours[loc] = current_colour;
celldat[loc] = NUM_INC | STONE_STANDING;
WIN_EVALUATE_OR_RECURSE({
- generate_place(loc, STONE_STANDING, ct1986_ptn);
+ generate_place(loc, STONE_STANDING, negamax_cnn1986_ptn);
},{
celldat[loc] = 0;
if (black) black_count++;
@@ -369,7 +369,7 @@ ct1986_negamax(const uint8_t cur_depth, float alpha, float beta,
colours[loc] = current_colour;
celldat[loc] = NUM_INC | STONE_CAPSTONE;
WIN_EVALUATE_OR_RECURSE({
- generate_place(loc, STONE_CAPSTONE, ct1986_ptn);
+ generate_place(loc, STONE_CAPSTONE, negamax_cnn1986_ptn);
},{
celldat[loc] = 0;
if (black) black_count |= 128;
@@ -377,13 +377,13 @@ ct1986_negamax(const uint8_t cur_depth, float alpha, float beta,
});
}
}
- ct1986_display_progress(cur_depth);
+ negamax_cnn1986_display_progress(cur_depth);
}
}
return alpha;
}
inline float
-ct1986_generate(void) {
- return ct1986_negamax(0, -infty, infty, (ply&1)?1.0:-1.0);
+negamax_cnn1986_generate(void) {
+ return negamax_cnn1986(0, -infty, infty, (ply&1)?1.0:-1.0);
}