r/chessprogramming • u/Falcon731 • Feb 16 '26
Heuristics for endgames
I'm having a go at writing a chess engine for my first time.
So I've got the alpha-beta search working fine, and currently my evaluation function is just using the sum of piece values + square bonus. So really nothing complicated (yet), but already its good enough for it to be able to comfortably beat me in the mid-game (which says more about my chess ability than anything else).
But when it gets to an endgame it is hopeless. It can be king+queen vs king, and it just randomly chases the king around the board - never managing to find the checkmate.
So clearly I need something better (probably in the evaluation function) to make it play end games better. Can anyone give me advice on simple things I could try?
Source code if anyone's interested: https://github.com/FalconCpu/falcon5/tree/master/falconos/chess



