O'Reilly logo

Mazes for Programmers by Jamis Buck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sphere Mazes

Creating a maze on the surface of a sphere shares a lot in common with creating a maze inside of a circle. This shouldn’t be surprising! A hemisphere, after all, is merely a circle that’s been lifted up by its origin, like this:

images/polar-to-sphere.png

We can create a sphere by putting two hemispheres together, which means we ought to be able to implement a spherical grid by leaning on our polar grid (from Chapter 7, Going in Circles). We’ll need to change a lot of the calculations behind the measuring of the cells (a hemisphere may be related to a circle, but that doesn’t mean they wear the same size of shirt), and our to_png method is going to need rewriting, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required