## Static tactics evaluator

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

hgm
Posts: 27967
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

### Re: Static tactics evaluator

I am now thinking in the direction of a table-driven combining of independent SEE results. If a position has several squares where SEE > 0, the corresponding sequences of captures should be 'merged' to get the PV of the QS. E.g. if on one square a Rook is attacked by a Bishop and protected by a Pawn, on another square a Bishop is attacked by two Knights and protected by a Rook and Queen, and on a thrid square a Pawn attacks an unprotected Bishop. The latter has the largest SEE (3), but loses the move, and starting with it would allow the Rook to escape. So the logical play would be BxR, PxB, NxB, RxN, NxR, QxN, PxB for a total of +7. In this sequence it is only important what was captured, and not so much by which it was captured, so it could be represented as R,B,B,N,R,N,B.

The idea is to merge all SEE step by step, maintaining an (initially empty) total PV, and merging the SEE for the individual squares with this step by step. This can in principle be done with the aid of a pre-calculated table, encoding the victim sequences by unique numbers, and using these numbers to index the table. Like

Code: Select all

``newPV = mergeTable[oldPV][nextSEE];``
which would then retrieve the code for the merged victim sequence.

The code for the victim sequence of the SEE that we are adding could be obtained as

Code: Select all

``````attackProtect = SEEtable[summary[attackers[nextSqr]]][summary[protectors[nextSqr]]];
nextSEE = seqTable[board[nextSqr]][attackProtect];``````
where attackers[] and protectors[] are elements of the attack map, summary[] is a table that supplies a code for the first few lowest attackers, and the SEEtable then provides the code for the victim sequence of the exchange for all but the first capture. The seqTable then includes the first piece in the victim sequence (which was not amongst attackers and protectors, but on the square itself).

I guess the tables might have to be excessively large is they should contain every possible victim sequence. But we are really interested only in the most common cases. Very deep SEE are already rare, many SEE > 0 might also be rare.