fowode / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

Autoflag bug in Human-Human games #814

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If autoflag is on in a Human-Human game and one side is reaching 0 time, the 
following message appears:

The flag call returns an error
"Your opponent is not out of time."

Original issue reported on code.google.com by gbtami on 8 Sep 2013 at 2:30

GoogleCodeExporter commented 9 years ago
This issue is caused by this code from offerRecieved in GameModel.py:

        elif offer.type == FLAG_CALL:
            assert self.timed
            if self.timemodel.getPlayerTime(player.color) <= 0:
                if self.timemodel.getPlayerTime(1-player.color) <= 0:
                    self.end(DRAW, DRAW_CALLFLAG)
                elif not playerHasMatingMaterial(self.boards[-1], 1-player.color):
                    if player.color == WHITE:
                        self.end(DRAW, DRAW_BLACKINSUFFICIENTANDWHITETIME)
                    else:
                        self.end(DRAW, DRAW_WHITEINSUFFICIENTANDBLACKTIME)
                else:
                    if player == self.players[BLACK]:
                        self.end(WHITEWON, WON_CALLFLAG)
                    else:
                        self.end(BLACKWON, WON_CALLFLAG)
            else:
                player.offerError(offer, ACTION_ERROR_NOT_OUT_OF_TIME)

I changed this and tested it.
I attached the patch and a list of the tests I did.

Original comment by jcheetham19 on 10 Aug 2014 at 8:11

Attachments:

GoogleCodeExporter commented 9 years ago
Applied, thx!

Original comment by gbtami on 10 Aug 2014 at 8:54

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 3353baa05b29.

Original comment by gbtami on 10 Aug 2014 at 8:55