The idea is to keep a history table indexed by
Code: Select all
side to move, threat piece, threat square, own piece, own square
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!