### Installation configuration Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Defines the installation target and destination directory. ```cmake install(TARGETS ${EXE} DESTINATION ${BINDIR}) ``` -------------------------------- ### Install OpenSSL Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Installs OpenSSL for 64-bit (or 32-bit) to support secure connections. ```bash pacman -S mingw-w64-x86_64-openssl ``` ```bash pacman -S mingw-w64-i686-openssl ``` -------------------------------- ### Install build tools and compilers Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Installs unzip, make, GCC toolchains for both 64-bit and 32-bit, and Clang. Required for compiling Stockfish/ShashChess. ```bash pacman -S --noconfirm --needed --disable-download-timeout unzip make mingw-w64-x86_64-gcc mingw-w64-x86_64-toolchain mingw-w64-i686-gcc mingw-w64-i686-toolchain mingw-w64-x86_64-clang ``` -------------------------------- ### Install libcurl 32-bit Source: https://github.com/amchess/shashchess/blob/master/LinuxBuild.txt Enable i386 architecture support and install the 32-bit OpenSSL libcurl development headers. ```bash # enable i386 packages to be installed (may already be enabled) dpkg --add-architecture i386 # update apt to fetch metadata for the new architecture apt update # install! (note: you may need a different version) apt install libcurl4-openssl-dev:i386 ``` -------------------------------- ### Install CURL with WinSSL Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Installs CURL with WinSSL backend for 64-bit (or 32-bit if existing). ```bash pacman -S mingw-w64-x86_64-curl-winssl ``` ```bash pacman -S mingw-w64-i686-curl-winssl ``` -------------------------------- ### Install CURL libraries Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Installs CURL libraries for both 64-bit and 32-bit. Required for network features. ```bash pacman -S --noconfirm --needed --disable-download-timeout mingw-w64-x86_64-curl mingw-w64-i686-curl ``` -------------------------------- ### Install CA certificates Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Installs CA certificates for 64-bit (or 32-bit) to enable HTTPS connections. ```bash pacman -S mingw-w64-x86_64-ca-certificates ``` ```bash pacman -S mingw-w64-i686-ca-certificates ``` -------------------------------- ### Install libcurl 64-bit Source: https://github.com/amchess/shashchess/blob/master/LinuxBuild.txt Install the required libcurl development headers on a 64-bit system using either the GnuTLS or OpenSSL variant. ```bash apt-get install libcurl4-gnutls-dev ``` ```bash apt-get install libcurl4-openssl-dev ``` -------------------------------- ### Sample eval output with UCI_ShowWDL enabled Source: https://github.com/amchess/shashchess/wiki/Verbose-Trace-(HumanAnalyisis) Example output from the eval command when UCI_ShowWDL is enabled, showing the Shashin static analysis report including piece activity, legal moves ordering, and final evaluation. ```text === SHASHIN STATIC ANALYSIS === *** Static activity evaluation based on NNUE network *** --- PIECE ACTIVITY ANALYSIS (Makogonov Principle) --- White pieces: Na1(4) <-- Worst unit, Bb2(12), Rf1(14), ... Black pieces: Nh8(2) <-- Worst unit, ... --- LEGAL MOVES ANALYSIS --- Legal moves ordered by static activity: e4(+0.35 cp, 52%), d4(+0.31 cp, 51%), ... ================================ Final Static Activity Evaluation: 0.35 cp | 52% win probability (White) WDL: 18% Win / 68% Draw / 14% Loss Shashin Zone: Chaos: Capablanca-Tal (Initiative) ``` -------------------------------- ### Configure Full Depth Threads in ThreadPool Source: https://github.com/amchess/shashchess/wiki/Full-Depth-Threads This function assigns the fullSearch flag to threads starting from the end of the thread list based on the requested count. ```cpp // from thread.cpp void ThreadPool::setFull(size_t requested) { int thisidx = 0; int startfull = size() - requested; for (auto&& th : *this) th->worker->fullSearch = thisidx++ >= startfull; } ``` -------------------------------- ### ThreadPool::setFull - Assign Full Depth Threads from End of List Source: https://github.com/amchess/shashchess/blob/master/doc/general/FullDepthThreads/FullDepthThreads.docx This C++ code from thread.cpp configures which worker threads operate in full depth mode. It assigns the requested number of threads from the end of the thread list, setting the fullSearch flag accordingly. For example, with 8 threads and Full depth threads = 2, threads #6 and #7 become full depth. ```C++ // from thread.cpp void ThreadPool::setFull(size_t requested) { int thisidx = 0; int startfull = size() - requested; for (auto&& th : *this) th->worker->fullSearch = thisidx++ >= startfull; } ``` -------------------------------- ### Compile Stockfish using Makefile Source: https://github.com/amchess/shashchess/blob/master/README.md Commands to navigate to the source directory, view help, download the neural network, and build the engine for a specific architecture. ```bash cd src make help make net make build ARCH=x86-64-modern ``` -------------------------------- ### MovePicker Initialization Comment Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Adds documentation for the MovePicker initialization and quiescence search move generation strategy. ```cpp + // Initialize a MovePicker object for the current position, and prepare to search + // the moves. We presently use two stages of move generator in quiescence search: + // captures, or evasions only when in check. MovePicker mp(pos, ttData.move, DEPTH_QS, &mainHistory, &lowPlyHistory, &captureHistory, ``` -------------------------------- ### Check compiler information Source: https://github.com/amchess/shashchess/blob/master/README.md Command to display the compiler version and build information for the Stockfish executable. ```bash ./stockfish compiler ``` -------------------------------- ### Q-Learning Update Rule in learn.cpp Source: https://github.com/amchess/shashchess/blob/master/doc/general/Rlearning/Rlearning.docx Implementation of the Q-Learning update rule using a learning rate of 0.5 and a discount factor of 0.99 to back-propagate game results. ```cpp // from learn.cpp void putQLearningTrajectoryIntoLearningTable() { const double learning_rate = 0.5; const double gamma = 0.99; // ... iterate backwards through the game trajectory ... prevLearningMove.score = prevLearningMove.score * (1 - learning_rate) + learning_rate * (gamma * currentLearningMove.score); } ``` -------------------------------- ### Fallback update command Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Run this if problems persist after the previous update command. ```bash pacman -Syu ``` -------------------------------- ### SEE Margin Optimization Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Replaces standard Stockfish SEE margin logic with Shashin-specific adjustments based on aggressive, strategical, or fortress node states. ```cpp // B) SEE Margin - int seeMargin = -80; // Standard Stockfish + // --- SHASHIN QSEARCH OPTIMIZATION --- + int seeMargin = -80; // Default Stockfish if (isAggressive) - seeMargin -= 18; // Tal: -98 + { + // Tal: Permette sacrifici speculativi se il Re è in pericolo + seeMargin = staticState.kingDanger ? -150 : -105; + } else if (isStrategical) - seeMargin += 18; // Petrosian: -62 + { + // Petrosian: Richiede scambi solidi, non tollera perdite di materiale + seeMargin = -35; + } + // Use isFortressNode (defined at top) + else if (isFortressNode) + { + seeMargin = -10; + } + // ------------------------------------ ``` -------------------------------- ### Triggering MCTS via Shashin Framework Source: https://github.com/amchess/shashchess/blob/master/doc/general/MCTS/mcts.pdf This snippet from search.cpp demonstrates the conditional logic used to activate the Monte Carlo Tree Search based on Shashin-specific criteria and user options. ```cpp if (bool(options["MCTS by Shashin"])) { // ... bool possibleMCTSByValue = localShashinManager.isMCTSApplicableByValue(); if ( ... (possibleMCTSByValue || mctsExplore) ... ) { MonteCarlo* monteCarlo = new MonteCarlo(rootPos, this, tt); monteCarlo->search(...); } } ``` -------------------------------- ### Include directories and executable definition Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Sets the source directory for includes and defines the project executable. ```cmake include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # Add executable add_executable(${EXE} ${SRCS}) ``` -------------------------------- ### Format C++ code Source: https://github.com/amchess/shashchess/blob/master/CONTRIBUTING.md Run this command to format your C++ changes according to the project's style guidelines. This requires clang-format version 20. ```bash make format ``` -------------------------------- ### Q-Learning Update Rule in learn.cpp Source: https://github.com/amchess/shashchess/blob/master/doc/general/Rlearning/Rlearning.pdf Implementation of the Q-Learning update rule used to back-propagate game results through the trajectory of moves. ```cpp void putQLearningTrajectoryIntoLearningTable() { const double learning_rate = 0.5; const double gamma = 0.99; // ... iterate backwards through the game trajectory ... prevLearningMove.score = prevLearningMove.score * (1 - learning_rate) + learning_rate * (gamma * currentLearningMove.score); } ``` -------------------------------- ### Define Build Options Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Sets default CMake options for the project, including debugging, optimization, sanitizers, and various CPU instruction set support. ```cmake option(DEBUG "Enable debugging" OFF) option(OPTIMIZE "Enable optimizations" ON) option(SANITIZE "Enable sanitizers" OFF) option(USE_PREFETCH "Enable prefetch" OFF) option(USE_POPCNT "Enable popcnt instruction" OFF) option(USE_SSE "Enable SSE instruction set" OFF) option(USE_SSE2 "Enable SSE2 instruction set" OFF) option(USE_SSSE3 "Enable SSSE3 instruction set" OFF) option(USE_SSE41 "Enable SSE4.1 instruction set" OFF) option(USE_AVX2 "Enable AVX2 instruction set" OFF) option(USE_AVXVNNI "Enable AVXVNNI instruction set" OFF) option(USE_AVX512 "Enable AVX512 instruction set" OFF) option(USE_VNNI256 "Enable VNNI256 instruction set" OFF) option(USE_VNNI512 "Enable VNNI512 instruction set" OFF) option(USE_NEON "Enable NEON instruction set" OFF) option(USE_DOTPROD "Enable NEON Dot Product instruction set" OFF) option(BITS "Set 32/64 bit build" 64) ``` -------------------------------- ### Shashin State and Fortress Node Definitions Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Initializes Shashin-specific state and fortress detection at the beginning of the qsearch function. ```cpp const RootShashinState& rootShashinState = shashinManager->getState(); + const bool isFortressNode = shashinManager->isFortress(pos); ``` -------------------------------- ### Variety System Implementation in search.cpp Source: https://github.com/amchess/shashchess/blob/master/doc/general/Variety/variety.docx This logic applies a dynamic bonus to the evaluation based on a PRNG, injecting randomness only when the current score is within a specific variety window. ```cpp // from search.cpp if (variety != 0) { Value maxIncrement = (variety == 1) ? 13 : 309; static PRNG rng(now()); // Apply only if the current score is within the variety window if (((variety == 2) && (bestValue <= 309) && (bestValue >= -309)) || ((variety == 1) && (bestValue <= 13) && (bestValue >= -13))) { int maxValidIncrement = maxIncrement - std::abs(bestValue); if (maxValidIncrement < 0) { maxValidIncrement = 0; } // Inject randomness int increment = static_cast(rng.rand() % (maxValidIncrement + 1)); bestValue += increment; } } ``` -------------------------------- ### Set compile definitions Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Adds global compile definitions for the project. ```cmake add_compile_definitions(USE_LIVEBOOK) ``` -------------------------------- ### Compile GoldDigger variant Source: https://github.com/amchess/shashchess/blob/master/README.md Use the make command with the GOLD_DIGGER macro to build the tactical-focused version of the engine. ```bash make build ARCH=x86-64-modern EXTRACXXFLAGS="-DGOLD_DIGGER" ``` -------------------------------- ### Download NNUE network files Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Defines custom commands and targets to download the required NNUE neural network file during the build process. ```cmake set(NNUE_NET "nn-b1a57edbea57.nnue") add_custom_command( OUTPUT ${NNUE_NET} COMMAND ${CMAKE_COMMAND} -E echo "Downloading ${NNUE_NET}..." COMMAND ${CMAKE_COMMAND} -E download "https://tests.stockfishchess.org/api/nn/${NNUE_NET}" "${CMAKE_BINARY_DIR}/${NNUE_NET}" COMMAND ${CMAKE_COMMAND} -E echo "Download completed: ${NNUE_NET}" VERBATIM ) add_custom_target(net ALL DEPENDS ${NNUE_NET} ) add_custom_target(clean-net COMMAND ${CMAKE_COMMAND} -E remove ${NNUE_NET} ) ``` -------------------------------- ### Injecting Variety into Quiescence Search Source: https://github.com/amchess/shashchess/blob/master/doc/general/Variety/variety.pdf This C++ snippet from search.cpp implements the Variety logic by applying a dynamic bonus to the bestValue based on a PRNG, constrained by the current evaluation score. ```cpp // from search.cpp if (variety != 0) { Value maxIncrement = (variety == 1) ? 13 : 309; static PRNG rng(now()); // Apply only if the current score is within the variety window if (((variety == 2) && (bestValue <= 309) && (bestValue >= -309)) || ((variety == 1) && (bestValue <= 13) && (bestValue >= -13))) { int maxValidIncrement = maxIncrement-std::abs(bestValue); if (maxValidIncrement < 0) { maxValidIncrement = 0; } // Inject randomness int increment = static_cast(rng.rand() % (maxValidIncrement + 1)); bestValue += increment; } } ``` -------------------------------- ### Futility Pruning and Tactical Logic Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Implementation of futility pruning with conditional tactical logic for high-Tal or king-danger scenarios. ```cpp if (moveCount > moveCountThreshold) continue; Value futilityValue = futilityBase + PieceValue[pos.piece_on(move.to_sq())]; // If static eval + value of piece we are going to capture is // much lower than alpha, we can prune this move. if (futilityValue <= alpha) { bestValue = std::max(bestValue, futilityValue); continue; } // If static exchange evaluation is low enough // we can prune this move. if (!pos.see_ge(move, alpha - futilityBase)) { const bool riskyTactical = dynamicDerived.isHighTal || (staticState.kingDanger && !isStrategical); if (riskyTactical) { // Tal: Cerca comunque se non è un disastro totale (-200) if (!pos.see_ge(move, -200)) { bestValue = std::max(bestValue, std::min(alpha, futilityBase)); continue; } } else { // Strategic/Standard: Fidati della valutazione statica bestValue = std::max(bestValue, std::min(alpha, futilityBase)); continue; } } ``` -------------------------------- ### Triggering MCTS via Shashin Logic in search.cpp Source: https://github.com/amchess/shashchess/blob/master/doc/general/MCTS/mcts.docx This snippet demonstrates the conditional activation of the MonteCarlo search engine based on the 'MCTS by Shashin' option and the applicability of MCTS to the current position. ```cpp // from search.cpp if (bool(options["MCTS by Shashin"])) { // ... bool possibleMCTSByValue = localShashinManager.isMCTSApplicableByValue(); if ( ... (possibleMCTSByValue || mctsExplore) ... ) { MonteCarlo* monteCarlo = new MonteCarlo(rootPos, this, tt); monteCarlo->search(...); } } ``` -------------------------------- ### Configure git blame ignore Source: https://github.com/amchess/shashchess/blob/master/CONTRIBUTING.md Configure Git to ignore noisy formatting commits when using git blame by setting the ignoreRevsFile. ```bash git config blame.ignoreRevsFile .git-blame-ignore-revs ``` -------------------------------- ### Link system-specific libraries Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Links required libraries based on the host operating system, targeting Windows or other platforms. ```cmake if(CMAKE_SYSTEM_NAME STREQUAL "Windows") target_link_libraries(${EXE} bcrypt advapi32 crypt32 gdi32 ws2_32) else() target_link_libraries(${EXE} curl) endif() ``` -------------------------------- ### Injecting Randomness in search.cpp Source: https://github.com/amchess/shashchess/wiki/Variety This snippet implements the bounded randomness logic by calculating a valid increment based on the current evaluation and adding it to the bestValue. ```cpp // Logic snippet from search.cpp int maxValidIncrement = maxIncrement - std::abs(bestValue); if (maxValidIncrement < 0) { maxValidIncrement = 0; } // Inject randomness int increment = static_cast(rng.rand() % (maxValidIncrement + 1)); bestValue += increment; ``` -------------------------------- ### Update MSYS2 packages Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Run this command in MSYS2 to update all packages. Repeat until all packages show 'xxx is up to date'. ```bash pacman -Syuu --noconfirm --needed --disable-download-timeout ``` -------------------------------- ### Configure Compiler Flags Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Sets the C++ standard and base compiler flags, then conditionally appends flags based on the enabled build options. ```cmake set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wcast-qual -fexceptions -std=c++17") if(DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG") endif() if(OPTIMIZE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -funroll-loops") endif() if(SANITIZE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZE}") set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=${SANITIZE}") endif() if(USE_PREFETCH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_PREFETCH") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_PREFETCH") endif() if(USE_POPCNT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_POPCNT") endif() if(USE_SSE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse") endif() if(USE_SSE2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") endif() if(USE_SSSE3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") endif() if(USE_SSE41) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") endif() if(USE_AVX2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mbmi") endif() if(USE_AVXVNNI) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavxvnni") endif() if(USE_AVX512) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512bw") endif() if(USE_VNNI256) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512bw -mavx512vnni -mavx512dq -mavx512vl -mprefer-vector-width=256") endif() if(USE_VNNI512) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512bw -mavx512vnni -mavx512dq -mavx512vl -mprefer-vector-width=512") endif() if(USE_NEON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_NEON") endif() if(USE_DOTPROD) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8.2-a+dotprod -DUSE_NEON_DOTPROD") endif() ``` -------------------------------- ### Quiescence Search Move Loop and Piece Definition Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt The main loop for iterating through pseudo-legal moves, including the definition of the moved piece for tactical checks. ```cpp while ((move = mp.next_move()) != Move::none()) { assert(move.is_ok()); // FIX 2: Definiamo movedPiece qui perché serve per il controllo tattico Tal Piece movedPiece = pos.moved_piece(move); if (!pos.legal(move)) continue; ``` -------------------------------- ### Fortress Node Move Threshold Adjustment Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Replaces MoveConfig with the isFortressNode boolean for move count threshold logic. ```cpp - if (MoveConfig::isFortress) + // Use isFortressNode (defined at top) instead of MoveConfig + if (isFortressNode) ``` -------------------------------- ### Futility Base Optimization Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Removes an outdated comment regarding futility base adjustments. ```cpp // --- SHASHIN OPTIMIZATION 1: FUTILITY BASE (Outside Loop) --- - // Correggiamo il valore ridicolo (+3) con qualcosa di sensato. if (dynamicDerived.isHighTal) ``` -------------------------------- ### MCTS Integration in search.cpp Source: https://github.com/amchess/shashchess/wiki/MCTS Code from search.cpp showing the conditional instantiation of the MonteCarlo object when the 'MCTS by Shashin' option is enabled and the position meets the criteria (Petrosian/Chaos or MCTS Explore). ```cpp // from search.cpp if (bool(options["MCTS by Shashin"])) { // Check if the position fits the criteria (Petrosian/Chaos) bool possibleMCTSByValue = localShashinManager.isMCTSApplicableByValue(); if ( ... (possibleMCTSByValue || mctsExplore) ... ) { // Initialize the Monte Carlo specialist MonteCarlo* monteCarlo = new MonteCarlo(rootPos, this, tt); monteCarlo->search(...); } } ``` -------------------------------- ### Hybrid Pruning Optimization Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Phase 4 pruning logic that uses shared history scores for non-capture moves under extreme volatility. ```cpp // --- PHASE 4: HYBRID PRUNING OPTIMIZATION --- // Skip non-captures if (!capture) { if (extremelyVolatile) // Use pre-calculated flag { // Accesso costoso alla sharedHistory solo qui, nel caso critico int historyScore = sharedHistory.pawn_entry(pos)[movedPiece][move.to_sq()]; // Soglia fissa a 4000 (valore di sicurezza per mosse buone) if (historyScore < 4000) continue; } else { // COMPORTAMENTO STANDARD STOCKFISH continue; } } // --- END PHASE 4 --- ``` -------------------------------- ### Set 32/64 bit compiler flags Source: https://github.com/amchess/shashchess/blob/master/src/CMakeLists.txt Configures CMAKE_CXX_FLAGS based on the BITS variable to support 32-bit or 64-bit builds. ```cmake if(BITS EQUAL 32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -DIS_64BIT") endif() ``` -------------------------------- ### Non-PV Node TT Cutoff Comment Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Adds a comment clarifying the early TT cutoff check for non-PV nodes. ```cpp + // At non-PV nodes we check for an early TT cutoff ``` -------------------------------- ### MCTS Decision Flow Diagram (Mermaid) Source: https://github.com/amchess/shashchess/wiki/MCTS A Mermaid flowchart illustrating the decision process: the root position undergoes Shashin analysis, leading to either standard Alpha-Beta search or, for Petrosian/high-density positions, a hybrid MCTS search if enabled. ```mermaid graph TD A[Root Position] --> B{Shashin Analysis} B -->|Standard Position| C[Alpha-Beta Search] B -->|Petrosian / High Density| D{Enable MCTS?} D -->|Yes| E[Hybrid MCTS Search] D -->|No| C C --> F[Best Move] E --> F ``` -------------------------------- ### Disable LMR Step for Full Depth Threads in search.cpp Source: https://github.com/amchess/shashchess/blob/master/doc/general/FullDepthThreads/FullDepthThreads.docx This C++ code from search.cpp shows how the fullSearch flag disables the Late Move Reduction (LMR) step. When fullSearch is true, doLMRStep is set to false, preventing reductions for moves that are not clearly bad, forcing closer to full-depth search. ```C++ // from search.cpp bool doLMRStep = !fullSearch; // ... later in the code ... if (depth >= 2 && moveCount > std::max(sibs, 1) && doLMRStep) { // Perform LMR (Reduction) } ``` -------------------------------- ### TT Value Handling Comments Source: https://github.com/amchess/shashchess/blob/master/src/difference.txt Adds comments regarding the reliability and usage of values stored in the Transposition Table. ```cpp + // Never assume anything about values stored in TT unadjustedStaticEval = ttData.eval; if (!is_valid(unadjustedStaticEval)) unadjustedStaticEval = evaluate(pos); ss->staticEval = bestValue = to_corrected_static_eval(unadjustedStaticEval, correctionValue); + // ttValue can be used as a better position evaluation ``` -------------------------------- ### Modify Makefile LDFLAGS for CURL Source: https://github.com/amchess/shashchess/blob/master/WindowsBuild.docx Replace the LDFLAGS line near line 397 in the Makefile with this to link against CURL and related libraries. Required for building with network support. ```makefile LDFLAGS += -DUSE_LIVEBOOK -lcurl -lnghttp2 -lnghttp3 -lidn2 -lssh2 -lssh2 -lpsl -lbcrypt -ladvapi32 -lcrypt32 -lbcrypt -lssl -lcrypto -lssl -lcrypto -lgdi32 -lwldap32 -lzstd -lzstd -lbrotlidec -lz -lws2_32 -lidn2 -liconv -lunistring -lbrotlidec -lbrotlicommon –static ``` -------------------------------- ### Modify Makefile LDFLAGS Source: https://github.com/amchess/shashchess/blob/master/LinuxBuild.txt Update the Makefile by removing the Windows-specific -lws2_32 flag from the LDFLAGS variable. ```makefile LDFLAGS += -lcurl -lws2_32 $(EXTRALDFLAGS) ``` ```makefile LDFLAGS += -lcurl $(EXTRALDFLAGS) ``` -------------------------------- ### Bypass LMR in Search Loop Source: https://github.com/amchess/shashchess/wiki/Full-Depth-Threads The fullSearch flag is used to disable Late Move Reductions (LMR) within the search loop, ensuring deeper analysis for specific threads. ```cpp // from search.cpp bool doLMRStep = !fullSearch; // If FullSearch is active, LMR is disabled if (depth >= 2 && moveCount > std::max(sibs, 1) && doLMRStep) { // Perform Standard LMR (Skipped by Full Depth Threads) } ```