🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #5217

Help needed on mods to SelectMove

#5217
From: Roger Uzun
Date: Thu, 20 Jan 1994 20:14
101 lines
3066 bytes
I am trying to get gnuchess to pick a precalculated move and
hint immediately upon entering SelectMove, much like it would
pick a book move now.

I am having trouble finding what the last precalced move and hint
were.  I want to save off the last precalced move
and hint, in the if (iop == 2) section when you
are out of the main loop of SelectMove, I am trying as follows:

  if (iop == 2)
   {
    if (!flag.easy)
     {
#ifdef SPEED_PRECALC
      PreCalcedMove = (Tree[0].f << 8) | (Tree[0].t);
      PreCalcedHint = ((PrVar[1]) ? PrVar[2] : 0);
#endif
     }
    return;
   }

Apparently Tree[0] is not the last "best" move and I cannot get the
hint from PrVar[2] either....
Does anyone know how I would pick up the best move and next hint,
so that in the event that the user chooses the move I was
calculating on, I can quickly just make the move I precalculated?

Here is some code I put in right after the call to OpeningBook in
SelectMove, to see if I want to pick up the last precalculated move.

  /* can I get a book move? */
  if (flag.regularstart && Book)
    {
      flag.timeout = bookflag = OpeningBook (&hint, side);
      if (TCflag)
	ResponseTime += ResponseTime;
    }
#ifdef SPEED_PRECALC
  if ((!flag.timeout)&&(ThinkAheadWorked)) // I set thinkaheadworked's state
					   // elsewhere in the pgm
   {
    flag.timeout = DoPreCalc(&hint,side);
   }
#endif
  /* zero stats for hash table */
  reminus = replus = 0;

The function DoPreCalc looks like:

#ifdef SPEED_PRECALC

int
DoPreCalc (unsigned INTSIZE *hint, INTSIZE int side)
     
{
  INTSIZE pnt;
  unsigned INTSIZE m;

  int fnd=0;

  /* if only one just do it */
  m = PreCalcedMove;
  /* make sure the move is in the MoveList */
  for (pnt = TrPnt[1]; pnt < TrPnt[2]; pnt++)
    {
      if (((Tree[pnt].f << 8) | Tree[pnt].t) == m)
	{
	  Tree[pnt].score = 0;
          fnd = 1;
	  break;
	}
    }
  if (!fnd)
   return(false);
#ifdef NEED_CHECK
  /* Make sure its the best */

  pick (TrPnt[1], TrPnt[2] - 1);
  if (Tree[TrPnt[1]].score)
    {
      /* no! */
      return false;
    }
#endif
  /* ok pick up the hint and go */
  *hint = PreCalcedHint;
  return true;
}
#endif


Can someone tell me a better way, or help me out in fixing
this method of trying to better use the precalculated
moves that gnuchess comes up with when flag.easy = false??


-Roger
--------------------------------------------------------------
bix: ruzun
NET: uzun@crash.cts.com
Technical Details
Message-ID: <1994Jan20.121441.19836@crash>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!uunet!news.sprintlink.net!crash!uzun

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,d2cd328210d28149,start
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 1994-01-21 01:31:59 PST
Newsgroups: gnu.chess
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!uunet!news.sprintlink.net!crash!uzun
From: uzun@crash.cts.com (Roger Uzun)
Subject: Help needed on mods to SelectMove
Organization: CTS Network Services (CTSNET/crash), San Diego, CA
Date: 20 Jan 94 12:14:41 PST
Message-ID: <1994Jan20.121441.19836@crash>
Lines: 101