Your best bug ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Your best bug ?

Post by Rebel »

The best bugs are those who produce ELO.

Today my thoughts went back to a fun moment during the WCCC 1993 in Munich and the game I played against Chrilly, Rebel vs Nimzo. After xx moves the game went into an unclear but equal ending and here Chrilly started to comment about every move Nimzo played saying Nimzo had a bug and that's why it played that move. And in the end Nimzo won the game, Chrilly having big fun telling everybody he won because of a bug.

Now those who know Chrilly and his sense of humor will realize you never can be sure if he is not pulling your leg but if true that's the kind of bug you want to keep.

I have one of my own, I am aware of it since the 90's, eventually after a long debugging process found the bug, but in order to fix it would lose so much speed that Rebel would lose 30-40 elo points and thus I left it and it's still present until this day. Consider the diagram and its analysis.
[d]k7/8/8/4b3/8/5K2/7p/8 w - -

00:00:00 1.00 -12.93 5.Ke4
00:00:00 1.07 -0.03 5.Kg2

It's clear the chess knowledge is OK, Kg2 moves into the quadrant so a draw. But then search is going to spoil it all:

Code: Select all

 00:00:00   2.00  -0.03  5.Kg2 Kb7 
 00:00:00   3.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc7 7.Kg2 Kc6 8.Kf3 h1 9.Ke2 
                         Qg2 10.Kd1 Qh1 11.Kd2 Qg2 12.Kd1 Qh1 13.Kd2 
                         Qg2 
 00:00:00   4.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc7 7.Kg2 h1 8.Kxh1 
 00:00:00   5.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc7 7.Kg2 h1 8.Kxh1 
 00:00:00   6.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc6 7.Kg2 Kd6 8.Kh1 Kd5 9.Kg2 
                         Kc4 10.Kf3 h1 11.Ke3 Qh3 12.Ke4 Qe6 
 00:00:00   7.00  -0.03  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kc6 8.Kh1 Kd5 9.Kg2 
                         h1 10.Kxh1 
 00:00:00   8.00  -12.99  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kc6 8.Kf3 h1 9.Ke2 
                          Qg2 10.Kd1 Qh1 11.Ke2 Qg2 12.Kd1 Qh1 
 00:00:00   8.01  -12.75  5.Ke4 Bd6 6.Kf3 h1=Q 
 00:00:00   9.00  -13.57  5.Ke4 Bc3 6.Kd3 Bf6 7.Ke4 h1=Q 
 00:00:00   9.01  -13.57  5.Kg2 
 00:00:00   9.01  -13.57  5.Kg2 
 00:00:00   9.04  -13.16  5.Kg4 h1=Q 
 00:00:00  10.00  -13.16  5.Kg4 h1=Q 
 00:00:00  10.02  -13.16  5.Kg2 
 00:00:00  10.02  -13.16  5.Kg2 
 00:00:00  11.00  -13.52  5.Kg4 h1=Q 
 00:00:00  11.01  -13.52  5.Kg2 
 00:00:00  11.01  -13.52  5.Kg2 
 00:00:00  11.01  -0.03  5.Kg2 Ka7 6.Kh1 Kb8 7.Kg2 Kc7 8.Kh1 Kd6 9.Kg2 
                         Kc5 10.Kh1 Kd4 11.Kg2 Kc4 12.Kh1 Kd3 13.Kg2 
                         Ke4 14.Kh1 Kd3 15.Kg2 Ke4 16.Kh1 
 00:00:00  12.00  -14.02  5.Kg2 Ka7 6.Kh1 Kb8 7.Kg2 Kc7 8.Kh1 Kd6 9.Kg2 
                          Kc5 10.Kf3 h1 11.Ke2 Qg2 12.Kd1 Qf3 13.Kc1 
                          Qf1 14.Kc2 Qe2 15.Kc1 Qe3 16.Kd1 Qd4 
 00:00:00  12.01  -13.52  5.Kg4 h1=Q 
 00:00:00  13.00  -13.47  5.Kg4 h1=Q 
 00:00:00  14.00  -13.55  5.Kg4 Bc3 6.Kf5 h1=Q 
 00:00:00  14.01  -13.55  5.Kg2 
 00:00:00  14.01  -13.55  5.Kg2 
 00:00:01  15.00  -M11  5.Kg4 Bc3 6.Kf5 h1=Q 
 00:00:01  15.01  -M11  5.Kg2 
 00:00:01  15.01  -M11  5.Kg2 
 00:00:01  15.01  -0.03  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bd6 8.Kh1 Kc6 9.Kg2 
                         Kc5 10.Kh1 Bf4 11.Kg2 Kd5 12.Kh1 Bd6 13.Kg2 
                         Be5 14.Kh1 Bf4 15.Kg2 Be5 16.Kh1 
 00:00:02  16.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bd6 8.Kh1 Kc6 9.Kg2 
                          Kd5 10.Kh1 Be5 11.Kg2 Bf4 12.Kf3 h1 13.Kxf4 
                          Qe4 14.Kg5 Qd4 15.Kf5 Qd3 16.Kf4 Qe4 
 00:00:02  17.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bf4 8.Kh1 Be5 9.Kg2 
                          Bf4 10.Kh1 
 00:00:02  18.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kb6 8.Kh1 Kc5 9.Kg2 
                          Kc6 10.Kh1 Kd5 11.Kg2 Bd6 12.Kh1 Be5 13.Kg2 
                          Bd6 14.Kh1 
 00:00:02  19.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bf4 8.Kh1 Kc6 9.Kg2 
                          Bd6 10.Kh1 Kc5 11.Kg2 Kd5 12.Kh1 Be5 13.Kg2 
                          Bd6 14.Kh1 Be5 15.Kg2 
 00:00:03  20.00  -0.04  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kb7 8.Kh1 Kc6 9.Kg2 
                         Kd5 10.Kh1 Bf4 11.Kg2 Bd6 12.Kh1 Bf4 13.Kg2 
                         Bd6 14.Kh1 
 00:00:15  21.00  -0.04  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kc5 8.Kh1 Kd5 9.Kg2 
                         Bf4 10.Kh1 Bd6 11.Kg2 Ke4 12.Kh1 Be5 13.Kg2 
                         Bf4 14.Kh1 Bd6 15.Kg2 Kd3 16.Kh1 Bf4 
 00:00:16  22.00  -13.01  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kc5 8.Kh1 Kd5 9.Kg2 
                          Bf4 10.Kh1 Bd6 11.Kg2 Bf4 12.Kh1 Bd6 13.Kg2 
 00:00:19  23.00  -7.15  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kb5 8.Kh1 Bf4 9.Kg2 
                         Kb4 10.Kh1 Kc5 11.Kg2 Kd5 12.Kh1 Kd4 13.Kg2 
                         Kc3 14.Kh1 Kd3 15.Kg2 Kd2 16.Kh1 Ke3 
