# Level 1: Space is a Doughnut

Sam Flower (video editing by Max Johnson)

In the classic video game Pacman, our yellow, berry eating, ghost fearing ‘protagonist’ must move swiftly around the iconic blue and black maze. To aid the player in their endless quest to eat all the white blobs, there are ‘warp tunnels’ on the left and right side of the maze. Going through one takes the player back round to the opposite warp tunnel on the other side. Running off the edge of the world just takes you back to the opposite edge.

Things are even weirder in the game Asteroids. If you fly off the left hand side of the screen, you emerge directly opposite on the right hand side of the screen, and vice versa, and if you fly off the top, you reappear at the bottom. Our poor astronaut is doomed to be trapped in an alien-infested asteroid field forever, or at least until they get hit by a huge chunk of space rock.

But how is this possible? We could just wave it away with teleporters, or the fact that it’s just a retro video game – most of the millions who have played these games over the decades never stop to think more about it. But, in the spirit of mathematical discovery, let’s think a little deeper about it.

To help understand the geometry of the situation, let’s first draw a diagram.

The rectangle represents the Pacman maze. The left and right sides connect together, which we represent by drawing a green arrow on both sides. Let us assume for now that pacman isn’t flipped upside down by going through a warp tunnel; up is still up. So the two sides are connected the same way round which means the arrows both point upwards.

Grab a piece of paper. Draw the arrows on either side. Bend the paper round so the arrows join together. What do you get? A cylinder! Pacman’s world is in fact the surface of a cylinder. Imagine Pacman ‘standing’ (does he have legs?) on a point on the cylinder. If he keeps moving to the left around the circumference of the cylinder, he can keep on going forever, never leaving his world but returning to where he began, just like in the game.

But what about our intrepid astronaut in Asteroids? Not only are the left and right hand sides of their world joined together, so are the top and bottom. This situation gives us a new diagram.

Like with Pacman, the green arrows show the left and right sides are connected. But so are the top and bottom sides. We show this with the blue double arrows. Again, the blue arrows point in the same direction as each other, since if you leave the screen at the top right, you come out at the bottom right. The sides are connected in the same direction.

What shape does this create? Like before, we can join the green arrows together to get a cylinder. But now we need to connect the ends of the cylinders, where the blue arrows now lie. To do this, imagine stretching the cylinder out into a long tube, like a hose pipe. We can then bend the tube around to join the two ends. The resulting shape looks like a doughnut with a big hole in the middle!

The idea that the world of Asteroids is the surface of a doughnut may seem weird, but as with Pacman let’s try seeing if the shape matches with what we see in the game. Look at the below picture. If we’re on the surface of the doughnut and move to the right, we go around the circumference of the doughnut, and come back to where we started. If we go up, then we go around the inner circle of the doughnut, i.e. around the width of the tube.

In both cases, just like the doomed astronaut, we can never leave the surface of the doughnut, instead we just keep looping around to where we began. So the world of Asteroids has the same key properties as the surface of a doughnut. Space, at least for this poor astronaut, is in fact a doughnut! At least they won’t get hungry during their flight…

Mathematicians call this doughnut shape a Torus, and it is one of the most important shapes in a field of maths called Topology, which deals with the properties of shapes and surfaces when distance doesn’t matter. This method of joining together edges of rectangles turns out to be very important, as we will find out in the next part of this series. There we will change the rules of the game, and the results will send our mathematics – and poor Pacman – into the next dimension.