Hacker News new | ask | show | jobs
by icambron 4396 days ago
I always thought of the heuristics for evaluating a chess position as the really hard part of building a chess engine; i.e. how do you capture all of the positional subtleties in a number to feed into minimax? But looking at the source, it's not really that complicated [1]. Can someone who knows more than me comment on that? Is it that the innovations are elsewhere? That good chess really can be boiled down to < 1000 LOC? That the numbers in this heuristic are just super expertly tuned?

[1] https://github.com/mcostalba/Stockfish/blob/master/src/evalu...

2 comments

Nearly all the evaluation terms in Stockfish have been extensively tuned. Joona Kiiski used the SPSA[1] algorithm on a lot of them. Others have been hand-tuned using tens of thousands of games per attempt on fishtest [2]. Fishtest actually just recently got support for running SPSA tuning as well.

There is also a strong bias towards simplification, so if an evaluation feature is not proven to be an improvement it will be removed. Over the last few Stockfish versions, the # of lines has actually decreased in each version.

[1] http://en.wikipedia.org/wiki/Simultaneous_perturbation_stoch... [2] http://tests.stockfishchess.org/tests

That's helpful, thanks.
What separates one chess engine from another is its ability to efficiently navigate and evaluate the game tree. Stockfish effectively discards probably 95% or more of the nodes in any position. Easier said than done, better not discard the best move in that 95%. Evaluation is relatively simple, a fancy lookup table. They say love covers a multitude of sins. Well, searching one move deeper than your opponent covers a multitude of static positional evaluation mistakes. Searching deeper can figure out the complexity of the position better than anything that can be statically evaluated. That's where virtually all improvements exist today, figuring out which moves can be safely discarded.