We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Draw Move

Next, we need a way to draw a path between 2 cells.

Assignment

def draw_move(self, to_cell: "Cell", undo: bool = False) -> None:
  • If the undo flag is not set, the line you draw should be "red". Otherwise, make it "gray". This way as we're drawing a path through the maze, it will be a nice red color, but if we need to backtrack, it will be gray.
  • Use the x/y coordinates of the 2 cells in question to decide how to draw the line connecting the two cells.