🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #5219

Re: Flag.easy, thinking on opponents time

#5219
From: Chua Kong Sian
Date: Fri, 21 Jan 1994 05:42
281 lines
8587 bytes
Roger Uzun (uzun@crash.cts.com) wrote:
: In my tests with 4PL64, it seems the flag.easy, to enable/disable
: the computers thinking during the opponents time, is not very useful.
: It seems the searchs take about the same amount of tiime
: whther or not gnuchess was thinking about the opponents response
: or not.  Maybe it is a bug, or something I butchered,
: but is thinking on the opponents time real useful to 4PL64?

: Shouldn't gnuchess just save the move, and if it predicted
: it correctly and can live with the best score, and has
: enough ply, just make the move it was thinking about, 
: given that is guessed the opponents choice correctly.

: Can someone tell me if flag.easy does much to help UChess
: at all in 4PL64?  I do not think it does as it currently is
: implemented.

: -Roger
: --------------------------------------------------------------
: bix: ruzun
: NET: uzun@crash.cts.com

Below is my patch to fix this problem.  I *BELIEVE* it is correct, but
who knows :).  The idea here is that if the hint == player's move, then
we don't reset Sdepth to zero.  Instead, it is set to Sdepth--.  In search()
we skip all the initialization portion if Sdepth > 0.  I also append a
script to show that it works.


=====================cut here================================
*** dspcom.old	Tue Jan 18 11:06:56 1994
--- dspcom.c	Fri Jan 21 13:28:30 1994
***************
*** 987,993 ****
  #endif
  /* undo the hint and carry on */
  	    VerifyMove (s, 2, &mv);
! 	    Sdepth = 0;
  	  }
  	epsquare = tmp;
  	time0 = ft;
--- 988,996 ----
  #endif
  /* undo the hint and carry on */
  	    VerifyMove (s, 2, &mv);
! /*	    Sdepth = 0;*/
!             if (Sdepth > 0)
!               Sdepth--;
  	  }
  	epsquare = tmp;
  	time0 = ft;
***************
*** 1244,1250 ****
  #else
  	  ok = VerifyMove (s, 0, &mv);
  #endif
! 	  Sdepth = 0;
  	}
      }
  
--- 1247,1253 ----
  #else
  	  ok = VerifyMove (s, 0, &mv);
  #endif
! 	  if (hint != mv) Sdepth = 0; 
  	}
      }
  
*** search.old	Tue Jan 18 11:12:45 1994
--- search.c	Fri Jan 21 13:13:35 1994
***************
*** 29,34 ****
--- 29,35 ----
  unsigned short int PrVar[MAXDEPTH];
  extern char mvstr[4][6];
  extern short int recycle, ISZERO;
+ extern long EADD, EGET;
  #ifdef NULLMOVE
  short int null;			/* Null-move already made or not */
  short int PVari;		/* Is this the PV */
***************
*** 82,87 ****
--- 83,89 ----
        ptbl++;
      }
  
+   PV = SwagHt = ptbl->mv;
    /* rehash max rehash times */
    if ((ptbl->depth >= (short) depth))
      {
***************
*** 100,106 ****
  #endif /* HASHTEST */
  
  
-       PV = SwagHt = ptbl->mv;
  #ifndef BAREBONES
        HashCnt++;
  #endif
--- 102,107 ----
***************
*** 108,117 ****
  	{
  	  *score = ptbl->score;
  	  /* adjust *score so moves to mate is from root */
! 	  if (*score > 9000)
  	    *score -= ply;
  	  else if (*score < -9000)
! 	    *score += ply;
  	  *beta = -20000;
  	}
        else if (ptbl->flags & lowerbound)
--- 109,118 ----
  	{
  	  *score = ptbl->score;
  	  /* adjust *score so moves to mate is from root */
! /*	  if (*score > 9000)
  	    *score -= ply;
  	  else if (*score < -9000)
! 	    *score += ply;*/
  	  *beta = -20000;
  	}
        else if (ptbl->flags & lowerbound)
***************
*** 163,172 ****
    HashAdd++;
  #endif
    /* adjust score so moves to mate is from this ply */
!   if (score > 9000)
      score += ply;
    else if (score < -9000)
!     score -= ply;
    ptbl->hashbd = hashbd;
    ptbl->depth = (unsigned char) depth;
    ptbl->score = score;
--- 164,173 ----
    HashAdd++;
  #endif
    /* adjust score so moves to mate is from this ply */
! /*  if (score > 9000)
      score += ply;
    else if (score < -9000)
!     score -= ply;*/
    ptbl->hashbd = hashbd;
    ptbl->depth = (unsigned char) depth;
    ptbl->score = score;
***************
*** 410,416 ****
        else
  	TCcount = MAXTCCOUNTX;
      }
! 
    ExtraTime = 0;
    ExaminePosition ();
    score = ScorePosition (side);
--- 411,422 ----
        else
  	TCcount = MAXTCCOUNTX;
      }
!   
!   if (Sdepth > 0)
!     {
!       time0 = ft;
!       goto SS; 
!     }
    ExtraTime = 0;
    ExaminePosition ();
    score = ScorePosition (side);
***************
*** 454,459 ****
--- 460,467 ----
  	ResponseTime += ResponseTime;
      }
    /* zero stats for hash table */
+   ZeroTTable ();
+   EADD = EGET = 0;
    reminus = replus = 0;
    GenCnt = NodeCnt = ETnodes = EvalNodes = HashCnt = FHashAdd = HashAdd = FHashCnt = THashCol = HashCol = 0;
    globalscore = plyscore = score;
