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

Re: [pbmserv-dev] bg UNDO bug - possible solution?



The bg undo bug is intentional.

You do not want someone to be able to make a move...

see what their opponent rolls in reponse

and then request an undo because they know a better move
they can make because they now know what the next roll is.

So, I intentionally do no decrement the roll count during an undo
in order to force a new roll when the undo is done, and the move
is applied.


On Thu, May 01, 2003 at 10:25:52AM -0500, Douglas Zander wrote:
> Hello all, with the upcoming bg tourney I thought I would take one
> last look at the bg engine and see if I can fix that UNDO bug.
> The UNDO bug is that after a move is taken back (UNDO'ed) the roll 
> of the dice are not the same as before.  I believe that the problem
> is *not* in the backgammon module!  It is actually in the game.cpp
> module!  I have found that when a player makes a challenge the routine
> Game::Challenge  calls PrepareMove() before ending. 
> Yet when an UNDO is accepted and regenerating is done,
> the ::Regenerate routine never calls the PrepareMove routine.  This has
> the effect of not properly setting the variable "eksfirst" (if it was
> set then it fails to get set after an UNDO and the players will switch
> colors!)  and I believe it might have some effect on the rolls of the 
> dice or the random number used to keep track of the dice rolls.  
> You see, what I also found out was that when I ran the program the
> first new roll was always the same as the very first roll.  Why is this?
> I believe that the first new roll after an UNDO is the same as the very
> first roll because the program thinks that it is starting over fresh with
> the new random number.  Any suggestions?  I believe for one thing we may
> need to change Game::Regenerate to look more like the Game::Challenge
> since that is in fact what it is doing anyways.  I wonder if anyone can
> think of any other game on the server that uses PrepareMove() in the
> game's module.  I would bet that it also may have a hard time with the
> UNDO command. 
> 
> -- 
>  Douglas Zander
> 
> 
> 
> To unsubscribe, send a message to esquire@gamerz.net with
> 	unsubscribe pbmserv-dev@gamerz.net
> as the BODY of the message.  The SUBJECT is ignored.
> 

-- 
 /  \__  | Richard Rognlie / Oracle Prophet / Gamerz.NET Lackey
 \__/  \ | http://www.gamerz.net/rrognlie/    <rrognlie@gamerz.net>
 /  \__/ | Today is the first day of the rest of your life.  Of course,
 \__/    |    so was yesterday, and look how you screwed *that* up...