示例#1
0
    def _update_menu_draw (self):
        self.menuitems["draw"].sensitive = self.gamemodel.status in UNFINISHED_STATES \
            and not self.gamemodel.isObservationGame()

        def can_win (color):
            if self.gamemodel.timed:
                return playerHasMatingMaterial(self.gamemodel.boards[-1], color) and \
                    self.gamemodel.timemodel.getPlayerTime(color) > 0
            else:
                return playerHasMatingMaterial(self.gamemodel.boards[-1], color)
        if isClaimableDraw(self.gamemodel.boards[-1]) or not \
                (can_win(self.gamemodel.players[0].color) or \
                 can_win(self.gamemodel.players[1].color)):
            self.menuitems["draw"].label = _("Claim Draw")
示例#2
0
 def _update_menu_draw (self):
     self.menuitems["draw"].sensitive = self.gamemodel.status in UNFINISHED_STATES \
         and not self.gamemodel.isObservationGame()
     
     def can_win (color):
         if self.gamemodel.timed:
             return playerHasMatingMaterial(self.gamemodel.boards[-1], color) and \
                 self.gamemodel.timemodel.getPlayerTime(color) > 0
         else:
             return playerHasMatingMaterial(self.gamemodel.boards[-1], color)
     if isClaimableDraw(self.gamemodel.boards[-1]) or not \
             (can_win(self.gamemodel.players[0].color) or \
              can_win(self.gamemodel.players[1].color)):
         self.menuitems["draw"].label = _("Claim Draw")