GitHub - clainstone/cbirds: A flock of birds in your terminal

Craig Reynolds' boids model renders as braille in terminals and sprites in Kitty.

16 cards · 1m 50s · tap to begin

From · · 1m 50s

GitHub - clainstone/cbirds: A flock of birds in your terminal

Craig Reynolds' boids model renders as braille in terminals and sprites in Kitty.

In brief

Craig Reynolds' boids model renders as braille in terminals and sprites in Kitty. A single C99 program creates bird flocks in terminal windows using Craig Reynolds' boids algorithm. Originally reported by GitHub.

What is cbirds

A flock of birds in your terminal using Craig Reynolds' boids algorithm.

“cbirds, render kitty, hawks 2, color ice, speed 0”

How it works

One C99 program, no dependencies, runs in any terminal or Kitty graphics protocol.

“cbirds, render kitty, hawks 2, color ice, speed 0”

Install options

Install options

Homebrew for macOS and Linux, apt for Debian 12 and Ubuntu 22.04, or from source.

“brew install clainstone/tap/cbirds”

Key features

Draws birds in braille, sprites for Kitty, and supports text, clocks, and signs.

“cbirds, say "back in five"”

Text processing

Pipes text into the flock, writes letters as they fly, and handles escape sequences.

“fastfetch | cbirds”

Signs and clocks

Writes signs for up to 45 seconds, shows time in HH:MM format with seconds.

“cbirds, clock, seconds”

Recording

Records flocks as GIFs or .cast files with frame rates up to 50 frames per second.

“cbirds, record flock.gif, hawks 2, seed 5”

Options

Controls flock size, speed, colors, and rendering with sliders and presets.

“cbirds, flocks 3, color ember”

How it works

Uses a grid to track neighbors and applies Reynolds' three rules for flock movement.

“Each bird sees only its neighbours and follows three rules: keep your distance, fly the way they fly, drift towards their middle”

Performance

Runs in real time with 800 birds costing half a millisecond per frame.

“Eight hundred birds cost about half a millisecond of CPU a frame”

Credits

Based on Craig Reynolds' 1987 SIGGRAPH paper on distributed behavioral models.

“The model is from Craig Reynolds' Flocks, Herds, and Schools: A Distributed Behavioral Model, SIGGRAPH 1987”

License

MIT license with no external dependencies.

“License MIT. See LICENSE”

Terminal support

Works in all terminals, with braille by default and sprites for Kitty and Ghostty.

“cbirds draws in braille by default, in every terminal”

Key commands

Use, clock for time, say for text, and, record for GIFs.

“cbirds, clock, seconds”

Flock behavior

Birds follow three rules: keep distance, fly with neighbors, drift toward their middle.

“Each bird sees only its neighbours and follows three rules: keep your distance, fly the way they fly, drift towards their middle”

What happens next

The program continues to evolve with new features and terminal support.

“The algorithm is open source and continues to be updated”

The one thing

A single C99 program creates bird flocks in terminal windows using Craig Reynolds' boids algorithm.

Read the original on GitHub

React

Sign in to react and comment.

Comments (0)

Life is short. Keep it sweet. Respect others' opinions and be kind!

    Recommended next

    More decks on cbirds and related topics.