Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Testing chess programs

Author: Jay Scott

Date: 12:04:26 12/30/97

Go up one level in this thread


On December 30, 1997 at 07:38:54, Lucien Okkes wrote:
>Some time ago I started to write my own chess program. At this moment
>the program seems to work fine, but I am not convinced that it is
>bug-free. Has anyone suggestions for thoroughly testing a chess program?

Don Dailey made a bunch of good suggestions. Here are some more:

- The evaluation function is hard to test because bugs often
do nothing worse than cause occasional sloppy play. You need
a way to look at the different evaluation components in a
position and eyeball them for good sense.

- Ditto for the details of the search, with extensions and
whatnot. You have to step through searches in progress, or
dig through detailed logs, to find all the problems.

- Whenever I write a program that I want to be reliable, I include
a large suite of sanity check routines that examine all data
structures for consistency. Half of the bugs that this turns
up are in the check routines, but the other half are real.
For a thorough test, run the sanity check once per node searched.
For a quick test, run it occasionally at random times during
the search. You will also want a faster version of the sanity
check that does not bother to examine every entry in the
main hash table!

- When key algorithms can be pulled out into modules, it's
easier to create regression tests for them. Every time you
work on that bit of code, run its regression test. Every time
you find a new bug, create a test that will catch it if it
reappears.

- If you do incremental updating, double-check its results
against the figure-it-out-from-scratch algorithm.

- Collect a set of worst-case positions to test the program on.
Get one with nine queens, one with all pawns blocked, one with
two bishops on the same color squares, that kind of thing.
The recently-posted positions with huge legal move counts would
be good for this set.

- Despite all this work, there will still be bugs. When you
suspect one, buckle down and trace it! It's amazing how many
programmers are too lazy to fix rare bugs, or to decipher odd
behavior that might be a bug.

  Jay



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.