lichess.org
Donate

April UPDATE: My Bot @WildOrderBOT Made 100% with replit AI

Chess engineChess botSoftware DevelopmentChess
Deployed to GitHub to run everyday from 8am-8pm

Update: Bot does run SF 17.1. SF 18 does not work file is too big..
When my bot is online you can send a challenge to it as long as it's not currently in a game. I will have it play as many Arenas and Team battles as Possible.

_________________________________________________________________________________________________________________________________________________
Hey all After a lot of work in Replit, I finally got my Bot where I want it 'So far'.
The Bot Runs SF 18 and was originally programmed to run at around 3000+elo Has a depth of 15-30+ Depending on the Time Control
It will play Super accurately at 1+0 and higher.
It will Auto Challenge other bot's and I can add bot's to be challenged as well.
There is a Quick Challenge Option 3+0 Rated and casual 3+2 5+0 5+3 and 1+0
I can Send chat messages live in game only.
I can Challenge a user without having to log into the lichess bot account directly. Note: For arena's and Team Battles, I would still Have to log into the bot account to not accept challenges from other users and Bot's.
_________________________________________________________________________________________________________________________________________________
Now something cool Regarding Challenging other bot's, Is that when it auto challenges a bot for 3+0 rated and that doesn't work, it will send a 3+0 casual challenge, and if that doesn't work, it will challenge another bot, and keep doing the cycle for 5 times to prevent an infinite loop of this.
This program that run's the bot will help me a lot when using it :)
I ALSO HAD THE REPLIT AGENT MAKE A FRONTEND LOCAL SITE!!! Update: Only in use when using replit... I can Control/View the Bot Controls, This helps a ton without having to Manually login into the Bot account to do mess with setting's and stuff.
PS: The game link is clickable on my side so I get a Direct link to the game it's playing :D
Screenshot 2025-10-07 at 4.47.37 PM.png
Screenshot 2025-10-25 at 6.52.32 PM.png
Screenshot 2025-10-25 at 6.52.39 PM.png
Screenshot 2025-10-07 at 4.47.45 PM.png
A BIG THANKS TO LICHESS!!!! For allowing Bot account's to be used here. :D
And a BIG thanks to Replit the best Coding Platform in the World!!!
Now the code that Runs the program and the bot
Screenshot 2025-10-07 at 5.15.00 PM.png
The bot communicates between all these layers - Python controls the Stockfish C++ coded engine via UCI protocol, serves the HTML/CSS/JS frontend via Flask, and the JavaScript frontend talks back to Python through REST API calls. Pretty neat integration of multiple languages!
UPDATED Mar 21st

Lichess Chess Bot with Stockfish & Fairy Stockfish

Overview

A competitive chess bot that connects to Lichess via API and plays at 3000+ ELO level using either Stockfish (standard chess) or Fairy Stockfish (chess variants). The bot features adaptive time management based on game time controls and can play only one game at a time.

Current State

  • Bot Account: WildorderBot (connected)
  • Engines:
    • Stockfish (System Stable, 8 threads) - Standard chess & Chess960
    • Fairy Stockfish 14 (Largeboard with BMI2 + NNUE) - All chess variants
  • Status: Running and accepting challenges
  • Game Mode: One game at a time

Mar 17, 2026 - Variant Strength Overhaul

  • Hardware: Defaults bumped to 6 threads (all vCPUs), 4096 MB hash (4 GB) for deeper variant search
  • NNUE per game: Standard/Chess960 → NNUE enabled; all other variants → classical evaluation (standard NNUE hurts atomic/crazyhouse eval)
  • Variant time management: Complexity multipliers applied in adaptive mode: Crazyhouse ×1.6, Atomic ×1.5, Antichess ×1.5, Three-check/Horde ×1.3, KOTH/Racing Kings ×1.2; capped at 50% of remaining time
  • Variant opening books: Replaced stub books with theory-based openings for all 8 variants; FEN prefix matching for robust position lookup

Jan 31, 2026 - Maintenance Update

  • Engine Stability: Integrated the system-native Stockfish (v17) to ensure perfect compatibility and performance within the environment. This fixes the "Exec format error" caused by incompatible external binaries.

