🕸Fergus Duniho wrote on Wed, Dec 27, 2017 04:53 PM UTC:
Greg,
I fixed Game Courier to auto-correct that log. Although it worked well when a player made his move, it got confused when someone viewed a finished game. The code in that circumstance was not complex enough to tell who had won. To tell who was playing when the won command was used, I changed the code to
This first checks whether the move number was odd. It should be odd for the first player, and it should be even for the second. It then xors this with the inequality of the current side and the first side to move. This inequality should be true for the second player and false for the second. So, it determines the winner like this:
Greg,
I fixed Game Courier to auto-correct that log. Although it worked well when a player made his move, it got confused when someone viewed a finished game. The code in that circumstance was not complex enough to tell who had won. To tell who was playing when the won command was used, I changed the code to
$GLOBALS["winner"] = (($movenum & 1) ^ ($side != $first)) ? $player : $opponent;
This first checks whether the move number was odd. It should be odd for the first player, and it should be even for the second. It then xors this with the inequality of the current side and the first side to move. This inequality should be true for the second player and false for the second. So, it determines the winner like this: