Jarek Hartman
Sunday, February 23, 2025

Snake in Go

Intro

I built this little Snake clone as a hands-on way to learn the Ebitengine (Ebiten) game loop in Go. It runs on a fixed grid with keyboard controls, food spawning, scoring, and basic collision handling.

Rendering is done with ebiten/v2 plus the vector package for shapes and text/v2 for the on-screen score (M+ font from Ebiten resources). I kept the code intentionally compact: a slice of points for the snake, a simple state machine for crash/respawn, and a deterministic update tick tied to frame timing.

Snake

References