Cylinder Mazes

Learn how to generate cylinder mazes.

Introduction to planair mazes

It’s been an eventful journey, but we’re nearly done. Maze algorithms, grids born of nonrectangular tesselations, circles, weaves, and braids, and even building those mazes out in three and four dimensions—it’s all brought us here.

Consider the mazes we’ve generated up to now, all of them neatly built on flat, predictable surfaces. Even the three-dimensional ones were composed of neatly planar levels. But what would happen if we were to take one of those mazes and bend it a bit, warping the surface so that it curves in one or more dimensions? What if you were to even go so far as to fold it?

Those first-person shooters take on an entirely different feel when the corridors wrap around the surface of a sphere or carry us around the inside of a ribbon. Picture a game where we can see our goal above us as the maze arches overhead or where monsters may be lurking just down the passage, hidden by a not-so-distant horizon!

These are what are called planair mazes, an unusual name for an unusual kind of puzzle. Mazes on cylinders, cubes, cones, pyramids, spheres, and toruses are all examples of these planair mazes, and this is a topic that could easily be an entire course in its own right. We’ve only got time for a brief taste, but hopefully, that’ll be enough to set you exploring some more on your own.

We’ll look at four different surfaces: cylinders, Möbius strips, cubes, and spheres. In each case, we’ll learn how to generate a maze on that surface. For the first three, we’ll use simple paper-crafting techniques to visualize the resulting mazes, and for the last, we’ll resort to using a 3D renderer to draw our maze on the surface of a sphere.


Cylinder mazes are a good place to start because they’re actually really, really easy. We can make a naive one simply by generating a rectangular maze, printing it out, and wrapping it around a soup can so that the ends touch like this:

Get hands-on with 1200+ tech skills courses.