Logo Search packages:      
Sourcecode: uligo version File versions  Download package

def uligo::App::nextMoveReplay (   self,
  p 
)

React to mouse-click, in 'normal mode', i.e. answering a problem
    (as opposed to 'show solution' or 'try variation' mode). 

Definition at line 1305 of file uligo.py.

01305                                :
        """ React to mouse-click, in 'normal mode', i.e. answering a problem
            (as opposed to 'show solution' or 'try variation' mode). """

        self.board.play(p)  # put the stone on the board
        x, y = p

        if self.inputColor == 'B':
            nM = 'B'
            nnM = 'W'
        else:
            nM = 'W'
            nnM = 'B'

        nnMove = self.board.invert(self.inputColor)
       
        # look for the move in the SGF file

        try:
            done = 0 
            
            c = self.cursor.next(0)
            if c.has_key(nM): right_pos = self.convCoord(c[nM][0])
            if c.has_key(nM) and self.convCoord(c[nM][0], self.orientation)==(x,y): # found the move
                done = 1
                self.guessSuccess()
                if self.options.modeVarGM.get() in ['B', 'W'] and not self.cursor.atEnd: # respond to the move
                    self.board.update_idletasks()
                    time.sleep(0.3 * self.options.replaySpeedVar.get() + 0.3)
                    c = self.cursor.next()
                    pos = self.convCoord(c[nnM][0], self.orientation)
                    self.board.play(pos, nnMove)
                    self.noMovesMade = self.noMovesMade + 2
                else:
                    self.noMovesMade = self.noMovesMade + 1
                    self.inputColor = self.board.invert(self.inputColor)
                if self.cursor.atEnd:                      # problem solved / end of wrong var.
                    self.statusbar.set('end')
                    self.board.state('disabled')

            else:
                self.cursor.previous()
            
            if not done:                                  # not found the move in the SGF file, so it's wrong
                time.sleep(0.3 * self.options.replaySpeedVar.get() + 0.3) # show the move for a short time,
                self.board.undo()                                         # then delete it
                self.guessFailure(right_pos, (x,y))
        except SGFError:
            showwarning('SGF Error', 'Error in SGF file!')
            

    def guessSuccess(self):


Generated by  Doxygen 1.6.0   Back to index