I really enjoyed making this project because it had a lot of detail and learning curves. I would not say that now I’m a “game dev”, but I realized that the more practice you have the more patterns you can spot and knowledge starts growing on you.

One part of code that made me feel cool even though it’s not a major breakthrough is literally turning off automatic redrawing and updating the screen every 0.1s making the game about 10fps.

What I learned

  • Optimizing code by having constants.
  • If code repeats it’s a sign that I should abstract it / make it reusable.
  • Consistent naming makes the code readable.
  • Encapsulating methods makes main.py much readable.

In particular I was struggling to understand how the snake moves, so I asked claude.ai to explain that to me visually and surprisingly it gave me this lovely visualization. So now I understand every segment copies the position of the one ahead of it, moving from tail to head, so no position is ever lost

Snake Movement Visualizer

🐍 Snake Segment Movement Visualizer

See exactly how range(len(segments)-1, 0, -1) works step by step

HEAD [0]
MIDDLE [1]
TAIL [2]
Old pos

Step 0 of 3
LOOP ITERATION
for seg_num in range(2, 0, -1):
new_x = segments[seg_num-1].xcor()
new_y = segments[seg_num-1].ycor()
segments[seg_num].goto(new_x, new_y)
segments[0].forward(20) # head moves
POSITIONS
Why backwards?
Going tail→head means each segment copies its neighbour’s position before that neighbour moves — no positions are lost!