Possible search bug in Heretic?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Possible search bug in Heretic?

Post by hgm »

Heretic was winning the game below (in itself quite an achievement, 8 ply against 18...), when it inexpliquably blundered it away. My first thought was that it could have been horizon effect, but it was kind of strange that even in the move after that it did not see the promotion coming. So I suspect a bug...

Code: Select all

[Event "Computer Chess Game"]
[Site "SCHAAKPC"]
[Date "2012.01.25"]
[Round "2"]
[White "Heretic 0.1"]
[Black "NebiyuChess_1.42"]
[Result "0-1"]
[TimeControl "1500+1"]
[Variant "capablanca"]
[FEN "ranbqkbncr/pppppppppp/10/10/10/10/PPPPPPPPPP/RANBQKBNCR w KQkq - 0 1"]
[SetUp "1"]

{--------------
r a n b q k b n c r
p p p p p p p p p p
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
P P P P P P P P P P
R A N B Q K B N C R
white to play
--------------}
1. Ch3 {+0.12/9} Ac6 {+0.15/17 35} 2. Ac3 {+0.09/8 57} Nd6 {+0.05/19 43} 3.
e3 {+0.08/8 55} e5 {+0.15/19 42} 4. Ng3 {+0.04/8 53} Ni6 {+0.20/17 33} 5.
Nd3 {+0.04/9 51} a5 {+0.10/17 37} 6. f4 {+0.09/8 49} exf4 {+0.10/18 38} 7.
Cxf4 {+0.03/9 47} Bg5 {+0.10/18 31} 8. Ch5 {+0.05/8 45} f5 {+0.25/15 30} 9.
Bf3 {+0.13/8 43} Ad8 {+0.00/14 28} 10. e4 {+0.25/7 42} g6 {+0.30/14 35} 11.
Ch3 {+0.32/7 40} Nh4 {+0.25/14 32} 12. exf5 {+0.50/7 39} gxf5 {+0.35/17 33}
13. Qxe8+ {+0.49/6 37} Kxe8 {+0.60/18 32} 14. Re1+ {+0.50/6 36} Be6
{+0.75/16 31} 15. Bh5+ {+0.50/6 34} Kf8 {+0.55/18 24} 16. Nc5 {+0.40/6 33}
i6 {+0.35/17 27} 17. Bf3 {+0.29/8 32} Nxf3 {+0.30/16 28} 18. gxf3
{+0.21/8 30} Ch6 {+0.20/18 27} 19. Cxh6 {+0.22/8 29} Bxh6 {+0.30/17 5} 20.
Ni4 {+0.17/7 28} Bg7 {+0.90/19 27} 21. Bd4 {+0.20/8 27} Rg8 {+0.90/21 24}
22. Rg1 {+0.18/8 26} Bi5 {-1.15/22 26} 23. Nxe6+ {+0.25/8 25} dxe6
{-1.40/24 22} 24. Rxg8+ {+0.35/8 24} Kxg8 {-1.70/24 22} 25. Re2
{+0.88/8 23} Kf7 {-1.55/23 24} 26. Rg2 {+0.90/8 22} Ac6 {-2.20/21 19} 27.
Ng5+ {+0.92/7 21} Ke7 {-2.60/22 20} 28. Bf6+ {+0.98/7 21} Ke8 {-2.25/22 21}
29. Bg7 {+1.91/8 20} Bxg7 {-2.80/24 22} 30. Axg7+ {+1.91/7 19} Ke7
{-2.75/23 21} 31. Axe6 {+2.01/8 18} Rh8 {-2.85/22 17} 32. Ag7 {+2.04/8 18}
Re8 {-2.25/22 18} 33. Re2+ {+2.02/8 17} Kd8 {-2.15/23 16} 34. Nxh7
{+2.02/8 16} Rxe2 {-2.00/22 16} 35. Kxe2 {+2.00/9 16} Ad5 {-2.05/22 19} 36.
Af6+ {+2.00/9 15} Axf6 {-2.10/24 16} 37. Nxf6 {+2.00/11 15} b5
{-2.10/22 18} 38. d3 {+2.00/10 14} c6 {-2.10/22 17} 39. Ke3 {+2.02/10 13}
Ke7 {-2.20/22 17} 40. Ng8+ {+2.02/10 13} Ke6 {-2.10/26 16} 41. Nh6
{+2.02/10 12} j5 {-2.20/25 16} 42. Kf4 {+2.02/10 12} Kf6 {-2.30/25 15} 43.
i4 {+2.02/10 12} jxi4 {-1.95/24 13} 44. Nxi4 {+2.00/11 11} Nc8
{-1.80/24 15} 45. Ng5 {+2.02/11 11} Nb6 {-2.65/25 14} 46. Nxi6
{+2.00/11 10} Nd5+ {-2.65/25 13} 47. Kg3 {+2.00/11 10} Ne3 {-2.70/24 14}
48. c3 {+2.00/10 10} Nd1 {-2.60/24 28} 49. b4 {+2.04/10 9} a4 {-2.45/24 20}
50. c4 {+2.00/11 9} Nc3 {-2.15/24 20} 51. cxb5 {+2.02/11 9} cxb5
{-2.70/24 11} 52. a3 {+2.00/12 8} Ne2+ {-2.85/24 9} 53. Kf2 {+2.10/11 8}
Nf4 {-3.00/27 11} 54. Ke3 {+2.96/11 8} Ng2+ {-2.90/27 9} 55. Kd4
{+2.96/12 7} Ne1 {-2.45/25 10} 56. Kc5 {+2.96/10 7} Nxd3+ {-2.55/25 8} 57.
Kxb5 {+2.98/11 7} Ne5 {-2.65/25 10} 58. f4 {+2.98/11 7} Nd3 {-2.80/26 8}
59. Nh4 {+2.98/11 6} Nxf4 {-2.60/24 7} 60. Kxa4 {+2.98/11 6} Kg5
{-2.45/22 9} 61. Nf3+ {+2.08/11 6} Kg4 {-2.55/23 9} 62. Nd4 {+3.00/11 6}
Nd5 {-2.55/23 9} 63. Kb5 {+2.96/11 6} f4 {-2.65/23 8} 64. Kc4 {+2.08/10 5}
Nf6 {-2.75/24 8} 65. Ne6 {+3.00/10 5} f3 {-2.30/23 6} 66. Kd3 {+3.00/10 5}
Ne4 {-2.55/25 8} 67. Nc5 {+2.06/10 5} Nxc5+ {+7.45/21 8} 68. Ke3
{-1.39/12 5} Ne4 {+7.70/20 8} 69. Kd3 {-1.39/12 5} f2 {+8.60/20 6} 70. Ke2
{-2.39/11 4} Kh3 {+8.80/20 6} 71. Kf1 {-1.39/11 4} Kxh2 {+11.80/20 7} 72.
j3 {-10.40/10 4} Kg3 {+12.90/21 7} 73. Ke2 {-10.43/10 4} Kg2 {+13.00/20 7}
74. Ke3 {-11.34/9 4} Nd6 {+12.55/18 6} 75. Kd4 {-12.32/10 4} Nb5+
{+13.20/18 6} 76. Kd5 {-11.42/9 4} Nxa3 {+13.35/17 5} 77. j4 {-13.29/9 4}
f1=Q {+13.45/17 5} 78. j5 {-13.29/8 3} Qb5+ {+13.50/16 5} 79. Ke4
{-13.42/8 3} Qxj5 {+13.60/16 5} 80. Kd4 {-13.41/8 3} Kf3 {+299.88/19 6} 81.
Kc3 {-13.40/8 3} Qd5 {+299.90/20 4} 82. Kb2 {-327.57/8 3} Qd3
{+299.92/22 5} 83. Ka2 {-327.61/10 3} Nc4 {+299.94/21 5} 84. Ka1
{-327.63/11 3} Qa3+ {+299.96/20 5} 85. Kb1 {-327.65/59} Qb2#
{+299.98/19 1.4}
{Xboard adjudication: Checkmate} 0-1
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Possible search bug in Heretic?

