Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Stockfish: Difference between revisions

From Repertoire Builder
 
(11 intermediate revisions by the same user not shown)
Line 11: Line 11:


You can interact directly with the move list:
You can interact directly with the move list:
<ul style="list-style:none; padding-left:0.5em; margin:0;">
<ul style="list-style:none; padding-left:1.5em; margin:0;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Reuse existing repertoire annotations within your library items</li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Maintain consistency between your repertoire and library</li>
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Speed up the process of analyzing and commenting on positions</li>
    Reuse existing repertoire annotations within your library items
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Instantly copy repertoire annotations into your current game or analysis</li>
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
    Maintain consistency between your repertoire and library
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
    Speed up the process of analyzing and commenting on positions
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
    Instantly copy repertoire annotations into your current game or analysis
  </li>
</ul>
</ul>


Line 21: Line 33:
This feature helps you:
This feature helps you:


<ul style="list-style:none; padding-left:0.5em; margin:0;">
<ul style="list-style:none; padding-left:1.5em; margin:0;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span> Analyze any position quickly with Stockfish’s strongest available evaluations</li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span> View real-time depth and performance (MNps) as the engine searches</li>
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span>
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span> Expand and explore entire engine lines interactively</li>
    Analyze any position quickly with Stockfish’s strongest available evaluations
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span> Add engine-recommended moves and analysis directly into your repertoire or library</li>
  </li>
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span> Instantly revisit cached positions without re-running the engine</li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span> Control the depth and detail of analysis for efficient study</li>
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span>
    View real-time depth and performance (MNps) as the engine searches
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span>
    Expand and explore entire engine lines interactively
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span>
    Add engine-recommended moves and analysis directly into your repertoire or library
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span>
    Instantly revisit cached positions without re-running the engine
  </li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">+</span>
    Control the depth and detail of analysis for efficient study
  </li>
</ul>
</ul>


Line 42: Line 72:
=== Requirements ===
=== Requirements ===


<ul style="list-style:none; padding-left:0.5em; margin:0;">
<ul style="list-style:none; padding-left:1.5em; margin:0;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> <b>Python 3.9+</b> installed on your system</li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
   <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> A UCI-compatible engine binary, such as:
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
     <ul style="list-style:none; padding-left:1.4em; margin:0.3em 0 0 0;">
    <b>Python 3.9+</b> installed on your system
       <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Stockfish</li>
  </li>
       <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Berserk</li>
   <li style="text-indent:-1.1em; padding-left:1.1em;">
       <li><span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span> Komodo</li>
    <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
    A UCI-compatible engine binary, such as:
     <ul style="list-style:none; padding-left:1.5em; margin:0.3em 0 0 0;">
       <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        Stockfish
      </li>
       <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        Berserk
      </li>
       <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        Komodo
      </li>
     </ul>
     </ul>
   </li>
   </li>