What's your best bug ?
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Your best bug ?

Post by smatovic »

imo the worst bugs are those where it exposes that there is no bug at all....chasing rabbits.

i tried two weeks to implement Korfs RBF-Search,
just to realize that i did implement it already correct but in another way...

--
Srdja
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Your best bug ?

Post by bob »

Rebel wrote:The best bugs are those who produce ELO.

Today my thoughts went back to a fun moment during the WCCC 1993 in Munich and the game I played against Chrilly, Rebel vs Nimzo. After xx moves the game went into an unclear but equal ending and here Chrilly started to comment about every move Nimzo played saying Nimzo had a bug and that's why it played that move. And in the end Nimzo won the game, Chrilly having big fun telling everybody he won because of a bug.

Now those who know Chrilly and his sense of humor will realize you never can be sure if he is not pulling your leg but if true that's the kind of bug you want to keep.

I have one of my own, I am aware of it since the 90's, eventually after a long debugging process found the bug, but in order to fix it would lose so much speed that Rebel would lose 30-40 elo points and thus I left it and it's still present until this day. Consider the diagram and its analysis.
[d]k7/8/8/4b3/8/5K2/7p/8 w - -

00:00:00 1.00 -12.93 5.Ke4
00:00:00 1.07 -0.03 5.Kg2

It's clear the chess knowledge is OK, Kg2 moves into the quadrant so a draw. But then search is going to spoil it all:

Code: Select all

 00:00:00   2.00  -0.03  5.Kg2 Kb7 
 00:00:00   3.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc7 7.Kg2 Kc6 8.Kf3 h1 9.Ke2 
                         Qg2 10.Kd1 Qh1 11.Kd2 Qg2 12.Kd1 Qh1 13.Kd2 
                         Qg2 
 00:00:00   4.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc7 7.Kg2 h1 8.Kxh1 
 00:00:00   5.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc7 7.Kg2 h1 8.Kxh1 
 00:00:00   6.00  -0.03  5.Kg2 Kb7 6.Kh1 Kc6 7.Kg2 Kd6 8.Kh1 Kd5 9.Kg2 
                         Kc4 10.Kf3 h1 11.Ke3 Qh3 12.Ke4 Qe6 
 00:00:00   7.00  -0.03  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kc6 8.Kh1 Kd5 9.Kg2 
                         h1 10.Kxh1 
 00:00:00   8.00  -12.99  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kc6 8.Kf3 h1 9.Ke2 
                          Qg2 10.Kd1 Qh1 11.Ke2 Qg2 12.Kd1 Qh1 
 00:00:00   8.01  -12.75  5.Ke4 Bd6 6.Kf3 h1=Q 
 00:00:00   9.00  -13.57  5.Ke4 Bc3 6.Kd3 Bf6 7.Ke4 h1=Q 
 00:00:00   9.01  -13.57  5.Kg2 
 00:00:00   9.01  -13.57  5.Kg2 
 00:00:00   9.04  -13.16  5.Kg4 h1=Q 
 00:00:00  10.00  -13.16  5.Kg4 h1=Q 
 00:00:00  10.02  -13.16  5.Kg2 
 00:00:00  10.02  -13.16  5.Kg2 
 00:00:00  11.00  -13.52  5.Kg4 h1=Q 
 00:00:00  11.01  -13.52  5.Kg2 
 00:00:00  11.01  -13.52  5.Kg2 
 00:00:00  11.01  -0.03  5.Kg2 Ka7 6.Kh1 Kb8 7.Kg2 Kc7 8.Kh1 Kd6 9.Kg2 
                         Kc5 10.Kh1 Kd4 11.Kg2 Kc4 12.Kh1 Kd3 13.Kg2 
                         Ke4 14.Kh1 Kd3 15.Kg2 Ke4 16.Kh1 
 00:00:00  12.00  -14.02  5.Kg2 Ka7 6.Kh1 Kb8 7.Kg2 Kc7 8.Kh1 Kd6 9.Kg2 
                          Kc5 10.Kf3 h1 11.Ke2 Qg2 12.Kd1 Qf3 13.Kc1 
                          Qf1 14.Kc2 Qe2 15.Kc1 Qe3 16.Kd1 Qd4 
 00:00:00  12.01  -13.52  5.Kg4 h1=Q 
 00:00:00  13.00  -13.47  5.Kg4 h1=Q 
 00:00:00  14.00  -13.55  5.Kg4 Bc3 6.Kf5 h1=Q 
 00:00:00  14.01  -13.55  5.Kg2 
 00:00:00  14.01  -13.55  5.Kg2 
 00:00:01  15.00  -M11  5.Kg4 Bc3 6.Kf5 h1=Q 
 00:00:01  15.01  -M11  5.Kg2 
 00:00:01  15.01  -M11  5.Kg2 
 00:00:01  15.01  -0.03  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bd6 8.Kh1 Kc6 9.Kg2 
                         Kc5 10.Kh1 Bf4 11.Kg2 Kd5 12.Kh1 Bd6 13.Kg2 
                         Be5 14.Kh1 Bf4 15.Kg2 Be5 16.Kh1 
 00:00:02  16.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bd6 8.Kh1 Kc6 9.Kg2 
                          Kd5 10.Kh1 Be5 11.Kg2 Bf4 12.Kf3 h1 13.Kxf4 
                          Qe4 14.Kg5 Qd4 15.Kf5 Qd3 16.Kf4 Qe4 
 00:00:02  17.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bf4 8.Kh1 Be5 9.Kg2 
                          Bf4 10.Kh1 
 00:00:02  18.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kb6 8.Kh1 Kc5 9.Kg2 
                          Kc6 10.Kh1 Kd5 11.Kg2 Bd6 12.Kh1 Be5 13.Kg2 
                          Bd6 14.Kh1 
 00:00:02  19.00  -10.26  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Bf4 8.Kh1 Kc6 9.Kg2 
                          Bd6 10.Kh1 Kc5 11.Kg2 Kd5 12.Kh1 Be5 13.Kg2 
                          Bd6 14.Kh1 Be5 15.Kg2 
 00:00:03  20.00  -0.04  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kb7 8.Kh1 Kc6 9.Kg2 
                         Kd5 10.Kh1 Bf4 11.Kg2 Bd6 12.Kh1 Bf4 13.Kg2 
                         Bd6 14.Kh1 
 00:00:15  21.00  -0.04  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kc5 8.Kh1 Kd5 9.Kg2 
                         Bf4 10.Kh1 Bd6 11.Kg2 Ke4 12.Kh1 Be5 13.Kg2 
                         Bf4 14.Kh1 Bd6 15.Kg2 Kd3 16.Kh1 Bf4 
 00:00:16  22.00  -13.01  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kc5 8.Kh1 Kd5 9.Kg2 
                          Bf4 10.Kh1 Bd6 11.Kg2 Bf4 12.Kh1 Bd6 13.Kg2 
 00:00:19  23.00  -7.15  5.Kg2 Ka7 6.Kh1 Kb6 7.Kg2 Kb5 8.Kh1 Bf4 9.Kg2 
                         Kb4 10.Kh1 Kc5 11.Kg2 Kd5 12.Kh1 Kd4 13.Kg2 
                         Kc3 14.Kh1 Kd3 15.Kg2 Kd2 16.Kh1 Ke3 
