Exemplo n.º 1
1
 def board_size_change(self, widget, size):
     self.lastY = -1
     self.lastX = -1
     if size == self.size:
         return
     self.size = size
     del self.game
     self.game = GoGame(size)
     self.board_aspect.remove(self.board)
     del self.board
     self.board = boardwidget.GoBoardWidget(self.game.get_status(), int(size))
     self.board_aspect.add(self.board)
     self.board.connect('motion-notify-event', self.board_motion_cb)
     self.board.connect('insert-requested', self.insert_cb)
     self.board.show()
     if self.ai_activated:
         del self.ai
         self.ai = gnugo(boardsize=self.size)
Exemplo n.º 2
1
 def ai_activated_cb(self, widget=None):
     try:
         self.ai = gnugo(boardsize=self.size)
     except Exception, e:
         self._alert(_('AI'), _('GnuGo loading failed!: %s' % e))
         self.gameToolbar.set_ai_button_state(False)
Exemplo n.º 3
0
    def ai_activated_cb(self, widget=None):
        try:
            self.ai = gnugo(boardsize=self.size)
        except Exception as e:
            self._alert(_('AI'), _('GnuGo loading failed!: %s' % e))
            self.gameToolbar.set_ai_button_state(False)

        else:
            self.ai_activated = True
            for pos, color, captures in self.game.undostack:
                self.notify_ai(pos[0], pos[1], color)

            self._alert(_('AI'), _('PlayGo AI Activated'))
Exemplo n.º 4
0
 def board_size_change(self, widget, size):
     self.lastY = -1
     self.lastX = -1
     if size == self.size:
         return
     self.size = size
     del self.game
     self.game = GoGame(size)
     self.board_aspect.remove(self.board)
     del self.board
     self.board = boardwidget.GoBoardWidget(self.game.get_status(),
                                            int(size))
     self.board_aspect.add(self.board)
     self.board.connect('motion-notify-event', self.board_motion_cb)
     self.board.connect('insert-requested', self.insert_cb)
     self.board.show()
     if self.ai_activated:
         del self.ai
         self.ai = gnugo(boardsize=self.size)
Exemplo n.º 5
0
 def ai_activated_cb(self, widget=None):
     try:
         self.ai = gnugo(boardsize=self.size)
     except Exception, e:
         self._alert(_('AI'), _('GnuGo loading failed!: %s' % e))
         self.gameToolbar.set_ai_button_state(False)