Newbie programmer: weird bug in perft, node count changing

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Newbie programmer: weird bug in perft, node count changi

Post by hgm »

Bloodbane wrote:I had a bug like this long ago, it was caused by faulty updating of castling rights in unmake. Basically the program messed the rights up when getting out of one part of the tree and it affected the counts in the others. When divide was done the part of the tree which messed the right up was no longer there so everything was fine. Of course in your case it might not be castling rights but given the position it seems like it's the most likely explanation.
For this reason I never try to zoom in on an erroneous perft count by just calculating a sub-tree. I always calculate the full tree that originally showed the error, and just do a deeper divide on it.
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: Newbie programmer: weird bug in perft, node count changi

Post by ZirconiumX »

hgm wrote:
Bloodbane wrote:I had a bug like this long ago, it was caused by faulty updating of castling rights in unmake. Basically the program messed the rights up when getting out of one part of the tree and it affected the counts in the others. When divide was done the part of the tree which messed the right up was no longer there so everything was fine. Of course in your case it might not be castling rights but given the position it seems like it's the most likely explanation.
For this reason I never try to zoom in on an erroneous perft count by just calculating a sub-tree. I always calculate the full tree that originally showed the error, and just do a deeper divide on it.
Aren't Heisenbugs* fun?

Matthew:out

*Heisenbug - a bug which disappears when you try to debug it
Some believe in the almighty dollar.

I believe in the almighty printf statement.
User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Re: Newbie programmer: weird bug in perft, node count changi

Post by jsgroby »

ZirconiumX wrote:
hgm wrote:
Bloodbane wrote:I had a bug like this long ago, it was caused by faulty updating of castling rights in unmake. Basically the program messed the rights up when getting out of one part of the tree and it affected the counts in the others. When divide was done the part of the tree which messed the right up was no longer there so everything was fine. Of course in your case it might not be castling rights but given the position it seems like it's the most likely explanation.
For this reason I never try to zoom in on an erroneous perft count by just calculating a sub-tree. I always calculate the full tree that originally showed the error, and just do a deeper divide on it.
Aren't Heisenbugs* fun?

Matthew:out

*Heisenbug - a bug which disappears when you try to debug it
As opposed to a Schrodinger's Bug, which is a bug only when you are looking at it.