StageClass.py
def slide(self, startx, starty, orient, move):
        'Moves letters within grid in a wrapparound style.\
    Startx & StartY implement coords of the letter to be moved.\
    orient can be string u, d, r, and l, for directions.\
    move is the amount of space the letter is to be moved.'

        
        if move < 0: # In case of a negative number, the orient is switched.
            if orient == 'r':
                orient = 'l'
            elif orient == 'r':
                orient = 'l'
            elif orient == 'u':
                orient = 'd'
            elif orient == 'd':
                orient = 'u'
            move = move * -1
            
            
        self.movesRemaining -= 1    #After each move, the user will lose a move
        self.totalSlides += 1
        # Creates A temporary list to translate new letter positions to.
        tempLine = ['$']*self.gridSize
        #if orient != 'r' or 'l' or 'u' or 'd':
            #print("Please try again, using u, d, l, or r as orient.")
        if orient == 'r':# if they want to move it right (the x direction
            for letter in range(self.gridSize):
                # check to prevent moved letter from going "off list"
                if ((letter + 1) + move) <= self.gridSize:
                    tempLine[letter + move] = self.grid[startx - 1][letter]
                    # letter is placed in tempLine "move" spaces to the right.

                # If the letter would go "off list" it is moved to the beginning,
                #wrapping around.
                else:
                    tempLine[letter - (self.gridSize - move)] = self.grid[startx - 1][letter]
                    #Letters in templine are transfered to the line in self.grid
            
            self.grid[startx - 1] = tempLine
        elif orient == 'l':# if they want to move a letter left, we just move the letters right enough
            #to make it LOOK like it moved left. We're lazy like that.
            self.movesRemaining += 1
            self.slide(startx, starty, 'r', (self.gridSize - move))

        elif orient == 'd' :# if they want to move it down (y direction)
            for letter in range(self.gridSize):
                if ((letter + 1) + move) <= self.gridSize:#Same "off line" prevention as in 'r'
                    tempLine[letter + move] = self.grid[letter][starty - 1]
                else:
                    tempLine[letter - (self.gridSize - move)] = self.grid[letter][starty - 1]
            #print(tempLine)debug
            for letter in range(self.gridSize):
                #As each letter is technically on a seperate list, it must go through each list
                #to replace the letters.
                self.grid[letter][starty - 1] = tempLine[letter]

        elif orient == 'u':# if they want to move it up (y direction)
            self.movesRemaining += 1                    #When the slide function is called recursively
            self.totalSlides -= 1   
            self.slide(startx, starty, 'd', (self.gridSize - move))
Moves letters within grid in a wrapparound style.\
    Startx & StartY implement coords of the letter to be moved.\
    orient can be string u, d, r, and l, for directions.\
    move is the amount of space the letter is to be moved.
Moves letters within grid in a wrapparound style.\
Startx & StartY implement coords of the letter to be moved.\
orient can be string u, d, r, and l, for directions.\
move is the amount of space the letter is to be moved.
Moves letters within grid in a wrapparound style . \ Startx & StartY implement coords of the letter to be moved . \ orient can be string u d r and l for directions . \ move is the amount of space the letter is to be moved .
def slide(self, startx, starty, orient, move):
        if move < 0: 
            if orient == 'r':
                orient = 'l'
            elif orient == 'r':
                orient = 'l'
            elif orient == 'u':
                orient = 'd'
            elif orient == 'd':
                orient = 'u'
            move = move * -1
        self.movesRemaining -= 1    
        self.totalSlides += 1
        tempLine = ['$']*self.gridSize
        if orient == 'r':
            for letter in range(self.gridSize):
                if ((letter + 1) + move) <= self.gridSize:
                    tempLine[letter + move] = self.grid[startx - 1][letter]
                else:
                    tempLine[letter - (self.gridSize - move)] = self.grid[startx - 1][letter]
            self.grid[startx - 1] = tempLine
        elif orient == 'l':
            self.movesRemaining += 1
            self.slide(startx, starty, 'r', (self.gridSize - move))
        elif orient == 'd' :
            for letter in range(self.gridSize):
                if ((letter + 1) + move) <= self.gridSize:
                    tempLine[letter + move] = self.grid[letter][starty - 1]
                else:
                    tempLine[letter - (self.gridSize - move)] = self.grid[letter][starty - 1]
            for letter in range(self.gridSize):
                self.grid[letter][starty - 1] = tempLine[letter]
        elif orient == 'u':
            self.movesRemaining += 1                    
            self.totalSlides -= 1   
            self.slide(startx, starty, 'd', (self.gridSize - move))
def slide ( self , startx , starty , orient , move ) : if move < 0 : if orient == 'r' : orient = 'l' elif orient == 'r' : orient = 'l' elif orient == 'u' : orient = 'd' elif orient == 'd' : orient = 'u' move = move * - 1 self . movesRemaining -= 1 self . totalSlides += 1 tempLine = [ '$' ] * self . gridSize if orient == 'r' : for letter in range ( self . gridSize ) : if ( ( letter + 1 ) + move ) <= self . gridSize : tempLine [ letter + move ] = self . grid [ startx - 1 ] [ letter ] else : tempLine [ letter - ( self . gridSize - move ) ] = self . grid [ startx - 1 ] [ letter ] self . grid [ startx - 1 ] = tempLine elif orient == 'l' : self . movesRemaining += 1 self . slide ( startx , starty , 'r' , ( self . gridSize - move ) ) elif orient == 'd' : for letter in range ( self . gridSize ) : if ( ( letter + 1 ) + move ) <= self . gridSize : tempLine [ letter + move ] = self . grid [ letter ] [ starty - 1 ] else : tempLine [ letter - ( self . gridSize - move ) ] = self . grid [ letter ] [ starty - 1 ] for letter in range ( self . gridSize ) : self . grid [ letter ] [ starty - 1 ] = tempLine [ letter ] elif orient == 'u' : self . movesRemaining += 1 self . totalSlides -= 1 self . slide ( startx , starty , 'd' , ( self . gridSize - move ) )
Moves letters within grid in a wrapparound style.\
Startx & StartY implement coords of the letter to be moved.\
orient can be string u, d, r, and l, for directions.\
move is the amount of space the letter is to be moved.
Moves letters within grid in a wrapparound style . \ Startx & StartY implement coords of the letter to be moved . \ orient can be string u d r and l for directions . \ move is the amount of space the letter is to be moved .
'Moves letters within grid in a wrapparound style.\
    Startx & StartY implement coords of the letter to be moved.\
    orient can be string u, d, r, and l, for directions.\
    move is the amount of space the letter is to be moved.' # In case of a negative number, the orient is switched.
 #After each move, the user will lose a move
 # Creates A temporary list to translate new letter positions to.
 #if orient != 'r' or 'l' or 'u' or 'd':
 #print("Please try again, using u, d, l, or r as orient.")
 # if they want to move it right (the x direction
 # check to prevent moved letter from going "off list"
 # letter is placed in tempLine "move" spaces to the right.
 # If the letter would go "off list" it is moved to the beginning,
 #wrapping around.
 #Letters in templine are transfered to the line in self.grid
 # if they want to move a letter left, we just move the letters right enough
 #to make it LOOK like it moved left. We're lazy like that.
 # if they want to move it down (y direction)
 #Same "off line" prevention as in 'r'
 #print(tempLine)debug
 #As each letter is technically on a seperate list, it must go through each list
 #to replace the letters.
 # if they want to move it up (y direction)
 #When the slide function is called recursively

self
startx
starty
orient
move