Features

  1. Engine Selection: Choose between Stockfish and Fairy Stockfish
    • Stockfish: Optimized for standard chess and Chess960
    • Fairy Stockfish: Supports 8 chess variants (Crazyhouse, Chess960, King of the Hill, Three-check, Antichess, Atomic, Horde, Racing Kings)
    • Dynamic variant support based on selected engine
    • Seamless engine switching via web interface
    • Cannot change engine during active games
  2. Web Control Panel: Full-featured web interface to control and monitor the bot
    • Real-time status monitoring (bot state, current game, engine status)
    • Start/stop bot controls with proper shutdown mechanism
    • Challenge specific users or random bots
    • Quick challenge buttons for preset time controls
    • Live activity logs with color-coded messages
    • In-game chat functionality
    • User blocklist management
  3. Challenge Controls: Fine-grained control over challenging behavior
    • Toggle bot challenges on/off independently
    • Toggle user challenges on/off independently
    • Arena/Team Battle Mode: Disables all challenges (sending & accepting)
    • Perfect for participating in arena or team battle events
  4. Manual Speed Control: Override adaptive time management
    • Adjustable move time (1ms to 5s)
    • Adjustable search depth (1 to 30 ply)
    • Adjustable move overhead (1ms to 500ms)
    • Toggle between manual and adaptive modes
  5. Blocklist System: Prevent bot from challenging specific users
    • Add/remove users via web interface
    • Persistent storage in blocklist.json
    • Case-insensitive username matching
    • Works for both manual and automatic challenges
  6. Stockfish 17.1 Integration: Latest chess engine via UCI protocol
  7. Adaptive Time Management (Optimized for Ultra-Fast Bullet):
    • Bullet 1+0 (60s): 0.04s max, depth 18 (ULTRA FAST)
    • Bullet with increment: 0.06s max, depth 18 (ULTRA FAST)
    • Bullet+ (≤3 min): 0.3s max, depth 20
    • Blitz (3-8 min): 2s max, depth 22
    • Rapid (8-15 min): 5s max, depth 25
    • Classical (>15 min): 15s max, depth 30
  8. Auto-Challenge System: Automatically challenges random online bots with fallback logic
    • First tries 3+0 rated, then 3+0 casual
    • If both fail, tries a new bot (up to 5 retries)
  9. Single Game Restriction: Only plays one game at a time
  10. Turn Validation: Robust board reconstruction to prevent double-moves
  11. Chat Feature: Sends custom messages during games

Project Architecture

Main Components

  • app.py: Flask web application for bot control and monitoring
  • templates/index.html: Web interface frontend with real-time updates
  • lichess_bot.py: Main bot script with Lichess API integration
  • stockfish/: Stockfish 17.1 binary directory
  • .gitignore: Python and Stockfish binaries excluded from git

Key Classes and Methods

  • LichessBot: Main bot class
    • challenge_user(): Challenge another player
    • challenge_random_bot(): Challenge random bot with fallback logic
    • handle_game(): Main game loop with turn-checking
    • make_move(): Calculate and execute best move
    • get_time_limit(): Adaptive time/depth calculation
    • send_chat_message(): Send chat messages in game
    • run(): Main event loop for challenges and games
    • stop(): Cooperative shutdown with session interruption

Dependencies

  • flask: Web framework for control panel
  • flask-cors: CORS support for API
  • berserk: Official Lichess API Python client
  • python-chess: Chess library with UCI engine support
  • stockfish: 17.1 binary (x86_64 AVX2)

Jan 31, 2026 - Stockfish 17.1 Stable Integration

  • Stockfish 17.1: Upgraded to the official stable Stockfish 17.1 release.
    • Plays at a 4000+ Elo level.
    • Integrated using the official Ubuntu AVX2 binary.

Oct 11, 2025 - Fairy Stockfish Integration & Chess Variants Support

  • Fairy Stockfish Engine: Added Fairy Stockfish 14 for playing chess variants
    • Largeboard binary with BMI2 optimization for modern CPUs
    • Supports 8 chess variants: Crazyhouse, Chess960, King of the Hill, Three-check, Antichess, Atomic, Horde, Racing Kings
    • Configured for 3000+ elo level performance (8 threads, 2048 MB hash)
  • Engine Selection Settings: Toggle between Stockfish and Fairy Stockfish via web interface
    • Stockfish: Standard chess and Chess960 only
    • Fairy Stockfish: All variants including standard chess
    • Dynamic variant support based on selected engine
    • Cannot change engines during active games
    • Automatically accepts/declines challenges based on engine capabilities
  • Variant-Specific Board Handling: Proper board initialization for all supported variants
    • Each variant uses its appropriate python-chess board type
    • Correct UCI variant configuration for Fairy Stockfish
    • Seamless move generation across all game types