Post by mar »

Thanks for the info hgm,

I have to admit i know of a bug where Heretic reports wrong mate scores and then drops to normal score on the next ply. So I'm 100% sure there's a search/hashtable/movegen bug somewhere.
I will try to look into it when i have some free time.
It was written in a hurry and from scratch (two weekends I think) so it's sort of a miracle that it scored at least some points which is in fact more than i expected.

Martin
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Heretic 0.1 sources

Post by mar »

I release the sources under GPL just in case someone might find it useful despite the bug.
http://www.mediafire.com/?xui0aywj5b2cgmv

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

Re: Possible search bug in Heretic?

Post by hgm »

Errr, a stupid question: how do I set hashtable size for Heretic? I notice it has very small memory footprint (2MB), so I assumed it did not have hash table at all...
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Possible search bug in Heretic?

Post by mar »

Hash size currently can't be set and is fixed to 1MB.

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

Re: Possible search bug in Heretic?

Post by hgm »

Ah, OK. I was already fearing that I had been doing Heretic great injustice by messing up its hash setting.

Spartacus uses 2.4MB for its material table alone...
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Possible search bug in Heretic?

Post by mar »

hgm wrote:Ah, OK. I was already fearing that I had been doing Heretic great injustice by messing up its hash setting.

Spartacus uses 2.4MB for its material table alone...
Nothing to worry about. It's very simple and I personally don't believe much in hashtable size, cheng defaults to 4MB for example. But I will probably add hash settings when i find that bug and release a new version :)
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Possible search bug in Heretic?