What's your best bug ?
My favorite goes back to the original version of Blitz V, my first full-width (ala chess 4.x in Frey's book) program. I finished it on a Friday night, and Saturday morning we played in a human tournament (just before we moved to a Cray, in fact). In the first game, things looked reasonable until out of the clear, the program played Qxh7 sacrificing it's queen. The PV looked reasonable at first glance, but I wondered "why can't he take." We started the ponder search and didn't have a move, so it did a search from the other side to choose one and found Kxh7 with a +8 score. Our opponent (a 2000-USCF player) used 1/2 of his clock time (this was a tornado event, 60 moves in 60 minutes). After 1/2 hour, he played Kf8 and didn't take. After the game, he asked, "if I had taken the queen, did it see mate?" I told him "no, it saw a loss." :)

Turns out we had a serious bug that would, under certain conditions, cause it to play the worst move rather than the best, but only at the root of the tree... ugh. But we got away with it and fixed it before the next round...

In 1984 we moved to a 4 cpu cray, and I did the first "PVS (principle variation split) version we used. I had an undetected race condition where if there were only 3 legal moves at a split point, the 4th cpu would think it was checkmated. It could, with the right timing, back that mated score up over good scores (the thinking was that finding out we were mated happened almost instantly and the other searches would take longer. Only in a game against future GM Stuart Rachaels (he was a USCF master at this point) we were white and played something like Bxc6 mate. But the opponent had 3 ways to get out of check, two king moves, plus bxc6 removing the bishop. So we played Bxc6 mate, Stuart played bxc6 out of mate, and we lost after a long struggle...

Fixed that bug that night as well. :)
User avatar
Codesquid
Posts: 138
Joined: Tue Aug 23, 2011 10:25 pm
Location: Germany

Re: Your best bug ?

Post by Codesquid »

Once had a nice bug in tapered eval. I managed to implement the scaled part backwards, introducing two nice discontinuities.

As it should, before the threshold 100% middle-game scores where used and at the end 100% endgame scores. But, at the first material threshold it jumped immediately to 100% endgame and then slowly changed to 100% middlegame. At the second material threshold it then jumped back to 100% endgame.
nanos gigantium humeris insidentes
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Your best bug ?

Post by PK »

Back when my first Delphi program was evenly matched with TSCP, I added the code giving a small bonus for Bf1 defending a King on G1. I did it in a clumsy way, substracting a piece/square table score from the eval. So far, so good - but later on I had an "optimization idea" of adding material scores to piece/square tables and forgot to adjust that piece of code. Effect was spectacular: in one game TSCP moved its Bishop to F8 and blocked it with something. Then my poor engine shown +3 score and started pressing like crazy, not giving its worthy opponent time to unblock the Bishop. It worked - and left me dazzled about the depth of its plan, until I saw the bug.
Richard Allbert
Posts: 792
Joined: Wed Jul 19, 2006 9:58 am

Re: Your best bug ?

Post by Richard Allbert »

Mine was in the Richard Pijl's CPT tournament with Lime in 2009, when I made the error of "quickly adding something" to the code before the game vs Neurosis.

As the game progressed, Lime played a very over the top attacking game, showing av eval of +5.00, Neurosis showing +3.00 the other way.

