bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Re: Showing Moves


From: Joern Thyssen
Subject: Re: [Bug-gnubg] Re: Showing Moves
Date: Thu, 22 May 2003 08:11:45 +0000
User-agent: Mutt/1.4.1i

On Wed, May 21, 2003 at 10:52:49PM -0700, Rod Roark wrote
> On Tuesday 20 May 2003 07:18 am, Joern Thyssen wrote:
> > On Tue, May 20, 2003 at 07:06:46AM -0700, Rod Roark wrote
> >
> > > On Tuesday 20 May 2003 12:28 am, Joern Thyssen wrote:
> > > > ...
> > > > There is no code for resignations...
> > >
> > > That would be a problem.  Is there a workaround?
> >
> > Workaround no. 1: reject all resignations
> > Workaround no. 2: write code in external.c :-)
> 
> I don't mind taking a whack at this but know nothing about
> the internals of GnuBG.  Can you give me a clue as to which
> functions should be invoked to evaluate a resignation offer?

I can't remember the FIBS board in details, but I assume there is a flag
that indicates resignations? Probably, not...

If not, we may have to introduce some new command or something to
indicate resignations, e.g.,

resign normal board:.....

Anyway, the code to handle resignations can be found in play.c in the
subroutines ComputerTurn (10 or 20 lines down in ComputerTurn). Note
that this code only handles resignations for opponent on roll (e.g., it
does not handle (correctly)  resignations after dice is rolled, e.g.,
after a gammon-saving roll and it does not handle at all resignations
when the bot is on roll).

Further down in ComputerTurn you'll find code for determining whether
the bot should resign:

      /* Consider resigning -- no point wasting time over the decision,
         so only evaluate at 0 plies. */

      if( ClassifyPosition( ms.anBoard, ms.bgv ) <= CLASS_RACE ) {

          evalcontext ecResign = { FALSE, 0, 0, TRUE, 0.0 };
          evalsetup esResign;

          esResign.et = EVAL_EVAL;
          esResign.ec = ecResign;

          nResign = getResignation ( arResign, anBoardMove, &ci,
                                     &esResign );

          if ( nResign > 0 && nResign > ms.fResignationDeclined ) {

              fComputerDecision = TRUE;
              ach[ 0 ] = achResign[ nResign - 1 ];
              ach[ 1 ] = 0;
              CommandResign( ach );          
              fComputerDecision = FALSE;
              
              return 0;

          }
          
      }

Some variant of this code can be merged into external.c to make it
return "resign normal" (or whatever) instead of "roll".

Jørn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]