1111namespace hyperion {
1212namespace engine {
1313
14+ // ======================================================================================
15+ // ======================================================================================
16+ // ====================UNCOMENT BELOW FOR MCTS WITH STATIC EVALUATION====================
17+ // ======================================================================================
18+ // ======================================================================================
1419// For fun I Will add a temporary static evaluation to see how good I can make this. a lot of this will be refactored but hey, the source code is on github so who cares if I cange it
1520// Static evaluation for fun:
16-
21+ /*
1722// --- Piece Values ---
1823constexpr int PAWN_VALUE = 100;
1924constexpr int KNIGHT_VALUE = 320;
@@ -59,6 +64,7 @@ const int* piece_square_tables[] = {
5964 queen_pst,
6065 king_pst
6166};
67+ */
6268// --
6369/* static_evaluate */
6470// --
@@ -70,6 +76,7 @@ const int* piece_square_tables[] = {
7076// The final score is returned from the perspective of the side to move, a common
7177// practice in negamax-style search algorithms. This means a positive score is always
7278// advantageous for the current player.
79+ /*
7380double static_evaluate(const core::Position& pos) {
7481 int score = 0;
7582
@@ -106,7 +113,7 @@ double static_evaluate(const core::Position& pos) {
106113 // If it's Black's turn, a positive score is good for White, so its bad for Black (-score).
107114 return (pos.get_side_to_move() == WHITE) ? static_cast<double>(score) : -static_cast<double>(score);
108115}
109-
116+ */
110117// --
111118/* limited_depth_playout */
112119// --
@@ -119,6 +126,7 @@ double static_evaluate(const core::Position& pos) {
119126// its depth limit, it calls `static_evaluate` on the final position. The result is
120127// then normalized to a value between -1.0 and 1.0 using `std::tanh`, making it
121128// suitable for use in a Monte Carlo Tree Search (MCTS) algorithm.
129+ /*
122130double limited_depth_playout(core::Position position, std::mt19937& gen) {
123131 core::MoveGenerator move_gen;
124132 std::vector<core::Move> move_list;
@@ -166,8 +174,13 @@ double limited_depth_playout(core::Position position, std::mt19937& gen) {
166174 // tanh is a great function for this. We scale the score so that +/- 3 pawns is a near certain win/loss.
167175 return std::tanh(final_score / (PAWN_VALUE * 3.0));
168176}
177+ */
178+ // ======================================================================================
179+ // ======================================================================================
180+ // ====================UNCOMENT ABOVE FOR MCTS WITH STATIC EVALUATION====================
181+ // ======================================================================================
182+ // ======================================================================================
169183
170- // NOTE: THIS WILL BE COMPLETLY REWORKED ONCE WE HAVE A WORKING NN TO EVALUATE THE POS
171184
172185// --
173186/* random_playout */
@@ -178,7 +191,6 @@ double limited_depth_playout(core::Position position, std::mt19937& gen) {
178191 // position: The board state from which the random playout will begin. It is passed by value to avoid modifying the original
179192 // gen: A reference to a Mersenne Twister random number generator for selecting moves
180193 // The result of the game from the perspective of the starting player: 1.0 for a win, -1.0 for a loss, and 0.0 for a draw
181- /*
182194double random_playout (core::Position position, std::mt19937& gen) {
183195 core::MoveGenerator move_gen;
184196 std::vector<core::Move> move_list;
@@ -220,7 +232,7 @@ double random_playout(core::Position position, std::mt19937& gen) {
220232 }
221233 // This line is un reachable as the loop only terminates via a return, but it prevents compiler warnings
222234 return 0.0 ;
223- }*/
235+ }
224236
225237} // namespace engine
226238} // namespace hyperion
0 commit comments