Oct 9, 2025 - Challenge Controls & Speed Settings

  • Challenge Controls: Fine-grained control over challenging behavior
    • Can Challenge Bots: Toggle to enable/disable challenging bots
    • Can Challenge Users: Toggle to enable/disable challenging human players
    • Arena/Team Battle Mode: Disables all challenge sending and accepting
    • Perfect for participating in Lichess arena or team battle events without interruptions
    • All settings accessible via web interface with real-time updates
    • Backend enforcement in challenge_user(), accept_challenge(), and challenge_random_bot()
  • Manual Speed Control: Override adaptive time management
    • Adjustable move time slider (1ms to 5s)
    • Adjustable search depth slider (1 to 30 ply)
    • Adjustable move overhead slider (1ms to 500ms)
    • Toggle between manual and adaptive modes
    • Engine overhead automatically syncs when changing modes
    • Settings persist in real-time while bot is running

Oct 9, 2025 - User Blocklist Feature

  • Blocklist System: Prevent bot from challenging specific users
    • Add/remove usernames (human or bot) via web interface
    • Persistent storage in blocklist.json file
    • Case-insensitive username matching for reliability
    • Blocks work for both manual challenges and automatic random bot challenges
    • Real-time UI updates with blocked user list and count
    • Individual remove buttons for each blocked user
    • Clean error handling and user feedback messages

Oct 7, 2025 - Web Control Panel & Enhanced Challenge Logic

  • Web Control Panel: Full-featured Flask web interface
    • Real-time bot status monitoring and control
    • Start/stop bot with proper cooperative shutdown mechanism
    • Challenge specific users or random bots from UI
    • Quick challenge buttons for common time controls (1+0, 3+0, 3+2, 5+0, 5+3)
    • Live activity logs with color-coded messages (info, success, warning, error)
    • In-game chat messaging
    • Responsive design with gradient theme
  • Enhanced Challenge Logic: Improved fallback mechanism
    • First tries 3+0 rated challenge
    • Falls back to 3+0 casual if rated fails
    • Tries new bot if both fail (up to 5 retries)
  • Cooperative Shutdown: Bot can now be reliably stopped
    • stop() method interrupts blocking event stream
    • Session closure ensures thread termination
    • Proper cleanup of engine and resources

Oct 7, 2025 - Ultra-Fast Bullet & Auto-Challenge

  • Optimized for ultra-fast bullet play:
    • 1+0 bullet: 0.04s max, depth 18 (ULTRA FAST)
    • Bullet with increment: 0.06s max, depth 18 (ULTRA FAST)
  • Auto-challenge feature: Automatically challenges random online bots
  • Ultra-low latency: Move overhead reduced to 2ms
  • Opening optimization: 35% faster moves in first 12 moves for bullet
  • Improved error handling: Gracefully handles bot-incompatible challenges
  • Enhanced logging: Shows time control for all incoming challenges
  • Note: Bots cannot play ultrabullet (15s games) on Lichess

Oct 4, 2025

  • Added ultra-bullet optimization (15 second games) with 0.08s move time
  • Reduced move overhead from 50ms to 10ms for faster play
  • Added chat feature: bot says "I am WildOrderBot root for me :)" once per game
  • Fixed time management to cache clock settings from gameFull event
  • Added robust turn-checking via board reconstruction
  • Implemented single-game-at-a-time restriction
  • Added challenge_user() method for initiating games
  • Fixed time management to use bot's own clock (not opponent's)

Environment Variables

  • LICHESS_TOKEN: Bot account API token (required, set in Secrets)

Usage

The bot is controlled via the web interface at http://0.0.0.0:5000:

  1. Start the Bot: Click "Start Bot" to initialize and run the bot
    • Enable "Auto-Challenge Random Bots" to automatically play games
    • Or specify users to challenge in the text field
  2. Challenge Users: Enter a username and time control, then click "Send Challenge"
  3. Quick Challenge: Use preset time control buttons to challenge random bots
  4. Challenge Controls: Fine-tune who the bot can challenge
    • Toggle "Can Challenge Bots" to allow/prevent bot challenges
    • Toggle "Can Challenge Users" to allow/prevent human challenges
    • Enable "Arena/Team Battle Mode" to disable all challenges when playing in events
  5. Speed Settings: Control bot move speed
    • Enable "Manual Speed Control" to override adaptive time management
    • Adjust move time, search depth, and overhead with sliders
    • Disable to use adaptive time based on game clock
  6. Send Chat: Type messages to send in active games
  7. Manage Blocklist: Add or remove users the bot should never challenge
    • Enter a username and click "Add to Blocklist"
    • Click "Remove" next to any blocked user to unblock them
    • Blocked users are saved in blocklist.json and persist across bot restarts
  8. Stop the Bot: Click "Stop Bot" to safely shutdown
  9. Monitor: View real-time logs and status updates

To modify bot behavior, edit lichess_bot.py:

  • Adjust time/depth thresholds in get_time_limit()
  • Modify challenge acceptance logic in run()
  • Change chat messages in handle_game()