bug-gnubg
[Top][All Lists]
Advanced

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

Re: [Bug-gnubg] Imported Jellyfish File Problem (File)


From: Jim Segrave
Subject: Re: [Bug-gnubg] Imported Jellyfish File Problem (File)
Date: Wed, 8 Jan 2003 08:08:46 +0100
User-agent: Mutt/1.2.5.1i

On Mon 06 Jan 2003 (18:09 +0100), Øystein O Johansen wrote:
> 
> I can see what happens here, but I have not found a solution, yet.
> 
> static int
> ApplySubMove( int anBoard[ 2 ][ 25 ],
>               const int iSrc, const int nRoll,
>               const int fCheckLegal ) {
> 
>     int iDest = iSrc - nRoll;
> 
>     if( fCheckLegal && ( nRoll < 1 || nRoll > 6 ) ) {
>      /* Invalid dice roll */
>      errno = EINVAL;
>      return -1;
>     }
> 
> In ApplySubMove in eval.c, the above check returns -1. ApplySubMove was
> called from ApplyMove which again was called from IsValidMove in import.c.
> In the first appearence, 55: 13/3 13/3, the call to IsValidMove from
> ParMatMove is called with a anMove array of {12, 2, 12, 2, -1,-1 ,0,  0}
> (Yes, c = 2). This is a perfectly legal move. IsValidMove takes the same
> array (actually a mem copied array) to ApplyMove. From ApplyMove to
> ApplySubMove is then called with the integer numbers ApplySubMove( anBoard,
> 12, 12 - 2, TRUE);. Twelve minus two equals ten. This will in the above
> check think that one of the dice was 10, which is outside the legal range 1
> to 6.
> 
> Can anyone think of a neat way to solve this simple problem?

The correct place to fix it would be in ParseMove(), since this would
address the same problem in a lot of different formats, but it looks
like a much harder routine to adapt.

ParseMatMove () could examine the results from ParseMove() and
re-build the anMove array if need be, incrementing the move count. It
has the dice values available, so it should be able to check that the
moves returned by ParseMove() match.

-- 
Jim Segrave           address@hidden





reply via email to

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