Sunday, December 22, 2013

[pektexuk] Verifying a retrograde move generator

Suppose you've written a reverse move generator for chess, perhaps for endgame tablebase generation.  How would one verify it is correct?  Assume we have a correct forward move generator.

We would like perft (and divide) but for reverse moves.  Captures may make this awkward.

From a random position, generate all the forward move positions (1-ply).  Verify that the original position is reachable by a backward move.

Generate all the backward move positions.  Verify that they are all legal positions and forward works from them.

Repeat for greater than 1 ply.

No comments :