***************
*** 461,467 ****
--- 469,477 ----
    zwndw = 20;
  #include "debug4.h"
    /********************* main loop ********************************/
    Sdepth = (MaxSearchDepth < (MINDEPTH - 1)) ? MaxSearchDepth : (MINDEPTH - 1);
+ SS:
    while (!flag.timeout)
      {
        /* go down a level at a time */
===================cut here=========================


Here is the script of a test run.

Script started on Fri Jan 21 13:31:15 1994$ gnuchessr

Enter #moves #minutes: 40 15

White 15:00  Black 15:00

 R N B Q K B N R
 P P P P P P P P
 - - - - - - - -
 - - - - - - - -
 - - - - - - - -
 - - - - - - - -
 p p p p p p p p
 r n b q k b n r

Book used 0 of 250000 entries.
Warning can't find book.
Playing without hashfile

Your move is? hash

Your move is? beep

Your move is? post

Your move is? hard

Your move is? a4

Move# 1    Target= 1111    Clock: 90000
 2.     21    0      529   g8f6  g1f3  b8c6 
 3&     17    0     1084   g8f6  g1f3  b8c6  b1c3 
 3.     17    0     1549   g8f6  g1f3  b8c6  b1c3 
 4&     17    0     2664   g8f6  g1f3  b8c6  b1c3 
 4.     17    0    13919   g8f6  g1f3  b8c6  b1c3 
 5&     18    1    25778   g8f6  g1f3  b8c6  b1c3  e7e6 
 5.     18    2    38648   g8f6  g1f3  b8c6  b1c3  e7e6 
 6&     24    4    75803   g8f6  g1f3  b8c6  b1c3  d7d5  d2d4  e7e6 
 6.     24    8   159807   g8f6  g1f3  b8c6  b1c3  d7d5  d2d4  e7e6 
1. ... g8f6
Gen 344288 Node 159807 Tree 313 Eval 56171 Rate 19975 EC 32357/22526 RS hi 0 lo 0 
Hin/Hout/Tcol/Coll/Fin/Fout = 0/0/0/0/0/0
My move is: g8f6
Hint: g1f3

Your move is? Nf3
 5&     18    3    61958   b8c6  b1c3  e7e5  d2d4  e5e4 
 5.     18    4    82045   b8c6  b1c3  e7e5  d2d4  e5e4 
 6&     24    6   129029   b8c6  b1c3  e7e6  e2e3  f8b4  f1b5  b4c3  d2c3 
 6.     24   11   212060   b8c6  b1c3  e7e6  e2e3  f8b4  f1b5  b4c3  d2c3 
2. ... b8c6
Gen 457286 Node 212060 Tree 320 Eval 64139 Rate 19278 EC 38227/24486 RS hi 0 lo 0 
Hin/Hout/Tcol/Coll/Fin/Fout = 0/0/0/0/0/0
My move is: b8c6
Hint: b1c3

Your move is? g3

Move# 3    Target= 1143    Clock: 88011
 2.     46    0      920   e7e5  b1c3  d7d5 
 3&     39    0     1953   e7e5  d2d3  f8b4  c2c3 
 3.     39    0     2674   e7e5  d2d3  f8b4  c2c3 
 4&     50    0     6157   e7e5  d2d3  f8b4  c2c3  b4c5 
 4.     50    1    22692   e7e5  d2d3  f8b4  c2c3  b4c5 
 5&     40    2    44738   e7e5  d2d3  d7d5  c1g5  f8b4  c2c3 
 5.     40    3    65534   e7e5  d2d3  d7d5  c1g5  f8b4  c2c3 
 6&     50    7   149797   e7e5  b1c3  e5e4  f3g5  d7d5  d2d3  h7h6 
 6.     50   13   279007   e7e5  b1c3  e5e4  f3g5  d7d5  d2d3  h7h6 
3. ... e7e5
Gen 655586 Node 279007 Tree 354 Eval 61873 Rate 21462 EC 43097/17033 RS hi 0 lo 0 
Hin/Hout/Tcol/Coll/Fin/Fout = 0/0/0/0/0/0
My move is: e7e5
Hint: b1c3

Your move is? Nc3
 5&     58    6   158039   f8b4  f1g2  d7d5  e1g1  c8f5 
 5.     58    9   222037   f8b4  f1g2  d7d5  e1g1  c8f5 
4. ... f8b4
Gen 559794 Node 222037 Tree 354 Eval 28364 Rate 24670 EC 17581/8678 RS hi 0 lo 0 
Hin/Hout/Tcol/Coll/Fin/Fout = 0/0/0/0/0/0
My move is: f8b4
Hint: f1g2

Your move is? quit

script done on Fri Jan 21 13:32:21 1994
Technical Details
Message-ID: <2hnq0i$4n@nuscc.nus.sg>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!newsserver.jvnc.net!raffles.technet.sg!nuscc.nus.sg!nsrccks
References: <1994Jan19.015343.16152@crash>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,4757c9a8fb308931
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 1994-01-21 07:48:10 PST
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!newsserver.jvnc.net!raffles.technet.sg!nuscc.nus.sg!nsrccks
From: nsrccks@leonis.nus.sg (Chua Kong Sian)
Newsgroups: gnu.chess
Subject: Re: Flag.easy, thinking on opponents time
Date: 21 Jan 1994 05:42:42 GMT
Organization: National University of Singapore
Lines: 282
Message-ID: <2hnq0i$4n@nuscc.nus.sg>
References: <1994Jan19.015343.16152@crash>
NNTP-Posting-Host: leonis.nus.sg
X-Newsreader: TIN [version 1.2 PL0]