Skip to content

LukeRenton/Loopyfish

Repository files navigation

Loopyfish

🐟 LoopyFish: An Adaptive ReconChess Agent

LoopyFish is a strategic, uncertainty-aware bot developed for the ReconChess AI framework. Unlike traditional chess engines that operate with full board visibility, LoopyFish was designed to thrive in environments of partial observability where hidden information and uncertainty dominate.

At its core, LoopyFish maintains a dynamic belief set—a collection of possible board states consistent with all sensed information to date. By combining tactical strength (powered by Stockfish) with probabilistic reasoning and custom decision heuristics, LoopyFish makes informed decisions both in sensing and move selection phases.

Key design goals of LoopyFish include:

  • Robust Uncertainty Management: Making safe but effective moves even when the true board state is ambiguous.
  • High-Information Sensing: Choosing sense actions that maximize the reduction of uncertainty.
  • Smarter King Capture Logic: Avoiding wasted turns chasing phantom kings by using belief-set voting and thresholding.
  • Scalability: Sampling techniques to manage large belief state explosion while retaining board diversity.

LoopyFish was evaluated against multiple baseline agents in a double round-robin tournament, showing strong performance and a high win rate across both colors.

Setting Up ReconChess and TroutBot

1. Installing ReconChess

To install the reconchess package, run:

pip install reconchess

If installation is successful, test it by running:

python -m reconchess.scripts.bot_match reconchess.bots.random_bot reconchess.bots.random_bot

If this works, but rc-bot-match doesn't, add the Scripts folder to your PATH.

Scripts folder looks something like this: C:\Users\luker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\Scripts

2. Adding Scripts Commands to PATH (Windows Fix)

  1. Find the installation path by running:
    python -c "import sysconfig; print(sysconfig.get_path('scripts'))"
  2. Add this path to the Environment Variables:
    • Press Win + R, type sysdm.cpl, and hit Enter.
    • Go to the Advanced tab → Click Environment Variables.
    • Under User variables, edit Path and add the folder.
    • Restart the terminal and try running rc-bot-match again.

3. Installing Stockfish for TroutBot

  1. Download Stockfish from https://stockfishchess.org/download/.
  2. Extract it to a known location, e.g., C:\stockfish.
  3. Locate the executable inside the extracted folder, e.g., C:\stockfish\stockfish-windows-x86-64-avx2.exe.

4. Setting the STOCKFISH_EXECUTABLE Environment Variable

Option 1: Temporary (PowerShell Only)

$env:STOCKFISH_EXECUTABLE = "C:\stockfish\stockfish-windows-x86-64-avx2.exe"

This works only in the current terminal session.

Option 2: Permanent (GUI Method)

  1. Press Win + R, type sysdm.cpl, and hit Enter.
  2. Go to the Advanced tab → Click Environment Variables.
  3. Under User variables, click New:
    • Variable Name: STOCKFISH_EXECUTABLE
    • Variable Value: C:\stockfish\stockfish-windows-x86-64-avx2.exe
  4. Click OK, close all windows, and restart your PC.

Option 3: Permanent (PowerShell Command)

[System.Environment]::SetEnvironmentVariable("STOCKFISH_EXECUTABLE", "C:\stockfish\stockfish-windows-x86-64-avx2.exe", [System.EnvironmentVariableTarget]::User)

Restart your terminal for changes to take effect.


5. Verifying Setup

Run these commands:

echo $env:STOCKFISH_EXECUTABLE
python -c "import os; print(os.getenv('STOCKFISH_EXECUTABLE'))"

Both should return:

C:\stockfish\stockfish-windows-x86-64-avx2.exe

If they return None, restart your system and try again.


6. Running TroutBot

Test TroutBot by running:

rc-bot-match reconchess.bots.trout_bot reconchess.bots.random_bot

If you get KeyError: 'TroutBot requires an environment variable...', ensure the STOCKFISH_EXECUTABLE variable is properly set.


7. Troubleshooting

Issue: `` not found

  • Run python -m reconchess.scripts.bot_match reconchess.bots.random_bot reconchess.bots.random_bot.
  • If it works, add the Scripts folder to your PATH (see Section 2).

Issue: `` not recognized

  • Make sure STOCKFISH_EXECUTABLE is set permanently (see Section 4).
  • Restart the terminal or PC.
  • Check if Python recognizes it: python -c "import os; print(os.getenv('STOCKFISH_EXECUTABLE'))".

Now, you should be able to run TroutBot with Stockfish successfully! 🚀

About

Recon chess solver - loopyfish

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published