@@ -28,9 +28,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
2828#include " eucalyptus.hpp"
2929
3030extern " C" {
31- #ifdef WINDOWS
32- #include < conio.h>
33- #endif
31+ #ifdef WINDOWS
32+ #include < conio.h>
33+ #endif
3434}
3535
3636// Namespace
@@ -55,6 +55,8 @@ constexpr int FIFTY = 100; // 100 moves w/o progress is a dr
5555constexpr int R50_ARR = (FIFTY + 2 ); // Checkmate overrules 50 move rep so extra space here
5656constexpr int SHUFFLE = 30 ; // Allow shuffling then scale
5757constexpr int BOOK_MS = 100 ; // At least 100ms+ for the book lookup
58+ constexpr int LEVEL = 100 ; // Level of engine. ( 0: Random, 1-99: Levels, 100: Full)
59+ constexpr int NOISE_PAWNS = 5 ; // Add noise to eval for different playing levels ( -5 -> +5 pawns )
5860constexpr int PERFT_DEPTH = 6 ; // Perft at depth 6
5961constexpr int BENCH_DEPTH = 14 ; // Bench at depth 14
6062constexpr int BENCH_SPEED = 10000 ; // Bench for 10s
@@ -462,7 +464,7 @@ std::uint64_t g_black = 0, g_white = 0, g_both = 0, g_empty = 0, g_good = 0, g_s
462464 g_rook_magic_moves[64 ][4096 ]{}, g_zobrist_ep[64 ]{}, g_zobrist_castle[16 ]{}, g_zobrist_wtm[2 ]{},
463465 g_r50_positions[R50_ARR]{}, g_zobrist_board[13 ][64 ]{};
464466
465- int g_move_overhead = MOVEOVERHEAD, g_level = 100 , g_root_n = 0 , g_king_w = 0 , g_king_b = 0 , g_moves_n = 0 ,
467+ int g_move_overhead = MOVEOVERHEAD, g_level = LEVEL , g_root_n = 0 , g_king_w = 0 , g_king_b = 0 , g_moves_n = 0 ,
466468 g_max_depth = MAX_SEARCH_DEPTH, g_q_depth = 0 , g_depth = 0 , g_best_score = 0 , g_noise = NOISE, g_last_eval = 0 ,
467469 g_fullmoves = 1 , g_rook_w[2 ]{}, g_rook_b[2 ]{}, g_nnue_pieces[64 ]{}, g_nnue_squares[64 ]{};
468470
@@ -474,7 +476,7 @@ Board g_board_empty{}, *g_board = &g_board_empty, *g_moves = nullptr, *g_board_o
474476 g_boards[MAX_SEARCH_DEPTH + MAX_Q_SEARCH_DEPTH][MAX_MOVES]{};
475477
476478std::uint32_t g_hash_entries = 0 , g_tokens_nth = 0 ;
477- std::vector<std::string> g_tokens (300 ); // 300 plys init
479+ std::vector<std::string> g_tokens (256 ); // 300 plys init
478480polyglotbook::PolyglotBook g_book{};
479481std::unique_ptr<HashEntry[]> g_hash{};
480482
@@ -575,19 +577,19 @@ const std::string MakeMove2Str(const int from, const int to) {
575577}
576578
577579extern " C" {
578- bool IsInputAvailable () { // See if std::cin has smt
579- #ifdef WINDOWS
580- return _kbhit ();
581- #else
582- fd_set fd{};
583- struct timeval tv = { .tv_sec = 0 , .tv_usec = 0 };
584- FD_ZERO (&fd);
585- FD_SET (STDIN_FILENO, &fd);
586- select (STDIN_FILENO + 1 , &fd, nullptr , nullptr , &tv);
587- return FD_ISSET (STDIN_FILENO, &fd) > 0 ;
588- #endif
580+ bool IsInputAvailable () { // See if std::cin has smt
581+ #ifdef WINDOWS
582+ return _kbhit ();
583+ #else
584+ fd_set fd{};
585+ struct timeval tv = { .tv_sec = 0 , .tv_usec = 0 };
586+ FD_ZERO (&fd);
587+ FD_SET (STDIN_FILENO, &fd);
588+ select (STDIN_FILENO + 1 , &fd, nullptr , nullptr , &tv);
589+ return FD_ISSET (STDIN_FILENO, &fd) > 0 ;
590+ #endif
591+ }
589592}
590- } // extern "C"
591593
592594// ms since 1.1.1970
593595std::uint64_t Now (const std::uint64_t ms = 0 ) {
@@ -2168,16 +2170,11 @@ int EvaluateClassical(const bool wtm) {
21682170}
21692171
21702172int EvaluateNNUE (const bool wtm) {
2171- return NnueEval { .wtm = wtm }
2172- .evaluate ();
2173+ return NnueEval { .wtm = wtm }.evaluate ();
21732174}
21742175
2175- // Add noise to eval for different playing levels ( -5 -> +5 pawns )
2176- // 0 (Random Mover)
2177- // 1-99 (Levels)
2178- // 100 (Full Strength)
21792176int LevelNoise () {
2180- return Random (-5 * (100 - g_level), +5 * (100 - g_level));
2177+ return Random (-NOISE_PAWNS * (100 - g_level), +NOISE_PAWNS * (100 - g_level));
21812178}
21822179
21832180float GetScale () {
@@ -2825,7 +2822,7 @@ void UciUci() {
28252822 " id name " << VERSION << ' \n ' <<
28262823 " id author Toni Helminen\n " <<
28272824 " option name UCI_Chess960 type check default false\n " <<
2828- " option name Level type spin default 100 min 0 max 100\n " <<
2825+ " option name Level type spin default " << LEVEL << " min 0 max 100\n " <<
28292826 " option name MoveOverhead type spin default " << MOVEOVERHEAD << " min 0 max 100000\n " <<
28302827 " option name Hash type spin default " << DEF_HASH_MB << " min 1 max 1048576\n " <<
28312828 " option name EvalFile type string default " << EVAL_FILE << ' \n ' <<
0 commit comments