Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: My bug of the year...

Author: Miguel A. Ballicora

Date: 09:37:31 12/29/00

Go up one level in this thread


On December 29, 2000 at 04:17:05, Severi Salminen wrote:

>Hi!
>
>I made a bug in my program. It was a very stupid bug which I tried to find for
>at least 4-6 days. When I played games against other winboard engines my program
>freezed at some point (not in every game) reporting an error in MVV/LVA sorting
>algorithm. Well, apparently there was nothing wrong in there. Then after a few
>days I managed to find out that something was corrupting my precompiled attack
>tables for bishops - strange. Then after a few hours of debugging I managed to
>isolate the problem to history heuristics table and there it was (at the
>beginning of my source file):
>
>int History[MAX_PLY][MAX_PLY];
>
>Did you see that: MAX_PLY!! Of course it should have been [64][64]. MAX_PLY was
>set to 60 so it crashed not too often. Boy, I was happy to find that one. Now it
>is working smooth and fine!

I think that it could be a good idea once in a while to set
MAX_PLY to a low number (say, 16) and see how the program performs.
I have something like this:

   if (ply >= MAX_PLY) return eval();

at the beginning of search(), quies() etc. so the program should
tolerate this constraint. In this was, I spot a potential bug because
I tested for a check before (ply >= MAX_PLY) in quies(). So, if ply==MAX_PLY and
there is a check, that would allow to continue the search beyond MAX_PLY!!.
Silly bug and unlikely to happen, but could have been impossible to catch.

In this way, you make unlikely things happen more often.

Miguel

>
>You learn by mistakes.
>
>Severi



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.