Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code-snake

Snake, played inside the program's own source code. The code is the board.

code-snake gameplay

No sprites, no box-drawing characters, no pixels. When code-snake starts, it reads its own source file, minifies it, and lays it out as fully justified text filling an exact rectangle. The snake exists only as absence: words are pushed together and apart every frame so that a channel of whitespace moves through the live code. Eat, and the program's text makes room for you.

Code as medium

Most programs treat their source as an implementation detail, the thing you look at only when something breaks. Here the source is the material itself: the canvas, the playfield, and the collision geometry are all the same bytes that implement them. Edit the code and the board changes, because the board is the code.

This is not a quine. The program never reproduces itself; it consumes itself, reflowing its own text around the game state as you play.

Run

node snake.js

Requires an interactive terminal and Node.js. No dependencies.

Keys
arrows / wasd / hjkl move
p pause
r restart
q / Ctrl-C quit

Flags

Flag Effect
--green paint the snake body green instead of pure whitespace
--smoke [cols rows] render a single frame headless and exit (testing)

About

Snake, played inside its own source code. This program does not draw a board, it becomes one; the snake is the space its words leave behind. Code as medium.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages