Back to projects

glife

Conway's Game of Life in the terminal — infinite grid, Braille rendering, sub-cell mouse drawing. Written in Go.

Updated Apr 21, 2026
Repository

glife

Conway's Game of Life in your terminal. Infinite grid, Unicode Braille rendering (2×4 pixels per character), and sub-cell mouse drawing — your cursor resolves to the individual dot it's over, not the whole cell.

Install

git clone https://github.com/ImGajeed76/glife
cd glife
go build -o glife ./...

Run

./glife                                       # random start, 10 fps
./glife --pattern=gosper --fps=20 --theme=matrix
./glife --fps=0 --pattern=empty               # start paused, draw with the mouse

Controls

keyaction
SPACEpause / resume
step one generation (while paused)
/ fps ±1 (Shift: ±10)
w a s dscroll camera (Shift: ×8)
hcamera → origin (0,0)
rrandomize visible area
cclear
gtoggle chunk-grid overlay
?help overlay
q / ESCquit
mouse leftpaint alive
mouse righterase

Flags

--fps=N            Simulation ticks/sec (0 = paused, max 120). Default 10.
--density=F        Initial random density (0.01.0). Default 0.3.
--seed=N           Random seed (0 = from clock).
--pattern=NAME     random | empty | glider | gosper | acorn | rpentomino | pulsar
--rule=STR         Life-like rule (e.g. B3/S23, B36/S23). Default B3/S23.
--theme=NAME       classic | matrix | neon | amber | mono
--color=HEX        Custom fg hex for theme=mono, e.g. #ff88cc
--cam=X,Y          Initial camera position in world coords.
--no-mouse         Disable mouse input.
--no-pixel-mouse   Force cell-level mouse (disables sub-cell precision).
--cell-size=WxH    Override cell pixel size (e.g. 10x20).

How it works

  • Infinite grid via sparse chunking — 64×64 bit-packed chunks stored in a map, only live regions take memory. Cells at negative coordinates work thanks to arithmetic right-shift on signed ints.
  • Braille rendering — each terminal cell = one Unicode Braille code point (U+2800–U+28FF) carrying 8 programmable dots arranged as 2 cols × 4 rows.
  • Sub-cell mouseglife enables the SGR-pixel mouse mode (CSI ?1016h) and queries the terminal's pixel-per-cell ratio via TIOCGWINSZ, so each click/drag resolves to the specific dot under the cursor. Supported terminals: Kitty, WezTerm, iTerm2, Konsole, recent xterm, VS Code integrated, Alacritty, Ghostty. Falls back to cell-level mouse (tmux, older terminals).

Patched tcell

glife ships a minimally patched copy of tcell in third_party/tcell/, wired in via replace in go.mod. Upstream clips mouse coordinates to the cell-based screen size, which destroys pixel-mode coords before the app sees them; the patch comments out that single clip call in tscreen.go.

tcell remains under its original Apache 2.0 license — see third_party/tcell/LICENSE.

About

This project was written entirely by Claude (Anthropic) — design, implementation, and debugging — in a single chat session.


built with ♥ by oliver

About glife

What is glife?

glife is Conway's Game of Life in the terminal — infinite grid, Braille rendering, sub-cell mouse drawing. Written in Go.. It is built with Go and maintained by Oliver Seifert.

What language is glife written in?

glife is primarily written in Go (100% of the codebase).

Most Similar to glife

Explore Something Different from glife