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: Øystein O Johansen
Subject: Re: [Bug-gnubg] Imported Jellyfish File Problem (File)
Date: Mon, 6 Jan 2003 18:09:25 +0100

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?

-Øystein


-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.





reply via email to

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