possibly new: threat history

Discussion of chess software programming and technical issues.

Moderator: Ras

Lunar
Posts: 14
Joined: Wed May 21, 2025 12:32 pm
Full name: Patrick Hilhorst

possibly new: threat history

Post by Lunar »

Had a development in my engine I've never seen described elsewhere, so perhaps interesting for other folks as well, I call it "threat history".

The idea is to keep a history table indexed by

Code: Select all

side to move, threat piece, threat square, own piece, own square
, similar to continuation history and follow-up history. The "threat" in this case is the threat returned from null move pruning. When there is a cutoff, we save the move that failed high and threat severity = beta - fail-soft score (this only works in a fail-soft framework). When a quiet move fails high in the normal search, we apply a bonus to the threat history table with gravity, and a mallus for all previous quiet moves that failed low.

Then, when ordering quiet moves, we apply a bonus to the move order score based on the current threat, if we have one. Crucially, we scale this by the threat severity we currently face, clipped to a sensible value (I use 2.5 pawns). If I didn't scale, there is a lot of noise from this table, because often the threat isn't super serious; i.e. just developing pieces in the opening, placing undue weight on moves that already have been assigned a weight from the normal history table. However, when there is a threat we have previously found a good quiet resolution for, we can re-use this information.

Perhaps my implementation is clearer than my prose here: https://github.com/Synthetica9/lunar/co ... 4c3e01d4f6

This was a relatively ok gainer for me (+7 elo at LTC). It'd be interesting to hear if anyone already knows this technique to be in use in another engine; or if you've (successfully or not) been able to implement it in your engine!