Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snake-game

A terminal Snake game in pure Python (stdlib curses — no runtime dependencies).

Play

make run          # normal speed
make fast         # 20 moves/sec
make wrap         # walls wrap instead of killing you
make run SPEED=6  # custom speed

Controls: arrow keys / wasd / hjkl, p to pause, q to quit.

Develop

make check        # lint + tests
make test         # pytest
make test-nodeps  # same tests, stdlib only, no venv needed
make lint
make fmt
make clean
make help         # list all targets

make creates a .venv on first use for pytest and ruff. The game itself needs nothing but Python 3.10+.

Layout

File Purpose
snake.py Game class (pure logic) + curses front end
test_snake.py Unit tests for the game rules
Makefile run / test / lint / format / clean

The game state lives in Game, which has no UI dependencies — that's what makes the rules (collisions, growth, wrapping, no-reversal) testable without a terminal.

About

Simple pythonic implementation of a snake game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages