A bug in Crafty 20.14?

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

A bug in Crafty 20.14?

Postby Ilari Pihlajisto » 15 Oct 2007, 21:14

I just had Sloppy play a 100 blitz games against Crafty, and found this game interesting:
Code: Select all
[Date "2007.10.15"]
[White "Crafty-20.14"]
[Black "Sloppy"]
[Result "1/2-1/2"]

1. e4 d6 {book} 2. d4 Nf6 {book} 3. Nc3 g6 {book}
4. Nf3 Bg7 {book} 5. Be2 O-O {book} 6. O-O c6 {book}
7. Bf4 Na6 {+0.87} 8. e5 Nh5 {+0.74} 9. Be3 Nb4 {+0.68}
10. a3 Nd5 {+0.80} 11. Nxd5 cxd5 {+0.54} 12. c4 Qb6 {+0.58}
13. b4 dxc4 {+0.68} 14. Bxc4 Bf5 {+0.75} 15. Nh4 Bc8 {+0.91}
16. g4 dxe5 {+0.84} 17. gxh5 exd4 {+0.81} 18. Bd2 Bh3 {+0.63}
19. hxg6 hxg6 {+0.93} 20. Re1 Qf6 {+1.00} 21. Nf3 Rac8 {+1.10}
22. Rc1 Bg4 {+1.07} 23. Bd5 Rxc1 {+1.08} 24. Bxc1 Qb6 {+0.97}
25. Qd2 Qb5 {+0.97} 26. Be4 e5 {+0.83} 27. Qg5 Bd7 {+1.06}
28. Qg3 b6 {+0.98} 29. Bd2 Re8 {+1.59} 30. Ng5 Bf6 {+1.59}
31. Qf3 Kg7 {+1.71} 32. Bd3 Qc6 {+1.50} 33. Ne4 Bh4 {+1.06}
34. Rc1 Qb7 {+1.14} 35. Qe2 Qb8 {+1.20} 36. Ba6 f5 {+0.97}
37. Ng3 Qd6 {+0.56} 38. Qc4 Be6 {+0.52} 39. Qf1 Rh8 {+0.47}
40. Qg2 e4 {+0.49} 41. Bb7 Bf6 {+0.22} 42. Rc6 Qe7 {+0.71}
43. b5 Be5 {-0.09} 44. Bb4 Qf7 {-0.25} 45. a4 d3 {-0.25}
46. Bd2 Bd7 {-0.72} 47. Rc1 Qa2 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 Kf5 {0.00} 102. Rg1 Ke6 {+9.17}
103. Nh8 Kd5 {+9.17} 104. Nf7 Ke6 {0.00} 105. Nh8 Kd5 {0.00}
106. Rd1+ Ke4 {+9.20} 107. Nf7 Kf3 {+9.22} 108. Nh8 Ke4 {0.00}
109. Nf7 Kf3 {0.00} 110. Ne5+ Ke4 {+9.25} 111. Nd7 Kf5 {+9.28}
112. Nf8 Ke5 {+9.28} 113. Nh7 Kf5 {+9.26} 114. Nf8 Ke5 {0.00}
115. Nh7 Kf5 {0.00} 116. Rf1+ Ke5 {+9.27} 117. Nf8 Ke4 {+9.28}
118. Nh7 Ke5 {0.00} 119. Nf8 Ke4 {0.00} 120. Ng6 Kd3 {+9.30}
121. Nh8 Ke3 {+9.17} 122. Nf7 Ke2 {+9.29} 123. Rf6 Ke3 {+9.30}
124. Nh8 Ke4 {+9.30} 125. Nf7 Ke3 {0.00} 126. Nh8 Ke4 {0.00}
127. Ka7 Ke5 {+9.28} 128. Rf8 Kd5 {+9.30} 129. Nf7 Ke4 {+9.28}
130. Nh8 Kd5 {0.00} 131. Nf7 Ke4 {0.00} 132. Nh8 Kd5 {0.00} 1/2-1/2


Crafty should have a super-easy win at the end, but instead lets the game end in a 3-fold repetition (called by Sloppy). Is this a bug in Crafty, or did Sloppy call the draw too early, or is it something else I don't understand? The rest of the games seemed to be okay.

I'm using the 64-bit version of Ubuntu 7.04, and the Crafty build is from the Ubuntu repositories.[/code]
User avatar
Ilari Pihlajisto
 
