Question: def moveForward ( maze , nextColumn, nextRow, cellSize = 2 0 ) : Moves the turtle from its current cell in the

def moveForward(maze, nextColumn, nextRow, cellSize =20):
"""
Moves the turtle from its current cell in the maze
to the next cell indicated by the "arrow" key the
player just pressed.
Parameters:
- nextColumn: the column number of the next cell the turtle
is to move to in the maze.
- nextRow: the row number of the next cell the turtle
is to move to in the maze.
- cellSize: size of a cell in the maze (20x20).
Returns:
- None.
Implementation Details - What you need to do:
- Verify that the next cell the turtle is to move to in the maze
is still within the maze. If the next cell is not within the maze,
print a message such as
"You are trying to move the turtle outside of the maze!"
on the shell (computer monitor screen) and return.
- If the next cell is within the maze, figure out what type of cell
it is: "Entrance", "Exit", "Wall", "Road"?
- If the next cell is "Entrance", move (i.e., draw) the turtle
(using the turtle function forward()) forward by one cell,
print a message such as "You are at the starting point!"
on the shell (computer monitor screen) and return.
- If moving the turtle to the next cell brings the turtle
back where it was before, then remove (pop) the current cell
from the "pathThroughMaze" list, otherwise add (append)
the next cell to the "pathThroughMaze" list.
- If the next cell is "Exit", move the turtle forward by one cell,
add this next cell to the "pathThroughMaze" list,
print a message such as "You have arrived at the exit gate!"
on the shell (computer monitor screen), call winGame() and return.
- If the next cell is "Wall", print a message such as
"You are facing a wall so you cannot move!" on the shell
(computer monitor screen) and return.
- If the next cell is "Road", move the turtle forward by one cell.
But, if moving the turtle to the next cell brings the turtle
back where it was before, then remove (pop) the current cell
from the "pathThroughMaze" list, otherwise add this next cell
to the "pathThroughMaze" list and print a message such as
"You have moved successfully!" on the shell and return.
"""
# Your code starts here:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!