[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pbmserv-dev] bg UNDO bug - possible solution?
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