NIKOLA UBAVIĆ Srpski

# Snake

To play the game click on the following image

## Rules

This game is played in the fundamental polygon of the real projective plane. Since the real projective plane is non-orientable, our snake can smoothly change its orientation along its path. The orientation of the snake is represented by the colour of its eye (one of the snake eyes is red and the other one is blue). If the snake eats a food of the same orientation then the snake lenght is increased by $$0.1\mathrm{m}$$. If the snake eats the food of the opposite orientation then the snake is shortened by $$0.1\mathrm{m}$$. If snake length drops below $$0.3\mathrm{m}$$, the game is over. When the snake bites itself, it defines one loop in the projective plane. Since the fundamental group of the projective plane is $$\mathbb{Z}_2$$ there are two possible outcomes: if our snake defines a trivial loop, the game is over; otherwise, the game is continued but lose part of the snake tail is removed and snake becomes shorter. The objective of the game is to grow snake longer than $$10\mathrm{m}$$.

This isn't the most interesting game you will play this year. I created this game because I wanted to gain some intuition about the topology of the projective plane.

## Math concepts behind game

Suppose we have a paper square in space. Glueing one pair of opposite sides of this paper square we get a (side of) cylinder. If we now glue cylinder edges, we get a torus. This process is depicted in the first row of image 1. Note that we can write instructions on how to glue paper by putting oriented curves (arrows) along the square's edges. While glueing, we just need to glue the same curves so that arrowheads point in the same direction. We call this square with glueing instructions a fundamental polygon of a torus (and for some complicated surfaces, it doesn't need to be square…).

Classic snake games (Pacman also) are located in the square with opposite sides identified without a twist. So, classic snake games are actually on a torus.

In this game, the playground square is glued differently: opposite sides of the square are twisted before glueing. After first glueing, we get the Möbius strip. After gluing the Möbius strip edge to a disk edge, we get the cross-capped disk, which is a continuous map of the real projective plane. This glueing process is depicted in the second row of image 1. Since the real projective plane can't be embedded (placed without intersection) in three-dimensional Euclidean space, every continuous image of it will have some point of intersection. Image 1. Glueing of a torus and cross-capped disk. Note that the colour of the curves doesn't have anything with the colour of our snake.

What does exactly mean for a surface to be non-orientable? We say that a surface is orientable if we can make a consistent choice of surface normal vector at every point. When dealing with non-orientable surfaces in Euclidean space $$\mathbb{R}^3$$, we cannot speak about different sides of a surface: from every side of a surface we can smoothly get to the opposite side. The simplest non-orientable surface is the Möbius strip. Since cross-capped disk contains the Möbius strip, it itself cannot be oriented. Moreover, a surface can be oriented if and only if it contains no subset that is homeomorphic to the Möbius strip. Image 2. Starting from the blue position, we can smoothly move figure F on the Möbius strip, to get the red figure (in the last step we rotated figure F, without changing its orientation). As we can see, red and blue figures have different orientations.

There is just one more mathematical aspect of this game: homotopy. Suppose that we have some space $$X$$ with two curves $$f$$ and $$g$$ in that space (eg. two curves on a sphere). Intuitively speaking, we say that curves $$f$$ and $$g$$ are homotopic if we can continuously deform curve $$f$$ to obtain curve $$g$$, and vice versa. If curves $$f$$ and $$g$$ are homotopic, we write $$f\simeq g$$. Because $$\simeq$$ is an equivalence relation, all curves in space $$X$$ can be parted in equivalence classes. We denote with $$\left[f\right]$$ homotopy class of $$f$$.

In topology, it's very interesting to study homotopy of loops (closed curves). So, we choose some base point $$x_0$$ in our space $$X$$, from which all loops will start and end. Image 3. All red loops belong to the same homotopy class, and the same holds for blue loops, but those classes are different. We can tighten the red loop to a point (light red loops represent that tightening), but we can't do the same with the blue loop because space has a hole in it.

On the set of all loops that begin in the base point $$x_0$$, a binary operation $$*$$ can be defined: traveling along loop $$g*f$$, we travel first around loop $$f$$, and then after returning to base point $$x_0$$, we travel around curve $$g$$. This operation has one nice feature: if $$f_1\simeq f_2$$ and $$g_1\simeq g_2$$, then $$g_1*f_1\simeq g_2*f_2$$. In other words, we can correctly define an operation $$*$$ on a set of homotopy classes. Image 4. Left: Two loops, $$f$$ and $$g$$, with base point $$x_0$$. Right: loop $$g*f$$ with base point $$x_0$$ (note that the curve $$g*f$$ is drawn slightly deformed around base point $$x_0$$, to make easier to see what is happening).

One important result in topology says that under some weak conditions on space $$X$$, a set of homotopy classes equipped with the operation $$*$$ is a group, and that group doesn't depend on the choice of base point $$x_0$$. We call that group a fundamental group of space $$X$$. In fundamental group, neutral element is a homotopy class of all loops that can be tightened to a point (also called trivial loops), and inverse of the class $$\left[f\right]$$ is the class $$\left[f^{-1}\right]$$, where $$f^{-1}$$ is reversed loop $$f$$.

When our snake bites itself, it defines a loop in the real projective plane. The fundamental group of the real projective plane has only two elements: trivial element and nontrivial element. If our snake defines a trivial loop, then it eats itself. Otherwise, the game continues, but the snake can be shortened. It's up to you to find how nontrivial loops look in the projective plane.