

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Draw Lines
incomplete
2: Cell
incomplete
3: Draw Move
incomplete
This lesson's interactive features are locked, please to keep using them
Our maze is made up of little boxes in a grid. Each box we call a "Cell", and it has 4 potential walls. The way the maze works, is that we start in one cell, and we're allowed to move to an adjacent cell as long as there isn't a wall in the way.
Let's build a Cell class that holds all the data about an individual cell. It should know which walls it has, know where it exists on the canvas in x/y coordinates, and have access to the window so that it can draw itself.
has_left_wall (starts as True)
has_right_wall (starts as True)
has_top_wall (starts as True)
has_bottom_wall (starts as True)
__x1 (starts as -1.0)
__x2 (starts as -1.0)
__y1 (starts as -1.0)
__y2 (starts as -1.0)
__win
It should accept new x/y coordinates as input, and set the __x1, __y1, __x2, and __y2 data members.
Then, if the cell has a left wall, draw it using Lines and Points.
If the cell has a top wall, draw it, and so on and so forth for each wall.