Line 57: Line 101:
<ol style="list-style-type:decimal;padding-left:0.5em; margin:1em;">
<ol style="list-style-type:decimal;padding-left:0.5em; margin:1em;">
   <li>Install <b>Python 3.9+</b> and make sure the command <code>python</code> (or <code>python3</code> on macOS/Linux) is available in your terminal.</li>
   <li>Install <b>Python 3.9+</b> and make sure the command <code>python</code> (or <code>python3</code> on macOS/Linux) is available in your terminal.</li>
   <li>Download the files <b>CBMEngineProxy.py</b> and <b>config.json</b> from the <a href="https://github.com/HollowLeaf1981/CBMEngineProxy" target="_blank">GitHub repository</a>.</li>
   <li>Download the files <b>CBMEngineProxy.py</b> and <b>config.json</b> from the [https://github.com/HollowLeaf1981/CBMEngineProxy GitHub repository].</li>
   <li>Save both files together in the same folder.</li>
   <li>Save both files together in the same folder.</li>
   <li>Open a terminal in that folder and install the required dependency: <code>pip install websockets</code></li>
   <li>Open a terminal in that folder and install the required dependency: <code>pip install websockets</code></li>
Line 86: Line 130:
</pre>
</pre>


'''Notes:'''
{{Notice|Note|<b>engine_path:</b> Full path to your UCI engine binary (<code>.exe</code> on Windows, no extension on macOS/Linux). <b>host:</b> Usually leave as <code>127.0.0.1</code>. port:</b> Must match the connection port used by Chessboard Magic. <b>logging:</b> Set to <code>true</code> for debugging output, or <code>false</code> for silent mode}}
 
* '''engine_path: ''' Full path to your UCI engine binary (.exe on Windows, no extension on macOS/Linux)
* '''host: ''' Usually leave as <code>127.0.0.1</code>
* '''port: ''' Must match the connection port used by Chessboard Magic
* '''logging: ''' Set to <code>true</code> for debugging output, or <code>false</code> for silent mode


=== Running the Proxy ===
=== Running the Proxy ===
Line 105: Line 144:
=== Using with Chessboard Magic ===
=== Using with Chessboard Magic ===


# Launch Chessboard Magic in your browser.
<ol style="list-style-type:decimal; padding-left:1.5em; margin:1em;">
# Open the '''Stockfish''' card.
  <li style="margin-left:0; text-indent:0;">
# Click on the '''Stockfish''' label and select '''Local Stockfish'''.
    Launch Chessboard Magic in your browser.
# Configure the following parameters:
  </li>
#* '''URL:''' <code>http:&#8203;//127.0.0.1:9480</code> — normally this does not need to change.
  <li style="margin-left:0; text-indent:0;">
#* '''Hash (MB): ''' <code>4096</code> — sets how much memory the engine can use.
    Open the <b>Stockfish</b> card.
#* '''Threads:''' <code>12</code> — defines how many CPU threads are used.
  </li>
#* '''Syzygy Path:''' If you have tablebases installed, set this to the directory path of your Syzygy files.
  <li style="margin-left:0; text-indent:0;">
    Click on the <b>Stockfish</b> label and select <b>Local Stockfish</b>.
  </li>
  <li style="margin-left:0; text-indent:0;">
    Configure the following parameters:
    <ul style="list-style:none; padding-left:1.3em; margin:0.3em 0 0 0;">
      <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        <b>URL:</b> <code>http://127.0.0.1:9480</code> — normally this does not need to change.
      </li>
      <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        <b>Hash (MB):</b> <code>4096</code> — sets how much memory the engine can use.
      </li>
      <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        <b>Threads:</b> <code>12</code> — defines how many CPU threads are used.
      </li>
      <li style="text-indent:-1.1em; padding-left:1.1em;">
        <span style="display:inline-block; width:0.9em; text-align:center; font-weight:bold;">◦</span>
        <b>Syzygy Path:</b> If you have tablebases installed, set this to the directory path of your Syzygy files.
      </li>
    </ul>
  </li>
</ol>




Line 143: Line 206:
</pre>
</pre>
Once configured, Chessboard Magic will communicate seamlessly with your local engine, giving you faster, more flexible, and fully offline Stockfish evaluations.
Once configured, Chessboard Magic will communicate seamlessly with your local engine, giving you faster, more flexible, and fully offline Stockfish evaluations.
{{DocNav
| prev = Space Visualisation
| prev_label = Space Visualisation
| next = Transpositions
| next_label = Transpositions
}}

Latest revision as of 10:07, 15 October 2025

Available in: Builder, Library, Practice, Tools

Stockfish Card

The Stockfish card shows evaluations for the current board position, giving you instant insight into the engine’s best moves. It is powered by Stockfish.js 17.1, the web-enabled version of Stockfish, allowing you to run advanced engine analysis directly in your browser without any external setup.

You can select both the desired analysis depth and the number of principal variations (PVs) returned by Stockfish, letting you control how detailed or broad the engine’s output is. As Stockfish runs, the depth and MNps (million nodes per second) update in real time, providing a live view of the engine’s search progress and speed. Analyzed positions are also cached locally in your browser, allowing you to revisit any previously analyzed position instantly without needing to rerun the engine.

Each row displays only the first few moves of a variation; clicking the ▼ (down arrow) on the right expands the full line for deeper inspection.

You can interact directly with the move list:

  • Reuse existing repertoire annotations within your library items
  • Maintain consistency between your repertoire and library
  • Speed up the process of analyzing and commenting on positions
  • Instantly copy repertoire annotations into your current game or analysis


This feature helps you:

  • + Analyze any position quickly with Stockfish’s strongest available evaluations
  • + View real-time depth and performance (MNps) as the engine searches
  • + Expand and explore entire engine lines interactively
  • + Add engine-recommended moves and analysis directly into your repertoire or library
  • + Instantly revisit cached positions without re-running the engine
  • + Control the depth and detail of analysis for efficient study

Setting Up Local Stockfish

To leverage the full power of your own computer, you can connect Chessboard Magic to a locally running chess engine. While the built-in Stockfish.js engine provides excellent performance, using your own hardware gives you an extra boost in speed, depth, and consistency — especially for large or detailed repertoire analyses.

Overview

To allow the Repertoire Builder (and other tools) to communicate with a local UCI engine, you will need to install a lightweight proxy application that bridges your browser and engine. The CBM Engine Proxy is a WebSocket bridge that connects Chessboard Magic directly to any UCI-compatible chess engine such as Stockfish, Berserk, or Komodo.

This allows Chessboard Magic to run a local chess engine on your computer and communicate with it through the browser in real time.

Requirements

  • Python 3.9+ installed on your system
  • A UCI-compatible engine binary, such as:
    • Stockfish
    • Berserk
    • Komodo

Setup Instructions

  1. Install Python 3.9+ and make sure the command python (or python3 on macOS/Linux) is available in your terminal.
  2. Download the files CBMEngineProxy.py and config.json from the GitHub repository.
  3. Save both files together in the same folder.
  4. Open a terminal in that folder and install the required dependency: pip install websockets
  5. Edit config.json to point to your engine binary and configuration.


Windows Example:

{
  "engine_path": "C:/Users/USERNAME/Downloads/stockfish/stockfish.exe",
  "host": "127.0.0.1",
  "port": 9480,
  "logging": true
}

macOS Example:

{
  "engine_path": "/Users/USERNAME/Downloads/stockfish/stockfish",
  "host": "127.0.0.1",
  "port": 9480,
  "logging": true
}
Note: engine_path: Full path to your UCI engine binary (.exe on Windows, no extension on macOS/Linux). host: Usually leave as 127.0.0.1. port: Must match the connection port used by Chessboard Magic. logging: Set to true for debugging output, or false for silent mode

Running the Proxy

Start the proxy by running:

python CBMEngineProxy.py

If successful, you will see:

✅ Engine Proxy running on ws://127.0.0.1:9480

Using with Chessboard Magic

  1. Launch Chessboard Magic in your browser.
  2. Open the Stockfish card.
  3. Click on the Stockfish label and select Local Stockfish.
  4. Configure the following parameters:
    • URL: http://127.0.0.1:9480 — normally this does not need to change.
    • Hash (MB): 4096 — sets how much memory the engine can use.
    • Threads: 12 — defines how many CPU threads are used.
    • Syzygy Path: If you have tablebases installed, set this to the directory path of your Syzygy files.


Once connected, Chessboard Magic will use your local engine for analysis, with results appearing directly in the Stockfish card.

Stopping the Proxy

Press Ctrl + C in the terminal window to stop the proxy server.

Building a Standalone Executable (Optional)

You can package the proxy into a standalone executable so it runs without requiring Python to be installed.

Windows

pip install pyinstaller
pyinstaller --onefile CBMEngineProxy.py

The executable will appear in the `dist/` folder as `CBMEngineProxy.exe`. Place `config.json` in the same folder and double-click to run it.

macOS

pip install pyinstaller
pyinstaller --onefile CBMEngineProxy.py

The standalone app will appear in the `dist/` folder as `CBMEngineProxy`. Place `config.json` alongside it and run:

./CBMEngineProxy

Once configured, Chessboard Magic will communicate seamlessly with your local engine, giving you faster, more flexible, and fully offline Stockfish evaluations.