Snake

I recreated the classic snake game using Python as a programming exercise. The snake starts out as four cells on the screen. One of the cells on the screen is an apple. If the snake moves into and “eats” the apple, it grows by one cell and the apple respawns elsewhere. The snake can only die by intersecting itself. Moving out of bounds loops the snake around to the other side of the screen, so topologically, the screen is a torus. Here is the Python code.