Introducing Our Basic Grid

Get an overview of how we’ll create grids in this course.

Taking off

Doodling mazes on paper is fine and all, but if that’s all we had, we’d never get anything done. We’re computer programmers. Let’s do this right.

Let’s have the computer do it for us.

Since grids are the foundation of most of what comes later, we’ll start there, exploring the particular implementation used throughout the course. We’ll see how it works in practice by implementing the Binary Tree and Sidewinder algorithms on top of it, and we’ll work through two different ways to display it, textually (think “ASCII art”) and graphically.

Basic grid

The starting examples will all build on one particular grid implementation, so we’ll explore it here. This will be the tool we’ll use to build out our mazes, either by using this Grid class directly or by subclassing it and adding more specific functionality. Seeing how it’s put together should make things clearer. We’ll start simple, add to it and extend it as needed.

What we want is to be able to instantiate the grid and operate on the cells that it contains. The pseudocode for the grid is given below:

Get hands-on with 1200+ tech skills courses.