def make_move(self, move):
        playback_gesture(self.shell, self.ident, move)

        sleeptime = 1.0
        if self.last_board is not None:
            board = self.last_board.copy()
            do_move(board, movenames.index(move))
            top = board.max()
            if sorted(self.last_board.flatten()) == sorted(board.flatten()):
                # No new tiles at all: no flipping or jumping
                sleeptime = 0.5
            elif top <= 3 or list(self.last_board.flatten()).count(top) == list(board.flatten()).count(top):
                # No new high tile created, so no jumping will occur.
                sleeptime = 0.5
            else:
                # The new high tile will jump; wait for a long time for jump animation to finish.
                sleeptime = 1.0

        time.sleep(sleeptime)
Esempio n. 2
0
    def make_move(self, move):
        playback_gesture(self.shell, self.ident, move)

        sleeptime = 1.0
        if self.last_board is not None:
            board = self.last_board.copy()
            do_move(board, movenames.index(move))
            top = board.max()
            if sorted(self.last_board.flatten()) == sorted(board.flatten()):
                # No new tiles at all: no flipping or jumping
                sleeptime = 0.5
            elif top <= 3 or list(
                    self.last_board.flatten()).count(top) == list(
                        board.flatten()).count(top):
                # No new high tile created, so no jumping will occur.
                sleeptime = 0.5
            else:
                # The new high tile will jump; wait for a long time for jump animation to finish.
                sleeptime = 1.0

        time.sleep(sleeptime)
Esempio n. 3
0
 def restart(self):
     ''' Restart from the "out of moves" screen '''
     playback_gesture(self.shell, self.ident,
                      'right')  # swipe to see your score
     time.sleep(0.5)
     playback_gesture(self.shell, self.ident,
                      'left')  # skip the score counting
     time.sleep(2)
     playback_gesture(self.shell, self.ident,
                      'right')  # swipe to save your score
     time.sleep(2)
     playback_gesture(self.shell, self.ident,
                      'left')  # swipe from score to menu
     time.sleep(2)
     playback_gesture(self.shell, self.ident,
                      'pressbutton')  # press Main Menu button
     time.sleep(2)
     playback_gesture(self.shell, self.ident,
                      'pressbutton')  # press Play Threes button
     time.sleep(2.0)
     self.last_board = None
 def restart(self):
     ''' Restart from the "out of moves" screen '''
     playback_gesture(self.shell, self.ident, 'right') # swipe to see your score
     time.sleep(0.5)
     playback_gesture(self.shell, self.ident, 'left') # skip the score counting
     time.sleep(2)
     playback_gesture(self.shell, self.ident, 'right') # swipe to save your score
     time.sleep(2)
     playback_gesture(self.shell, self.ident, 'left') # swipe from score to menu
     time.sleep(2)
     playback_gesture(self.shell, self.ident, 'pressbutton') # press Main Menu button
     time.sleep(2)
     playback_gesture(self.shell, self.ident, 'pressbutton') # press Play Threes button
     time.sleep(2.0)
     self.last_board = None