Posts: 78
Joined: 18 Jul 2005, 06:58

Re: A bug in Crafty 20.14?

Postby Guenther Simon » 15 Oct 2007, 23:20

Ilari Pihlajisto wrote:I just had Sloppy play a 100 blitz games against Crafty, and found this game interesting:
Code: Select all
[Date "2007.10.15"]
[White "Crafty-20.14"]
[Black "Sloppy"]
[Result "1/2-1/2"]
...
128. Rf8 Kd5 {+9.30} 129. Nf7 Ke4 {+9.28}
130. Nh8 Kd5 {0.00} 131. Nf7 Ke4 {0.00} 132. Nh8 Kd5 {0.00} 1/2-1/2


Crafty should have a super-easy win at the end, but instead lets the game end in a 3-fold repetition (called by Sloppy). Is this a bug in Crafty, or did Sloppy call the draw too early, or is it something else I don't understand? The rest of the games seemed to be okay.

I'm using the 64-bit version of Ubuntu 7.04, and the Crafty build is from the Ubuntu repositories.[/code]


It is a correct 3 time repetition. I assume you played this game
without tablebases, which means Crafty cannot win this
without TB, because of either a bug or a compilation error.
You should post that game in CCC too, in case Robert Hyatt
doesn't answer here in the next time.
I will test if the Crafty version I have would do the same without
TB tomorrow, now it is a bit too late for me.

Regards,
Guenther
User avatar
Guenther Simon
 
Posts: 794
Joined: 26 Sep 2004, 19:49
Location: Regensburg, Germany

Re: A bug in Crafty 20.14?

Postby Ilari Pihlajisto » 16 Oct 2007, 00:11

I assume you played this game
without tablebases


Yup, here's what Crafty says when I run it:
Code: Select all
Machine is NUMA, 1 nodes (2 cpus/node)

hash table memory =   12M bytes.
pawn hash table memory =    2M bytes.
show book statistics
EGTB access enabled
using tbpath=/var/lib/crafty/TB
0 piece tablebase files found
parallel threads disabled.


Crafty v20.14 (1 cpus)


It's the amd64 package from here: http://archive.ubuntu.com/ubuntu/pool/m ... /c/crafty/

The time control was 40 moves in 1 minute. Thankfully the bug is really easy to reproduce (on my machine): all I have to do is use this starting position and Crafty won't be able to force a win, unless he sacrifices the knight: 5R1N/K7/8/3k4/8/8/8/8 w - - 0 131
[diag]5R1N/K7/8/3k4/8/8/8/8 w - -[/diag]



You should post that game in CCC too, in case Robert Hyatt
doesn't answer here in the next time.


Doesn't he post here somewhat frequently under the name "bob"?
User avatar
Ilari Pihlajisto
 
Posts: 78
Joined: 18 Jul 2005, 06:58

Re: A bug in Crafty 20.14?

Postby Guenther Simon » 16 Oct 2007, 06:15

Ilari Pihlajisto wrote:5R1N/K7/8/3k4/8/8/8/8 w - -


Great that it was so easy to reproduce!


You should post that game in CCC too, in case Robert Hyatt
doesn't answer here in the next time.


Ilari Pihlajisto wrote:Doesn't he post here somewhat frequently under the name "bob"?


Yes, but currently he posts _permanently_ in CCC ;-)

Guenther
User avatar
Guenther Simon
 
Posts: 794
Joined: 26 Sep 2004, 19:49
Location: Regensburg, Germany

Re: A bug in Crafty 20.14?

Postby Ilari Pihlajisto » 16 Oct 2007, 09:14

Okay, let's post this at Talkchess.com...
User avatar
Ilari Pihlajisto
 
Posts: 78
Joined: 18 Jul 2005, 06:58

Re: A bug in Crafty 20.14?

Postby Volker Pittlik » 16 Oct 2007, 11:02

Ilari Pihlajisto wrote:Okay, let's post this at Talkchess.com...


The best idea is to post it into the programming forums. I can move the thread here if you like.
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: A bug in Crafty 20.14?

Postby Pradu » 16 Oct 2007, 11:28

Ilari Pihlajisto wrote:Okay, let's post this at Talkchess.com...
Why don't you just email him?
User avatar
Pradu
 
Posts: 343
Joined: 12 Jan 2005, 19:17
Location: Chandler, Arizona, USA

Re: A bug in Crafty 20.14?

Postby Ilari Pihlajisto » 16 Oct 2007, 12:22

Volker Pittlik wrote:The best idea is to post it into the programming forums. I can move the thread here if you like.


Sure, you may move this.

Why don't you just email him?


Because I know Hyatt frequents these forums, and because there may be people other than him who can help fix this problem.
User avatar
Ilari Pihlajisto
 
Posts: 78
Joined: 18 Jul 2005, 06:58

Re: A bug in Crafty 20.14?

Postby bob » 16 Oct 2007, 21:18

Ilari Pihlajisto wrote:
I assume you played this game
without tablebases


Yup, here's what Crafty says when I run it:
Code: Select all
Machine is NUMA, 1 nodes (2 cpus/node)

hash table memory =   12M bytes.
pawn hash table memory =    2M bytes.
show book statistics
EGTB access enabled
using tbpath=/var/lib/crafty/TB
0 piece tablebase files found
parallel threads disabled.


Crafty v20.14 (1 cpus)


It's the amd64 package from here: http://archive.ubuntu.com/ubuntu/pool/m ... /c/crafty/

The time control was 40 moves in 1 minute. Thankfully the bug is really easy to reproduce (on my machine): all I have to do is use this starting position and Crafty won't be able to force a win, unless he sacrifices the knight: 5R1N/K7/8/3k4/8/8/8/8 w - - 0 131
[diag]5R1N/K7/8/3k4/8/8/8/8 w - -[/diag]



You should post that game in CCC too, in case Robert Hyatt
doesn't answer here in the next time.


Doesn't he post here somewhat frequently under the name "bob"?


I'll look at that version, but current versions win that easily. May well be some sort of bug in 20.14 I am unaware of... I don't recall ever KRN vs K, but it easily wins KR vs K with a special non-pawn evaluation function.
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59

Re: A bug in Crafty 20.14?

Postby Ilari Pihlajisto » 16 Oct 2007, 21:36

bob wrote:I'll look at that version, but current versions win that easily. May well be some sort of bug in 20.14 I am unaware of... I don't recall ever KRN vs K, but it easily wins KR vs K with a special non-pawn evaluation function.


Yeah, there's no problem with KR vs K, just KRN vs K.
User avatar
Ilari Pihlajisto
 
Posts: 78
Joined: 18 Jul 2005, 06:58

Re: A bug in Crafty 20.14?

Postby bob » 17 Oct 2007, 03:22

Ilari Pihlajisto wrote:
bob wrote:I'll look at that version, but current versions win that easily. May well be some sort of bug in 20.14 I am unaware of... I don't recall ever KRN vs K, but it easily wins KR vs K with a special non-pawn evaluation function.


Yeah, there's no problem with KR vs K, just KRN vs K.


Actually there is a big problem, not sure where it was introduced. If you have the source, at the top of EvaluateMate() (which is in file evaluate.c) you will see a line like "int mate_score - DrawScore(1);

change it to
int mate_score = 0.

That will fix the problem completely...

We are fixing to release 21.6, probably in two weeks after the ACCA tournament, it will have this fix in...
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59

Re: A bug in Crafty 20.14?

Postby Ilari Pihlajisto » 17 Oct 2007, 09:10

bob wrote:
Ilari Pihlajisto wrote:Yeah, there's no problem with KR vs K, just KRN vs K.

Actually there is a big problem


Oh, I just didn't notice it because Crafty finds the mate so quickly in KR vs K.

Anyway, I'm glad you got this bug fixed :D
User avatar
Ilari Pihlajisto
 
Posts: 78
Joined: 18 Jul 2005, 06:58

Re: A bug in Crafty 20.14?

Postby bob » 17 Oct 2007, 15:09

Ilari Pihlajisto wrote:
bob wrote:
Ilari Pihlajisto wrote:Yeah, there's no problem with KR vs K, just KRN vs K.

Actually there is a big problem


Oh, I just didn't notice it because Crafty finds the mate so quickly in KR vs K.

Anyway, I'm glad you got this bug fixed :D


In KR vs K crafty can probably find the mate from any starting position. But to see the bug, do "sd=4" and it will waffle around. The fix will let it win even with sd=4...

I discovered the bug by trying KQ vs KR, giving normal crafty (no egtb) the KQ side and 1 sec/move. Losing side was crafty using egtbs. Program had no chance there. With the fix, it wins easily as it should even without egtbs...

Still have not figured out where that bug came from and why...
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 10 guests

cron