Post by mar »

Just fixed two really stupid bugs :!:. I guess 0.2 will be ready very soon.

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

Re: Possible search bug in Heretic?

Post by hgm »

Great! This time Heretic (with bug) nailed Spartacus!

Code: Select all

[Event "Computer Chess Game"]
[Site "SCHAAKPC"]
[Date "2012.01.25"]
[Round "3"]
[White "Heretic 0.1"]
[Black "Spartacus 1.02"]
[Result "1-0"]
[TimeControl "1500+1"]
[Variant "capablanca"]
[FEN "ranbqkbncr/pppppppppp/10/10/10/10/PPPPPPPPPP/RANBQKBNCR w KQkq - 0 1"]
[SetUp "1"]

{--------------
r a n b q k b n c r
p p p p p p p p p p
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
P P P P P P P P P P
R A N B Q K B N C R
white to play
--------------}
1. Ch3 {+0.12/9} d5 {+0.16/14 52} 2. c4 {+0.29/8 57} Ng6 {+0.13/14 41} 3.
cxd5 {+0.98/8 55} Nb6 {+0.12/14 34} 4. Ac3 {+1.00/8 53} Ad7 {+0.15/14 35}
5. a4 {+0.95/8 51} Axh3 {+0.93/14 24} 6. ixh3 {+0.82/9 49} f5 {+0.79/14 33}
7. Ab5 {+0.97/9 47} Qxb5 {+0.99/15 30} 8. axb5 {+1.70/10 45} Bxd5
{+0.90/14 21} 9. f3 {+1.70/8 43} Ch6 {+0.84/14 41} 10. Bb3 {+1.68/8 42} Nf4
{+0.91/14 40} 11. Bxd5 {+1.86/8 40} Nbxd5 {+0.79/14 22} 12. Rxa7
{+2.43/8 39} Rxa7 {+0.62/15 24} 13. Bxa7 {+1.69/9 37} Cd6 {+0.65/14 31} 14.
Ri1 {+1.72/8 36} O-O {+1.33/14 31} 15. e4 {+1.83/8 34} fxe4 {+1.37/15 27}
16. fxe4 {+1.65/8 33} Cxb5 {+1.31/15 34} 17. Qi5 {+1.82/8 32} i6
{+2.02/15 19} 18. exd5 {+0.87/9 30} Cxa7 {+2.47/15 33} 19. Qe1
{+0.49/10 29} Cb5 {+2.85/14 18} 20. Ri5 {+0.37/9 28} Rf8 {+2.76/14 18} 21.
Kg1 {+0.00/10 27} Cxb2 {+2.76/14 23} 22. Ng3 {+0.00/9 26} b6 {+2.88/14 18}
23. Rf5 {+0.00/10 25} Rf6 {+2.61/16 38} 24. Rg5 {+0.21/10 24} g6
{+2.92/15 26} 25. j4 {+0.24/9 23} Rd6 {+3.30/14 15} 26. Qf1 {+0.24/9 22} e6
{+3.27/15 27} 27. Re5 {+0.32/9 21} Nxd5 {+3.16/15 39} 28. Nd3 {+0.10/10 21}
Ca4 {+2.32/14 18} 29. Ne4 {+0.44/9 20} Rd7 {+2.16/15 13} 30. j5
{+0.54/8 19} Be7 {+2.43/14 15} 31. jxi6 {+0.43/9 18} jxi6 {+2.42/16 24} 32.
Rxe6 {+0.42/9 18} Rd8 {+2.44/15 22} 33. Re5 {+0.41/9 17} Rf8 {+2.35/14 12}
34. Qe1 {+0.45/9 16} Cd4 {+2.57/15 20} 35. Nef2 {+0.26/10 16} Bf6
{+2.56/16 24} 36. Re4 {+0.44/10 15} Cb3 {+2.54/15 13} 37. Qd1 {+0.48/9 15}
Cb5 {+2.44/15 25} 38. Kh1 {+0.40/9 14} Ra8 {+2.66/14 17} 39. Ki2
{+0.48/8 13} g5 {+2.55/12 10} 40. Rj4 {+0.60/8 13} Bg7 {+2.66/13 13} 41.
Rc4 {+0.52/9 12} Ra3 {+2.63/13 14} 42. Qg4 {+0.69/8 12} Cd6 {+2.36/14 9}
43. Rc1 {+0.60/9 12} Cf7 {+2.29/15 17} 44. Rj1 {+0.61/8 11} Bh8
{+2.40/13 11} 45. Qj4 {+0.72/8 11} Bi7 {+2.51/14 10} 46. Qe4 {+0.70/8 10}
Ce7 {+2.54/14 9} 47. Ne5 {+0.60/8 10} Ra5 {+2.01/14 13} 48. Nfg4
{+0.82/8 10} Nf4 {+1.90/14 13} 49. g3 {+0.77/8 9} Ng6 {+1.46/15 9} 50. d4
{+0.73/8 9} c5 {+1.22/15 14} 51. Qg2 {+0.78/8 9} Nxe5 {+1.96/15 20} 52.
dxe5 {+0.80/8 8} Ra7 {+1.19/14 14} 53. Rd1 {+0.82/7 8} Cc8 {+1.57/13 7} 54.
Qd5 {+0.85/7 8} Cb8 {+1.00/14 9} 55. Qd6 {+0.87/8 7} Ra8 {+0.28/15 13} 56.
Nh6+ {+1.74/8 7} Bxh6 {+0.44/16 11} 57. Qxh6 {+1.69/8 7} Cg8 {+0.40/15 14}
58. Qxb6 {+1.63/9 7} c4 {+0.46/14 15} 59. Qc6 {+1.77/8 6} Rc8 {+0.02/14 10}
60. Qe6 {+1.72/9 6} c3 {+0.16/14 7} 61. Qg4 {+1.63/9 6} c2 {+0.18/15 11}
62. Rc1 {+1.60/10 6} Ce8 {+0.05/13 5} 63. Qxg5 {+2.51/9 6} Ce6 {+0.86/14 7}
64. Qf5 {+2.49/9 5} Cc5 {+0.82/13 5} 65. h4 {+2.45/9 5} Kh8 {+0.83/12 6}
66. Qg5 {+2.56/8 5} Cc6 {-1.34/13 7} 67. Qf4 {+2.53/8 5} Ki8 {+0.75/12 9}
68. Rj1 {+2.69/8 5} Kh8 {-11.22/14 5} 69. Rj8+ {+8.03/7 5} Kg7
{-11.81/14 5} 70. Rxc8 {+8.14/8 4} Cxc8 {-14.03/17 25} 71. Qf6+
{+12.00/8 4} Kg8 {-14.38/18 10} 72. Qe6+ {+12.00/8 4} Kf8 {-18.10/17 7} 73.
Qxc8+ {+12.02/8 4} Ke7 {-21.22/17 12} 74. Qxc2 {+13.02/8 4} Ke6
{-21.70/17 12} 75. Qxh7 {+13.04/8 4} Kxe5 {-21.80/16 3} 76. Qxi6
{+13.05/9 4} Ke4 {-319.93/17 4} 77. Qe6+ {+13.05/8 4} Kd4 {-319.93/18 3}
78. Qd7+ {+13.05/9 4} Ke5 {-319.93/17 3} 79. Kh3 {+13.05/9 3} Ke4
{-319.94/19 4} 80. Qe7+ {+13.05/8 3} Kd4 {-319.93/17 4} 81. h5 {+22.02/9 3}
Kc3 {-319.94/19 4} 82. h6 {+22.09/8 3} Kd4 {-319.95/20 3} 83. h7
{+327.56/8 3} Kc3 {-319.96/28 2.8} 84. h8=Q+ {+327.60/7 3} Kc4
{-319.97/100 0.2} 85. Qb8 {+327.62/7 2.9} Kc3 {-319.98/100 0.1} 86. Qe3+
{+327.64/59 0.1} Kc4 {-319.99/100 0.1} 87. Qbb3# {+327.66/59 0.1}
{Xboard adjudication: Checkmate} 1-0
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Heretic 0.2

Post by mar »

hgm wrote:Great! This time Heretic (with bug) nailed Spartacus!
LOL. What a surprise! Spartacus is very strong so i guess Heretic was just lucky :)
Here is 0.2 (bugfixed): http://www.mediafire.com/?hmf7x1fv83vbo4p