Computer Chess Club Archives


Search

Terms

Messages

Subject: Crafty draw code fixed...

Author: Mike Byrne

Date: 19:45:21 07/25/03

Go up one level in this thread


On July 25, 2003 at 21:16:55, Mike Byrne wrote:

>On July 25, 2003 at 20:30:47, Sune Fischer wrote:
>
>>On July 25, 2003 at 20:13:12, Mike Byrne wrote:
>>
>>>Since you can only claim draw on your move, make the 100 ply counter a 101 ply
>>>counter and this problem goes away (I think)...will test it in Crafty 19-04 SE
>>
>>But it introduces the other problem, that the engine won't see a draw until ply
>>101.
>>
>>Perhaps that is less of a bug, afterall you aren't required to claim a 50 move
>>draw.
>>
>>The only downside is that 50 move draws are far more frequent than mates on the
>>50th move.
>>
>>-S.
>
>true,
>Crafty's code reads as follows:
>
>if (Rule50Moves(0) > 99) return(2);
>
>so this works ,but it's not technically correct
>
>if (Rule50Moves(0) > 100) return(2);
>
>========================================================
>this works but it's 3 more lines and there are 2 other places where you would
>need this
>===================================================================
>if (Rule50Moves(0) > 99 && crafty_is_white && wtm) return(2);
>  else if (Rule50Moves(0) > 99 && !crafty_is_white && !wtm ) return(2);
>  else if (Rule50Moves(0) > 100 && crafty_is_white && !wtm) return(2);
>  else if (Rule50Moves(0) > 100 && !crafty_is_white && wtm) return(2);
>====================================================================
>of course this could probably be shortened quite a bit...
>this should work ....
>
>if (Rule50Moves(0) > 99 && (crafty_is_white + wtm == !1) return(2);
>else if (Rule50Moves(0) > 100) return(2);

the 50 move rule is really misnomer -- only one player may claim draw on his
50th move - the player that plays it's 50th move second ... the other player
must wait his 51st move before claiming draw, since he can only claim draw on
his move ..

tested the bottom above

if (Rule50Moves(0) > 99 && (crafty_is_white + wtm == !1) return(2);
else if (Rule50Moves(0) > 100) return(2);

and it works ...if crafty is white && wtm && ply>99 , then black has it's 50th
move (on the 99th ply) and its proper for crafty to claim draw om its 50th move.

if crafty is black and btm && ply > 99, then white has played it's 50th move and
it's proper for crafty to claim draw on its 50th move...

if it's  wtm and crafty is black, then crafty must wait until after white  plays
its 50th move before claim draw on its (black's) 51st move

if it'd btm and crafty is white, then crafty must wait until after black plays
its 50th before it may claim draw on its(white's) 51st move
============================================================================

before code fix, crafty plays losing Bd3 move

==============================

New game - Crafty 19.04 SE
[d]8/8/6p1/6k1/3p2P1/4b2Q/4Bq2/7K w - - 0 1

Analysis by Crafty 19.04 SE:

151.Bd3 Qf6
  =  (0.00)   Depth: 12   00:00:00  10kN
151.Bd3 Qf6
  =  (0.00)   Depth: 13   00:00:00  10kN
151.Bd3 Qf6
  =  (0.00)   Depth: 13   00:00:00  11kN
151.Bd3 Qf6
  =  (0.00)   Depth: 14   00:00:00  11kN
151.Bd3 Qf6
  =  (0.00)   Depth: 14   00:00:00  13kN
151.Bd3 Qf6
  =  (0.00)   Depth: 15   00:00:00  13kN
151.Bd3 Qf6
  =  (0.00)   Depth: 15   00:00:00  16kN
151.Bd3 Qf6
  =  (0.00)   Depth: 16   00:00:00  16kN
151.Bd3 Qf6
  =  (0.00)   Depth: 16   00:00:00  20kN
151.Bd3 Qf6
  =  (0.00)   Depth: 17   00:00:00  20kN
151.Bd3 Qf6
  =  (0.00)   Depth: 17   00:00:00  24kN
151.Bd3 Qf6
  =  (0.00)   Depth: 18   00:00:00  24kN
151.Bd3 Qf6
  =  (0.00)   Depth: 18   00:00:00  27kN
151.Bd3 Qf6
  =  (0.00)   Depth: 19   00:00:00  27kN
151.Bd3 Qf6
  =  (0.00)   Depth: 19   00:00:00  31kN
151.Bd3 Qf6
  =  (0.00)   Depth: 20   00:00:00  31kN
151.Bd3 Qf6
  =  (0.00)   Depth: 20   00:00:00  36kN
151.Bd3 Qf6
  =  (0.00)   Depth: 21   00:00:00  36kN
151.Bd3 Qf6
  =  (0.00)   Depth: 21   00:00:00  43kN
151.Bd3 Qf6
  =  (0.00)   Depth: 22   00:00:00  43kN
151.Bd3 Qf6
  =  (0.00)   Depth: 22   00:00:00  50kN
151.Bd3 Qf6
  =  (0.00)   Depth: 23   00:00:00  50kN
151.Bd3 Qf6
  =  (0.00)   Depth: 23   00:00:00  56kN
151.Bd3 Qf6
  =  (0.00)   Depth: 24   00:00:00  56kN
151.Bd3 Qf6
  =  (0.00)   Depth: 24   00:00:00  68kN
151.Bd3 Qf6
  =  (0.00)   Depth: 25   00:00:00  68kN
151.Bd3 Qf6
  =  (0.00)   Depth: 25   00:00:00  86kN
151.Bd3 Qf6
  =  (0.00)   Depth: 26   00:00:00  86kN
151.Bd3 Qf6
  =  (0.00)   Depth: 26   00:00:00  115kN
151.Bd3 Qf6
  =  (0.00)   Depth: 27   00:00:00  115kN
151.Bd3 Qf6
  =  (0.00)   Depth: 27   00:00:00  164kN
151.Bd3 Qf6
  =  (0.00)   Depth: 28   00:00:00  164kN
151.Bd3 Qf6
  =  (0.00)   Depth: 28   00:00:00  254kN
151.Bd3 Qf6
  =  (0.00)   Depth: 29   00:00:00  254kN
151.Bd3 Qf6
  =  (0.00)   Depth: 29   00:00:00  396kN
151.Bd3 Qf6
  =  (0.00)   Depth: 30   00:00:00  396kN
151.Bd3 Qf6
  =  (0.00)   Depth: 30   00:00:00  617kN
151.Bd3 Qf6
  =  (0.00)   Depth: 31   00:00:00  617kN
151.Bd3 Qf6
  =  (0.00)   Depth: 31   00:00:01  997kN
151.Bd3 Qf6
  =  (0.00)   Depth: 32   00:00:01  997kN
151.Bd3 Qf6
  =  (0.00)   Depth: 32   00:00:01  1658kN
151.Bd3 Qf6
  =  (0.00)   Depth: 33   00:00:01  1658kN
151.Bd3 Qf6
  =  (0.00)   Depth: 33   00:00:03  2803kN
151.Bd3 Qf6
  =  (0.00)   Depth: 34   00:00:03  2803kN
151.Bd3 Qf6
  =  (0.00)   Depth: 34   00:00:05  4759kN
151.Bd3 Qf6
  =  (0.00)   Depth: 35   00:00:05  4759kN
151.Bd3 Qf6
  =  (0.00)   Depth: 35   00:00:08  8217kN
151.Bd3 Qf6
  =  (0.00)   Depth: 36   00:00:08  8217kN
151.Bd3 Qf6
  =  (0.00)   Depth: 36   00:00:16  15386kN
151.Bd3 Qf6
  =  (0.00)   Depth: 37   00:00:16  15386kN
151.Bd3 Qf6
  =  (0.00)   Depth: 37   00:00:33  31665kN
151.Bd3 Qf6
  =  (0.00)   Depth: 38   00:00:33  31665kN
151.Bd3 Qf6
  =  (0.00)   Depth: 38   00:01:11  65360kN
151.Bd3 Qf6
  =  (0.00)   Depth: 39   00:01:11  65360kN

(Byrne, Secane, PA USA 25.07.2002)

====================================================

after code fix - replacing

if (Rule50Moves(ply) > 99  return(1);
 in repeat.c in two places

 with this

if (Rule50Moves(ply) > 99 && (crafty_is_white + wtm == !1)) return(1);
  else if (Rule50Moves(ply) > 100) return(1);

and replacing

if (Rule50Moves(0) > 99  return(1);

with this

if (Rule50Moves(0) > 99 && (crafty_is_white + wtm == !1)) return(1);
  else if (Rule50Moves(0) > 100) return(1);

crafty no longer plays Bd3 and plays Qg2! which will secure the draw, but the
capture Qxg2, if played, resets Rule50Moves to zero and the game goes on :)

========================================================================

New game - Crafty 19.04 SE
8/8/6p1/6k1/3p2P1/4b2Q/4Bq2/7K w - - 0 1

Analysis by Crafty 19.04 SE:

151.Bd3 Qg1#
  -+  (-#1)   Depth: 2   00:00:00
151.Qh5+ gxh5 152.gxh5 Qxe2
  -+  (-12.92)   Depth: 2   00:00:00
151.Qxe3+ dxe3 152.Bd3
  -+  (-9.25)   Depth: 2   00:00:00
151.Qf1 Qg3
  -+  (-2.31)   Depth: 2   00:00:00
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2
  ³  (-0.59)   Depth: 7   00:00:00  10kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2
  ³  (-0.59)   Depth: 7   00:00:00  17kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2 Ke5
  ³  (-0.60)   Depth: 8   00:00:00  19kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2 Ke5
  ³  (-0.60)   Depth: 8   00:00:00  34kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2 Bc3 156.Ke2
  ³  (-0.57)   Depth: 9   00:00:00  38kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2 Bc3 156.Ke2
  ³  (-0.57)   Depth: 9   00:00:00  47kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2 Bc3 156.Ke2 Ke5
  ³  (-0.57)   Depth: 10   00:00:00  55kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bd2 155.Kf2 Bc3 156.Ke2 Ke5
  ³  (-0.57)   Depth: 10   00:00:00  72kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3
  ³  (-0.52)   Depth: 11   00:00:00  94kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3
  ³  (-0.52)   Depth: 11   00:00:00  120kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bc1 155.Kf2 Ke5 156.Kf3 Bf4
157.Bd3 Kd5
  ³  (-0.53)   Depth: 12   00:00:00  166kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Bc1 155.Kf2 Ke5 156.Kf3 Bf4
157.Bd3 Kd5
  ³  (-0.53)   Depth: 12   00:00:00  288kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Ke6
157.Ke2 Kd5 158.Kf3
  ³  (-0.52)   Depth: 13   00:00:00  401kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Ke6
157.Ke2 Kd5 158.Kf3
  ³  (-0.52)   Depth: 13   00:00:00  503kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bf4
  ³  (-0.53)   Depth: 14   00:00:00  716kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bf4
  ³  (-0.53)   Depth: 14   00:00:01  977kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bf4 159.Kf3
  ³  (-0.50)   Depth: 15   00:00:01  1443kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bf4 159.Kf3
  ³  (-0.50)   Depth: 15   00:00:01  1818kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bf4 159.Kf3
  ³  (-0.50)   Depth: 16   00:00:02  2548kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bf4 159.Kf3
  ³  (-0.50)   Depth: 16   00:00:03  3238kN
151.Qg2 Qxg2+ 152.Kxg2 Kf4 153.Bd3 g5 154.Bf5 Ke5 155.Bd3 Bf4 156.Kf2 Kd5
157.Kf3 Be5 158.Ke2 Bg3 159.Kd2 Bf4+ 160.Ke2 Bg3
  ³  (-0.51)   Depth: 17   00:00:05  4974kN

(Byrne, Secane, PA USA 25.07.2002)



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.