diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-21 01:31:22 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | e1c9a014420648b2799509016b4fc52dec19bc2d (patch) | |
| tree | dc7ef6bc9902245506053b96c2348e0fff9cb836 /include | |
| parent | 19359dde885243e2359f7c560ae801efccee7294 (diff) | |
Renaming
Diffstat (limited to 'include')
| -rw-r--r-- | include/negamax_cnn1986.c | 30 | ||||
| -rw-r--r-- | include/negamax_cnn1986.h | 11 |
2 files changed, 20 insertions, 21 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); } diff --git a/include/negamax_cnn1986.h b/include/negamax_cnn1986.h index 411d877..799ca4c 100644 --- a/include/negamax_cnn1986.h +++ b/include/negamax_cnn1986.h @@ -3,16 +3,15 @@ #include "weights.h" extern const float infty; -extern char ct1986_ptn[9]; -extern uint8_t ct1986_search_depth; -extern inline void ct1986_display_progress(const uint8_t); +extern char negamax_cnn1986_ptn[9]; +extern uint8_t negamax_cnn1986_search_depth; +extern inline void negamax_cnn1986_display_progress(const uint8_t); // Do negamax to depth ct1986_search_depth and return PTN of best move // in ct1986_ptn, along with its value as the return. The // ct1986_display_progress function is called on every new square at // the top level. -float ct1986_generate(void); +float negamax_cnn1986_generate(void); // Internal utility function -float -ct1986_evaluate_black_win(void); +float cnn1986_evaluate_black_win(void); |