Stan (Neurosis author) and I were unsure of which engine was the correct one, until late in the game it became clear Neurosis was correct, when Lime was material down and still loving the position.

It turned out I had inserted a number in the doubled pawn evaluation, which can only have been by brushing the touchpad with my palm, which sometimes causes the cursor to move. Lime though doubled pawns for black gave white a 7.00 advantage in that game :)

It spent the whole middlegame hellbent on creating doubled pawn for black, which it did, and then did anything to keep them there - it was even "protecting" them with its own rooks. It was very amusing at the time! :D
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: Your best bug ?

Post by Kempelen »

During Rodin programming I had two or three Heisengub. These are bug that when you start the debugger or modify the code to do printf or similar, they dissapear. They are quite difficult to catch for these reason. The first one it took me more than a week to see that I was initializing bad a variable.
This kind of bug makes one to lose patience.

http://en.wikipedia.org/wiki/Heisenbug
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Your best bug ?

Post by hgm »

Rebel wrote:I have one of my own, I am aware of it since the 90's, eventually after a long debugging process found the bug, but in order to fix it would lose so much speed that Rebel would lose 30-40 elo points and thus I left it and it's still present until this day. Consider the diagram and its analysis.
[d]k7/8/8/4b3/8/5K2/7p/8 w - -

00:00:00 1.00 -12.93 5.Ke4
00:00:00 1.07 -0.03 5.Kg2

It's clear the chess knowledge is OK, Kg2 moves into the quadrant so a draw. But then search is going to spoil it all:

Code: Select all

...
 00:00:00   8.00  -12.99  5.Kg2 Ka7 6.Kh1 Kb7 7.Kg2 Kc6 8.Kf3 h1 9.Ke2 
                          Qg2 10.Kd1 Qh1 11.Ke2 Qg2 12.Kd1 Qh1 
I don't get it. What is the bug that causes Kf3 to become a PV move while Kh1 is available? Is it that it thinks 8.Kh1 will also lead to a forced promotion? This looks like a horrific search bug, and it is hard for me to see how this could provide any Elo.

Recently I saw a funny blunder in this end-game by Fairy-Max:

[d]1b6/8/8/8/8/8/3k2Kp/8 w

Fairy-Max played 1.Kf2? here! The reason of course is that after 1... h1=Q it is a stalemate, and Fairy-Max does not consider under-promotion. This might be considered a bug, and although it probably does not provide Elo, it does provide Elo/char (and thus is by design).

In the actual game the opponent also did not know under-promotion, so the game ended draw after all!
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: Your best bug ?

Post by Rebel »

hgm wrote: I don't get it. What is the bug that causes Kf3 to become a PV move while Kh1 is available? Is it that it thinks 8.Kh1 will also lead to a forced promotion? This looks like a horrific search bug, and it is hard for me to see how this could provide any Elo.
It has something to do with too narrow margins on multiple places and the fact that the material score (Q+B) (9+3=12 pawns) could drop to 0.00. Since there was no easy fix so I left it. I have put it on my to_do list again.
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Your best bug ?

Post by Gerd Isenberg »

Rebel wrote:The best bugs are those who produce ELO.

Today my thoughts went back to a fun moment during the WCCC 1993 in Munich and the game I played against Chrilly, Rebel vs Nimzo. After xx moves the game went into an unclear but equal ending and here Chrilly started to comment about every move Nimzo played saying Nimzo had a bug and that's why it played that move. And in the end Nimzo won the game, Chrilly having big fun telling everybody he won because of a bug.

Now those who know Chrilly and his sense of humor will realize you never can be sure if he is not pulling your leg but if true that's the kind of bug you want to keep.
The Nimzo White-Black bug is described by Chrilly (in German) in Computer machen keine Fehler (CSS 2/99, pdf).

The source of Nimzo is available and according to Chrilly's foreword the 93 WMCCC version Nimzo 2.2.1 which should contain the bug:
http://home.arcor.de/roger.thormann/yac ... rwort.html
http://home.arcor.de/roger.thormann/yac ... /sr_c.html

Also funny is the mentioned Genius sign bug.

My not so "good" bug with early DOS IsiChess appeared at AEGON 94 vs. Henk Arnoldus. IsiChess generated only one En passant move even if two were possible:
https://chessprogramming.wikispaces.com ... ant%20bugs