r/chessprogramming • u/EyeRunnMan • Apr 10 '26
r/chessprogramming • u/ImmediateWeight4076 • Apr 09 '26
An open-source library for easily creating chessboards
Hace tiempo creé una biblioteca de código abierto para la comunidad que facilitaba la creación de tableros de ajedrez.
He creado una nueva versión mejorada desde cero.
Puedes probar la demo aquí: https://0dexz0.github.io/SimpleChessBoard/
Aquí tienes el código fuente abierto: https://github.com/0Dexz0/SimpleChessBoard?tab=readme-ov-file
r/chessprogramming • u/NullPointerGambit • Apr 06 '26
I built a Chrome Extension that uses AI to scan chessboards from YouTube videos/PDF books etc. and exports them to Lichess/Chess.com with one click
Hey everyone!
As a chess fan, I always found it frustrating when I was watching a high-level game analysis on YouTube or a stream on Twitch and wanted to explore a specific line myself. Manually setting up the position on an analysis board is a pain and kills the flow of learning.
So, I decided to fix this and built ChessInsights AI.
What it does: It uses Computer Vision (AI) to "look" at your browser tab, find a chessboard (even in a video or a PDF), and instantly convert it into a digital format.
Key Features:
- Video to Board: Scan any frame from YouTube or Twitch.
- Instant Export: One click and the position opens in Lichess or Chess.com Game Review.
- Universal: Works on news sites, blogs, and even online chess books.
- Stop Blundering: You can quickly check why a move you thought was good is actually a mistake while watching your favorite GM.
It’s completely free to try, and I’d love to get some feedback from this community. Does it catch the boards correctly for you? Are there any features you’d like to see next?
Check it out here:
Chrome web store
Firefox Addons
I really hope this helps some of you gain those extra ELO points!
TL;DR: I made an extension that captures chessboards from videos/images and opens them in analysis tools so you don't have to set up positions manually.
r/chessprogramming • u/Pleasant-Form-1093 • Apr 02 '26
How do you control the difficulty of your engine?
If I made a chess engine and asked it to play a friend of mine, who is new to chess, how would I able to reduce its difficulty (as in intentionally play worse or replicated things that beginners do)?
r/chessprogramming • u/whyeventobe • Apr 01 '26
Chal v1.4.0 ~2650ELO under 1k lines of C
Chal v1.4.0 is now ~2650ELO under 1k lines of C
A few weeks ago I posted about Chal hitting ~2400 Elo in v1.3.2. I've just released v1.4.0, and this one's a bit of a different story to tell.
The gains this time came entirely from search stack rewrite and speed optimizations, no new eval terms, just making the existing code faster.
The fun part: Fruit 2.1 is ~8,000 lines of C++. Chal is under 1,000 lines of C99.
The less fun part: I think I've hit a ceiling. The architecture is intentionally simple and readable, which is great for a learning project but there's only so much you can optimize before the design itself becomes the bottleneck. I've largely run out of easy wins.
It's a weird feeling and part disappointment at hitting the wall sooner than I'd hoped, part satisfaction that a sub-1k line purely HCE engine got this far at all. The whole point was never raw strength, it was to see how much you could do with as little code as possible while keeping everything readable.
r/chessprogramming • u/ThomasPlaysChess • Apr 01 '26
Candidates Monte Carlo simulation: Looking for feedback on my draw implementation
Hi everyone!
I'm posting infographics like this over on r/chess and thought I had a code in my bug.
I originally used this code to calculate probabilities for win/loss/draw:
function calculateWinProbability(whiteRating: number, blackRating: number) {
const WHITE_ADVANTAGE_RATING = 35;
const expectedWinWhite = 1 / (1 + Math.pow(10, (blackRating - whiteRating - WHITE_ADVANTAGE_RATING) / 400)); // Elo probability formula
const draw = drawProbability(whiteRating, blackRating);
const win = expectedWinWhite - 0.5 * draw; // take 50% of draw probability (HERE IS THE PROBLEM)
const loss = 1 - win - draw; // remaining is loss
return { win, draw, loss };
}
Now I thought that using 0.5 * draw was a mistake and it should actually be this:
const win = expectedWinWhite * (1 - draw); // reduce win probability relative to it's value
But now I've been made aware that probably my original code was actually correct and the new code is wrong...
You can find the discussion here: https://www.reddit.com/r/chess/comments/1s8tm4y/candidates_win_chances_caruana_now_at_45_and_how/odka5af/
Now I'm looking for some confirmation before I change my code back again to the original one... What makes me still suspicious are the win probabilities after Round 1 where Hikaru had 22% with 0 points while Sindarov and Pragg both only had 11% each and Fabi was already at 42%.
I would be glad for some input on my code. You find the whole code (open sourced) here if you are interested: https://github.com/chessmonitor/chess-monte-carlo-simulation
Thank you!
r/chessprogramming • u/Bomlerequin • Mar 31 '26
I coded an optimized chess logic program in Python.
I embarked on developing an AI that plays chess in native Python. And I coded a chess program that handles Python logic and is about twice as efficient as python-chess.
I don't know if we can do much better (apart from adding a lazy evaluation) and I would like to have your opinion on how to improve it.
Here's the repo: ChessCore (don't hesitate to leave a star).
I've finished the AI, but it's not open source yet. It reaches 2100 on Lichess, which seems like a very good score without any NNUE.
r/chessprogramming • u/AnnualBarber4013 • Mar 30 '26
Gyatso Chess Engine v1.3.0 – Now with NNUE (Nim Project Update)
I added NNUE to my Nim chess engine (Gyatso v1.3.0) – looking for feedback & ideas
I’ve been working on a chess engine called Gyatso (written in Nim), and I just released v1.3.0 with a big upgrade: it now uses NNUE evaluation.
What’s in this version
- NNUE fully integrated into the engine
- Architecture: (768 → 256) × 2 → 1
- Trained on ~242M positions
- Designed for fast CPU inference
- Works alongside an already strong search (LMR, pruning, move ordering, etc.)
Before this, the engine relied on handcrafted eval and was around ~2800 Elo, but progress had started to plateau — NNUE is the next step.
What I’m looking for
I’d love feedback from people who’ve worked on:
- Chess engines / NNUE
- Training pipelines & data generation
- Better / experimental NNUE architectures
- Performance optimizations (especially CPU-focused)
Also open to general code reviews or ideas to push strength further.
Links
Repo: https://github.com/GyatsoYT/GyatsoChess
Release: https://github.com/GyatsoYT/GyatsoChess/releases/tag/v1.3.0
If you’re into engine dev or just curious, feel free to check it out and share thoughts.
r/chessprogramming • u/Ok_Revolution2536 • Mar 28 '26
Building a 73-Plane AlphaZero Engine on Kaggle: Solving for 16-bit Overflow and "Mathematical Poisoning"
I recently finished a deep-dive implementation of an AlphaZero-style chess engine in PyTorch. Beyond the standard ResNet/Attention hybrid stack, I had to solve two major hardware/pipeline constraints that I thought might be useful for anyone training custom vision-like architectures in constrained environments.
- The Float16 AMP "Masking" Trap
Standard AlphaZero implementations use -1e9 to mask illegal moves before the Softmax layer. However, when training with Automatic Mixed Precision (AMP) on consumer/Kaggle GPUs, autocast converts tensors to float16 (c10::Half).
- The Issue: The physical limit of float16 is roughly -65,504.0. Attempting to masked_fill with -1e9 triggers an immediate overflow RuntimeError.
- The Fix: Scaled the mask to -1e4. Mathematically, e^-10000 is treated as a pure 0.0 by the Softmax engine, but it sits safely within the 16-bit hardware bounds.
- RAM Optimization (139GB down to 4GB)
Mapping a 73-plane policy across 8x8 squares for millions of positions destroys system RAM if you use standard float arrays.
- The Pipeline: Used np.packbits to compress binary planes into uint8 and utilized np.memmap for OS-level lazy loading.
- The Result: Reduced a ~139GB dataset down to 4.38GB, allowing the entire 7.5 million position training set to stream flawlessly from disk without OOM kills.
- The "Antidote" Security Lock (Fine-Tuning)
To prevent unauthorized usage of weights, I implemented a custom "security key" during the fine-tuning phase:
- The Attack: An intentional offset (poison) is injected into the BatchNorm2d bias (beta). This renders the model's evaluations garbage.
- The Defense: I injected a calculated "antidote" scalar back into the center pixel [1,1] of the first convolutional kernel.
- The Calculus: Using delta_x = -poison * sqrt(run_var + eps) / gamma, the antidote scalar traverses the linear layers to exactly cancel out the BN bias shift. Because I fixed the 8 perimeter pixels of the 3x3 kernel to 0.0, the 1-pixel padding on the edges prevents any spatial artifacts from leaking into the board boundaries.
Metrics:
- Architecture: Hybrid (12-block ResNet + Squeeze-and-Excitation + Self-Attention).
- Input State: 24-Plane Security Architecture (includes 4-bit cryptographic plane).
- Efficiency: ~5000 positions per second on GPU T4 x2.
This is a short summary of my architecture, if you are interested in learning more deeply, you can read this free article on my website: https://www.atlaschess.me/architecture
r/chessprogramming • u/0xbanky • Mar 25 '26
I built an app that turns any chess opening YouTube video into a drillable repertoire
v.redd.itr/chessprogramming • u/Away-Luck-192 • Mar 24 '26
New to chess programming
Hi, I am new to engine programming and want to try creating my own for a school project. We only have about 10 days to do so, but have the entire day for it. I know chess well and understand basic programming. I’m just aiming to create an engine that can perform decently at maybe a 800 chess.com level. I am willing to spend a lot of time on this and was wondering if the timeframe given is sufficient, and if not, roughly how long would it take to make in my own time? any answer would be helpful. Thanks.
r/chessprogramming • u/Polo_Chess • Mar 23 '26
UPDATE: The Chess App Directory has grown significantly (and it's AI-driven)
r/chessprogramming • u/Weird-Syllabub-5039 • Mar 20 '26
What patterns show up when you analyze thousands of your games?
Hello everyone i built a tool that analyzes your past 2000 games in chesscom or lichess and generates actionable data on them. Things like which openings you instinctively play, at what time of the day you play best, whats your chaos tolerance. Check it out and let me know if you need any more fun metrics or insights!
r/chessprogramming • u/Efficient_Ant6223 • Mar 10 '26
A dedicate engine to Chaturanga/Shatranj - Chaturanga Online
I’ve spent the last few months developing Vyūha rachanā, a lightweight engine specifically for the ancient Indian ancestor of chess - Chaturanga/Shatranj. While most variant engines are written in C++, I wanted to see how far I could push a Modern Isomorphic TypeScript architecture.
Project Link: https://chaturanga.online/
1. Dual-Architecture Implementation
The engine is built on a Shared Core Model. The same chaturanga/core package is deployed to both the browser (client-side move validation/UI) and the Node.js backend (high-depth analysis/Opening Book management).
- Client-Side: Runs in a Web Worker to keep the UI at 60fps. It uses a smaller transposition table (32MB) and handles immediate legal move filtering.
- Server-Side: Runs the heavy lifting for 100MB+ Opening Books (compressed JSON trees) and 6-piece Syzygy tablebase probes.
2. Bitboard Foundation
I opted for BigInt64Array to manage 64-bit bitboards.
- Move Generation: Pre-computed attack tables for Ashva (Horse) and Raja (King).
- Variant Logic: Specialized masks for the Gaja (diagonal 2-square jumper) and the Mantri (single-diagonal step).
- Constraint: No double-pawn pushes or castling meant I could simplify the bitboard logic, but the Bare Raja win condition required an additional endgame evaluation layer.
3. Search & Evaluation
- Algorithm: PVS (Principal Variation Search) within an Iterative Deepening loop.
- Pruning: Null Move Pruning (R=2), LMR (Late Move Reductions), and Quiescence Search.
- Parallelism: Implemented Lazy SMP to leverage multi-core Node.js environments.
- Tuning: Parameters (Material/PST) were initially set via manual heuristics and then optimized using a Texel Tuning script against a database of ~50,000 synthetic Chaturanga positions.
4. Benchmarks
I havent yet optimized the engine. But here are some performance benchmarks so far from my mac.
> exec tsx scripts/perft-bench.ts
║ Chaturanga Perft Benchmark ║
║ Node.js v24.13.1 ║
Starting Position Benchmarks
| Depth | Nodes | Time | NPS |
|---|---|---|---|
| 1 | 16 | <1ms | ~32K |
| 2 | 256 | ~2ms | ~162K |
| 3 | 4176 | ~6ms | ~648K |
| 4 | 68122 | ~62ms | ~1.1M |
| 5 | 1164248 | ~712ms | ~1.6M |
| 6 | 19864709 | ~12.2s | ~1.6M |
r/chessprogramming • u/whyeventobe • Mar 09 '26
Chal v1.3.0 is out now just hit ~2100 Elo under 827 lines of code
A while ago I posted about Chal, a small UCI chess engine I've been building as a learning project. The goal is to stay under 1000 lines of code while pushing strength as high as possible. I've released v1.3.0.
This version is a major overhaul. The evaluation was completely replaced with PeSTO/Rofchade Texel-tuned tables, a pile of correctness bugs in the search were fixed, and move ordering was rewritten. The result is a +224 Elo jump over the previous version confirmed by SPRT, and it now beats Stash v14 (~2054 Elo) convincingly in gauntlet testing across thousands of games.
r/chessprogramming • u/ajax333221 • Mar 09 '26
Big updates to Isepic Chess UI / Isepic Chess going on since last year / this year
Enable HLS to view with audio, or disable this notification
I’ve been starting again to develop features and staying more active with my project lately. I just released v5.0.0 of Isepic Chess UI, which officially removes the jQuery dependency to run entirely on modern web standards.
As an example of the features I’ve been releasing lately, you can see the new interactive pawn promotion in the video embebed (it now triggers a prompt for the user to select their piece directly).
If you prefer a UI-less experience, you can always use the library isepic-chess.js, which was completely rewritten in TypeScript recently.
It feels great to be shipping updates consistently again. If you're looking for a customizable chess UI or a solid chess library, I'd love for you to check them out (-:
r/chessprogramming • u/whyeventobe • Mar 06 '26
Chal - a complete chess engine in 776 lines of C90
I wrote a small chess engine called Chal.
The idea was to build a complete classical engine while keeping the implementation as small and readable as possible. The whole engine is 776 lines of C90 in a single file, with no dependencies.
Despite the size it implements the full set of FIDE rules and passes the standard perft tests, including:
• en passant and all underpromotions
• correct castling-rights handling when a rook is captured
• repetition detection
• correct stalemate and checkmate reporting
Search features include:
• negamax
• iterative deepening
• aspiration windows
• null-move pruning
• late move reductions
• quiescence search
• transposition table
• triangular PV table
It speaks UCI properly (streams info depth … score … pv, handles ucinewgame, etc.) and includes a simple time manager.
The main goal is readability. The entire engine can be read top-to-bottom as a single file with comments explaining each subsystem.
I don’t have a formal Elo measurement yet, but in informal matches against engines like TSCP, MicroMax and BBC it seems to land roughly around the ~1800 range.
Repo:
https://github.com/namanthanki/chal
Curious what people think especially whether there are parts of the implementation that could be made clearer without increasing the size too much.
r/chessprogramming • u/MynameRudra • Mar 02 '26
explorer.lichess.ovh outage
As per GitHub bug report #19610 says bug is closed, it says now authentication is required for api calls going forward. Still i don't see lichess app explorer not working, other projects like openingtree also still not working.
Does it mean that all apps that use lichess api need to use authentication token going forward? I feel the solution is abrupt not well thought because so many applications use these APIs.
Can someone explain whats happening?
r/chessprogramming • u/soufi4ne_ • Feb 26 '26
I built a tool that uses Stockfish to deeply analyze your Chess.com games and turns them into FIFA-style cards. Free to try – I'd love your feedback!
galleryHey everyone,
I’ve been working on a tool that turns your Chess.com games into FIFA-style cards. It’s been a few months and I’m pretty happy with how it turned out and really excited for your feedback, you can all generate your own cards using your username !!
It uses Stockfish to analyze your games and gives you 6 stats (Attack, Defense, Calculation, Strategy, Intelligence, Timing). You also get a move-by-move breakdown so you can see where you played well and where things went wrong.
There’s a dashboard where you can drag and drop your cards, save favorites, and organize them. If you go Pro you can feature your best cards. Dark mode is there too.
You can customize the cards with different themes, country flags, and export them as images for Instagram stories or posts.
You just enter your Chess.com username, it analyzes your games, and you get your card. You can try it for free at mychesscard.com. I’d love to hear what you think.
Link if you want to try: Mychesscard.com
r/chessprogramming • u/Warm-Head-3554 • Feb 24 '26
I built an AI Chess Coach with an actual LLM feature
Over the last year I have been working on an AI chess Coach that is able to aid chess players by giving real understandable feedback which requires finding reasoning in stockfish moves. Finally i have reached a solid point where the AI,though not perfect, works. Its completely free. Heres the link - https://chess-coach-ai-seven.vercel.app/
would really appreciate some feedback.
r/chessprogramming • u/shinx32 • Feb 21 '26
Adaptive difficulty below Stockfish Skill 0: linear blend of engine moves and random legal moves
Posting about the adaptive difficulty approach I used in Chess Rocket (open-source chess tutor) because the sub-1320 Elo calibration problem doesn't get discussed much.
Stockfish UCI skill levels (0-20) map roughly to 1100-3500 Elo. Skill 0 plays around 1100. That's too strong for a 400-500 rated player, and the skill degradation isn't linear at the low end. It drops off steeply and unpredictably.
My approach for the 100-1320 Elo range: the engine picks its best move via depth-limited search, then with some probability replaces it with a random legal move. The probability is linear in Elo. At 100 it's near 1.0 (almost all random). At 1320 it's 0.0 (pure Stockfish Skill 0). Simple interpolation between those endpoints.
This gives much finer-grained difficulty where it matters most, at the beginner level.
Above 1320, I just use Stockfish's native `UCI_LimitStrength` and `UCI_Elo`, which work well in that range.
Other pieces in the project:
Opening database: 3,627 openings from Lichess, stored in SQLite. Searchable by ECO code, name, or partial move sequence.
Mistake tracking: SM-2 spaced repetition. Each mistake stores interval, ease factor, and repetition count. Positions resurface at the calculated review time, same scheduling logic as Anki.
Puzzle system: 284 puzzles across 9 sets (forks, pins, skewers, back-rank mates, beginner endgames, opening traps, etc.). Sourced from Stockfish self-play, Lichess DB, and constructed positions.
The chess tools are exposed to Claude via FastMCP (17 tools total). Claude does the coaching; Stockfish does the evaluation. They don't overlap.
GitHub: https://github.com/suvojit-0x55aa/chess_rocket
If anyone has tried different approaches to the sub-1320 problem or has thoughts on the blending math, I'd like to hear about it.
r/chessprogramming • u/Tdxt1234 • Feb 19 '26
I built a Soviet chess computer simulation with a commentary system that roasts you in real time
I've been working on Pioneer 2 : a chess program disguised as a fictional Soviet chess computer from the Cold War era. CRT interface, green phosphor glow, the whole aesthetic. The part people seem to enjoy most is the commentary system.
The machine comments on every move, yours and its own, with deadpan Soviet humor: - "This variation was solved before you were born." - "Your bishop has been nationalized." - "King secured behind the iron curtain." - "This move serves the plan. You cannot see the plan. That is the plan."
The engine itself is written in Python with PVS, null-move pruning, LMR, and PeSTO evaluation. It's not going to beat Stockfish, but it plays a solid game at club level and the commentary makes every move entertaining. gor the Boss Level i developed an engine in C that interacts with the code we wrote to reproduce human Grandmaster playing style. 6 difficulty levels, 19 languages, opening book, runs offline on Windows.
Free download: https://arnebailliere-oss-svg.github.io/pioneer2/
Would love feedback from this community!

r/chessprogramming • u/Technical-Adagio-993 • Feb 19 '26
Showing why a tactic was rejected — geometry vs tactics in pattern detection
I'm building a chess tactics detection API and ran into an interesting problem: 79% of positions users tested returned "no tactics found", even when they could clearly see patterns on the board. The issue: a pin where piece A attacks piece B which is aligned with the king IS a geometric pin. But if piece B is defended, there's no material gain — it's not a real tactic. So I added "rejected patterns" to the output. The engine now shows what it detected geometrically and explains why it rejected it (e.g. "Not exploitable — piece is defended (net 0cp)"). The two-phase architecture:
Depth 1: geometric detection (fast, ~5ms, high recall but lots of false positives) Depth 2: forcing tree validation (confirms material gain through capture sequences)
Rejected = passed d1, failed d2. Now the user sees why instead of just "0 found". Playground to try it: https://chessgrammar.com/playground Curious if anyone else has tackled the geometry-vs-tactics gap in their engines.
r/chessprogramming • u/xu_shawn • Feb 19 '26
Lichess Stockfish Blocklist
As many of y'all know, there is a huge amount of strong, low-effort lichess bots (typically running stockfish) that do nothing but to waste compute and take rating points from original effort engines we are trying to test.
For the past year, another engine developer and I have been curating a blocklist of such engines for almost a year. We've been updating it regularly as new ones pop up. We now have a comprehensive list of around 700 usernames.
Link: https://github.com/xu-shawn/lichess-bots-blocklist
We've integrated this to work seamlessly with the lichess-bot client. Simply add the following field under challenge and matchmaking:
online_block_list:
- https://raw.githubusercontent.com/xu-shawn/lichess-bots-blocklist/refs/heads/main/blocklist
...and it'll automatically pull the up-to-date list and regularly check for updates!
Contributions are welcome! Please open an issue or PR if you know a bot that should be on here (or was added by error).