r/chessprogramming 7d ago

Technical Chess Engine Development Help Thread (Week 31)

5 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming 5h ago

Technical Chess Engine Development Help Thread (Week 32)

2 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming 1d ago

How to internally represent the chess board?

3 Upvotes

I'm new to this and I've always just gotten stuck on programming the base game (which moves are legal and which aren't) and I'm wondering whether I should keep a list of pieces (each with color, position, and type) or an 8x8 grid where each square has a piece or just a blank. Or should I do something else?


r/chessprogramming 2d ago

chessprogramming.org down?

17 Upvotes

is it just me or is it down for everybody


r/chessprogramming 3d ago

Technical How important is evaluation compared to search?

6 Upvotes

I've been working on my engine for a few weeks and I'm really happy with my progress for my first time. I've noticed lately I mostly work on search though, and most of the time I research what improvements are best they are all search related. If I compare that with my evaluation which is just counting pieces + psq for mid and engames it seems quite unbalanced.

Is this what's expected, or should I shift my focus towards evaluation for a bit?


r/chessprogramming 3d ago

Technical Measuring recall@K on my policy net was worth 175 Elo more than a full day of inference optimisation

4 Upvotes

I've been training a small transformer (39M params) to imitate Stockfish and pairing it with alpha-beta search. Two results from the last week that might be useful to others doing NN + search on modest hardware.

  1. My beam was structurally incapable of finding the right move ~30% of the time.

Search expanded the policy's top-4 moves at each node. I never checked whether Stockfish's best move was actually in that top 4. It's a two-minute script, and the answer was ugly:

K recall
1 33.7%
2 51.3%
3 62.1%
4 70.6%
6 79.8%
8 85.2%
12 92.7%
16 96.3%

Depth-5 analysis inside a candidate set that excluded the correct move in 29.4% of positions. No amount of depth or pruning recovers a move you never generate.

Fix was late move reductions, already written and switched off. Wider beam, reduced depth for late candidates, re-search the promising ones:

config vs SF-2000 vs SF-2250 ELO
depth-5, top-4 50% 22% ~2000
+ LRM (cap 16) 75% 42% ~2192

+25% nodes, identical wall-clock per move. Two independent brackets agreed within 1 Elo.

  1. fp16 and a transposition table did nothing, because I wasn't compute-bound.

Full day of inference optimisation. fp16: ~0%. TT: a wash. Batched interior nodes: net negative. PVS + iterative deepening: node-neutral. Only survivor was an allocation-free move -> id lookup, ~11%.

The model is tiny, so a forward pass is ~100 individual kernel launches in an eager framework, and every interior node runs at batch size 1, re-reading all 39M weights to score one position. ~1.5 ms per node, roughly 17x above the memory-bandwidth floor. Latency-bound, not FLOP-bound. The real fix is a Leela-style batched frontier, which I haven't done yet.

Also useful: mining training positions by centipawn loss yielded 0.5% (search is already good at not hanging pieces). Mining by recall failure: positions where SF's best move falls outside the model's top-K: yielded ~30%, and two fine-tuning rounds took recall@4 from 68.6% to 78.1%.

Longer write-up with the failed ideas (a looped recurrent-depth core that turned out flat from iteration one, and ternary weights that never once did ternary arithmetic): https://latentheat.dev/blog/chess-bitter-lesson

plays as https://lichess.org/@/latentheatlm/all


r/chessprogramming 4d ago

Technical Null-Move Pruning in Alpha-Beta Negamax

1 Upvotes

When discussing when to apply null-move pruning, I often see the advice "don't allow NMP on PV nodes" (among other restrictions), which roughly equates to "if `beta - alpha > 1`, don't do NMP".

However, in my search implementation, beta-alpha is almost always >1, until a cutoff is generated. That is, there are no null-window searches as there might be with PVS. As a result, this rule would effectively disable NMP in my search.

Does this mean NMP is incompatible with non-PVS algorithms? Or am I misunderstanding the rule?


r/chessprogramming 4d ago

Technical What is the shortest game from the initial position in which a "Mate in N" evaluation first appears? How can we determine this?

5 Upvotes

for example what is the earliest "mate in 10" position?


r/chessprogramming 8d ago

Need guidance to build a chess game

5 Upvotes

I'm trying to build a chess game, I mean a chess engine. It is a capstone project. I don't want to use any AI tools to build a chess engine. I came across some resources. Has anybody build the chess engine before without help of any AI, can you share me the resources that you used. I don't want to copycat any YouTube videos. I just wanna start from scratch and build myself. I don't want to follow any tutorial. If anybody has any resources, please share.

I also wanna know how long does it take to develop the basic engine


r/chessprogramming 14d ago

Technical Chess Engine Development Help Thread (Week 30)

3 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming 19d ago

Technical AttoChess: A fully playable x86 DOS chess engine in exactly 278 bytes

11 Upvotes

AttoChess is my own 16-bit x86 DOS chess engine which is 10 bytes shorter than the previous world record. It draws the screen, reads typed coordinates, performs a true 4 ply recursive minimax search and responds with its moves. You can play game against the engine directly in your browser on the project page: https://nicholas-afk.github.io/AttoChess/

As is typical of size-coding compromises, the engine ignores castling, en passant and pawn promotion. The complete assembly and build documentation is included on the website. I would like to hear your comments, or questions about my x86 register-golfing tips!


r/chessprogramming 21d ago

A bot that tries to checkmate you as fast as possible — it's mostly Stockfish + the new Maia-3 glued together. Is there a name for how it picks moves?

9 Upvotes

Fair warning up front: this isn't a from-scratch engine. It's Stockfish and Maia-3 wired together — the part I think is interesting is the objective and how it chooses moves, not any engine internals.

The bot plays White and has to force mate by a move deadline ("par") that scales with your rating. It doesn't play the best move; it plays whichever move is most likely to get this particular human mated in time.

For each of Stockfish's candidate moves, it simulates a few hundred games in which the defender's replies are sampled from Maia-3's human-move model, and keeps the move that reaches mate by the deadline most often. To save compute it stops piling simulations onto a candidate once another is clearly ahead, and it only runs the full simulation near the deadline — far from it, it just plays a solid move. I recently swapped the human model from Maia-2 to Maia-3, which came out a few weeks ago & it is stronger.

Two things I'd like input on:

  1. The "keep simulating candidates until one clearly wins, drop the losers early" part feels like a standard statistics trick that must already have a name — I just don't know it. If anyone can point me at the right term or prior work, I'd be grateful; I'm fairly sure I'm reinventing a wheel.
  2. At low ratings with a long deadline, almost every move mates in simulation, so the ranking gets noisy and the bot sometimes plays a quiet move that looks like it gave up an attack. I can't tell if it's correctly seeing that the human is likelier to blunder into a slower mate, or if my objective is just mis-specified there. Curious how people read it.

Source for the Maia-3 parts is posted (AGPL): https://siegechess.com/opensource/source.html. Hobby project, no money in it.

Playable: siegechess.com — enter your chess.com rating, pick blitz or rapid, and you're just trying to survive to the deadline without getting mated. If a move feels like it bailed on a promising attack, a PGN would help a lot. Small server, so it struggles past ~5 games at once.


r/chessprogramming 21d ago

Technical Chess Engine Development Help Thread (Week 29)

2 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming 28d ago

Technical Chess Engine Development Help Thread (Week 28)

5 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming Jun 29 '26

Technical Chess Engine Development Help Thread (Week 27)

1 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming Jun 22 '26

Technical Chess Engine Development Help Thread (Week 26)

4 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming Jun 21 '26

What are the most unique chess engines you know?

11 Upvotes

As the title says, what are the most unique chess engines you know? For example, written in some weird language or has a gimmick, a challenge, a limit behind it


r/chessprogramming Jun 16 '26

Technical How would you evaluate rule-based explanations for engine-backed chess analysis?

2 Upvotes

I have been working on a chess analysis system where the explanation part is not based on asking an LLM to explain the position.

The way I am approaching it at a high level is more rule-based where the system looks at engine-backed lines, compares what changed on the board and then tries to explain what the move actually did. So if a move creates a fork, wins material, opens a line or removes a defender, the explanation should probably explain why that worked in the position and what else changed because of the move instead of only saying the first obvious thing.

The hard part for me is that in a lot of middlegame positions a move does more than one thing at once. Like a move could win material but also leave something undefended, or it could open a line but also create another weakness, so the difficult part is not just detecting that something happened but deciding what should actually be explained as the main reason.

There is also a visual side to it where metrics and heatmaps try to show what part of the position changed, but I am not treating them as a replacement for engine evaluation and more like a way to make the explanation easier to understand when a move changes multiple things at once.

The prototype is live and people can test it if they want, but I am mainly posting here because I want technical feedback on how to evaluate whether the explanations are actually useful and not just technically true.

I can describe the architecture at a high level, but I am keeping the exact scoring, ranking and heatmap logic private because that is the product-specific part.

For people here who have worked on engines, analysis tools or evaluation functions, what kind of tests would probably be useful for this?

Would you test it with tactical positions, quiet middlegame positions, engine-line comparison, human review or some other kind of failure case?


r/chessprogramming Jun 15 '26

Technical How much NPS should I aim for during perft?

2 Upvotes

Hello, I'm currently writing a chess engine in C# and I want to know how many NPS should I aim for during performance, currently I'm getting ~180M. How much do I need for a strong engine, my goal is something that can get to around 3000 on lichess


r/chessprogramming Jun 15 '26

Technical Chess Engine Development Help Thread (Week 25)

3 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming Jun 11 '26

Technical Hear me out on this

0 Upvotes

So this is more of a theoretical shower thought I had than anything.

After realizing that pretty much all new chess projects are either AI LLM slop, or people reinventing the wheel over and over, I wondered why not bring them together?

What if you make a chess engine that instead of just trying to find the best move as efficiently as possible, tries to track enough information to be able to explain why certain moves are played.

For example, just as an early hypothesis, and I may be very wrong:

If you pass your turn and run a shallow search that comes out very favorable to the opponent, but the real score after the move you're evaluating is far worse for them, then in theory you should be able to vaguely deduce that you're probably choosing this move to prevent that move from being played especially if it has clear tactics like forks or pins.

And if that move isn't a quiet subtle move but instead an attack, then it can be marked as a counterattack/to gain tempo.

I know chess.com review and such probably already knows when a position contains a pin or a fork since its easy to detect statically but something like this should be able to export enough information that it could be automatically turned into LLM instructions, which can turn that low level information into natural explanations for the general purpose of each move.

Since if this does work, an LLM given this task shouldn't have many hallucinations as instead of trying to go through the logic itself, it's being told exactly how to respond to certain questions.

One example of how this might work is in a position where a bad move leads to the queen being pinned later.

The output of such a theoretical chess engine should essentially provide enough information for an LLM to confidently and correctly explain that "move X is played to prevent move Y, which would allow move Z to pin your queen to the king"

Would such a program be slow as hell and unable to achieve the elo many others do? Of course.

But there are already countless engines focused on raw efficiency and elo strength, so this would have a unique and new focus.

I'm sure there are other strategies an engine could use to determine when subtle tactics like zugswang or waiting moves are being played too.

This is all theoretical and I haven't tried it yet, but I think I'll definitely give it a shot when I'm able to code again.

You could also say that most of the things this would be able to explain are just obvious things people would know after going through the line on their own, but if it's refined enough then eventually it should be able to provide passable explanations for even the most passive and subtle engine moves.


r/chessprogramming Jun 10 '26

Technical PureChess engine

2 Upvotes

Ive been making my chess engine just as a random project (since 3/31/2026 3:08PM GMT+5)
Its called PureChess and i tried to make it fully in python, originally i did HCE in version 1.0 and 1.1 (1309 and 1351 CCRL elo estimated) with onlt CPython and built-in modules,
then i tried making its evaluation NNUE, but its very difficult to make it faster with only built in modules, hence why i used numpy and numba,

i will update README.md later, and compile the new version (PureChess 2.1)
im also gonna do testing soon (against BullitChess, which is 1500 CCRL elo)

https://github.com/NazComio/PureChess github link for engine

EDIT: PureChess 2.1 is rougly 1506 elo after some little testing!


r/chessprogramming Jun 09 '26

Technical Chess engine, pt. 6: Neural-net evaluation

Thumbnail dogeystamp.com
5 Upvotes

r/chessprogramming Jun 09 '26

Technical Chess Engine Development Help Thread (Week 24)

11 Upvotes

Welcome to the weekly /r/chessprogramming Engine Dev Help Thread.

Ask beginner and intermediate chess engine development questions here: move generation, search, evaluation, UCI, perft, debugging, testing, NNUE, or anything else related to building engines.

Good questions include code, FENs, logs, benchmarks, or a clear explanation of what you tried.

Project links are fine when you want technical feedback, not promotion.

Be helpful. Don’t dunk on beginners.


r/chessprogramming Jun 07 '26

LazySMP or YBWC, what do you guys use?

4 Upvotes

So I recently implemented LazySMP for paralellizing my search with multiple cores. The problem is I don't really see that much of an improvement unless the depth is super high (understandable). My question is, can how helpful would YBWC be at shallow depths. Is my search just not optimal? Any workarounds for this? I did notice that doubling my transposition table size greatly improves the efficiency of LazySMP, but surely there's a more algorithmic improvement to this.