ASCII Ranch

A small, living ASCII meadow by Jeremy Huang. Sheep graze, grass grows back, and a sheepdog helps move the flock. Inspired by ASCII Pond.

Play the meadow · Source on GitHub

How it works

The simulation is written in TypeScript and runs in your browser. A Canvas 2D renderer draws the meadow as a grid of text glyphs. It caches glyphs in an offscreen atlas and tracks changed cells to avoid redrawing every cell on every frame.

The world advances in fixed steps of 1/60 second, while requestAnimationFrame schedules rendering. Individual sheep have grazing and movement states; nearby grass, feed, flockmates, and the dog influence their behavior. The sheep follow explicit simulation rules.

Grass lives in a grid of typed arrays. Grazing depletes cells, cropped patches rest before regrowing, and trampling leaves a fading trace. The renderer turns that state into the texture of the pasture.

Try it

Click or tap to move the dog; right-click or hold to drop feed. The meadow’s settings menu lists the keyboard controls and lets you adjust the flock, pause, reset, or regrow the grass. The simulation stays in the browser; optional local storage remembers flock-size settings.

Source and credits

This website serves a static build of ASCII Ranch at revision 1a02756. The source uses Vite for bundling, TypeScript for type checking, Vitest for unit tests, and Playwright for browser tests. There is no server component to the meadow.

The project is available under the MIT license. Math helpers and rendering ideas come from ASCII Pond, also MIT licensed. The typeface is Geist Mono, used under the SIL Open Font License.