Skip to main content

Module life

Module life 

Source
Expand description

Conway’s Game of Life implementation for TUI background animation.

This module provides a cellular automaton simulation using Braille patterns for rendering. It includes various seed patterns (gliders, spaceships, etc.) and automatic pattern injection when activity becomes low.

Structs§

LifeConfig
Configuration for the Life simulation injector.
LifeField
The Game of Life field state.
PatternPlacement
Placement configuration for injecting a pattern into the life field.
SeedPattern
A predefined seed pattern for the Game of Life.
ZoneStats
Statistics for a single zone in the life field.

Constants§

ACORN_PATTERN
The acorn pattern - a methuselah that evolves for 5206 generations.
GLIDER_PATTERN
The glider pattern - a small spaceship that moves diagonally.
LWSS_PATTERN
The lightweight spaceship (LWSS) pattern - moves orthogonally.
RANDOM_BLOB_4X4
Small random blob pattern (4x4) for variety
RANDOM_BLOB_5X5
Medium random blob pattern (5x5) for variety
RANDOM_BLOB_6X6
Large random blob pattern (6x6) for variety
R_PENTOMINO_PATTERN
The R-pentomino pattern - a small methuselah that evolves for many generations.

Functions§

hash_seed
Generate a deterministic seed from prompt and dimensions
rotate_cell
Rotates a cell coordinate within a pattern.
rotated_dimensions
Calculates dimensions after rotation.
wrap_index
Wraps an index with a delta, handling toroidal boundaries.
wrap_index_signed
Wraps a signed index, handling toroidal boundaries.