dwgx/SmartCLI / skills/cmd-art
cmd-art
VerifiedDesign and render terminal/CMD visual effects and ASCII art from a one-line request via the pluggable `fx` engine (30 effects, hot-swappable and themeable, plus scripted shows). Effects include donut, matrix rain, plasma, fire, a spinning 3D ball, a solar-system orrery, Game of Life, wireframe cube, 3D text banners, rainbow/lolcat gradient text, starfield, tunnel, fireworks, image-to-ASCII, and more. Use when the request is for a terminal animation, ANSI/CLI art, or a new console effect. Pure Python stdlib; truecolor.
fx/effects/game_of_life.py
View on GitHub"""Conway's Game of Life (B3/S23) on a toroidal grid, age-colored.
Newborn cells glow at the bright end of the theme; long-lived cells settle
toward the base color. Auto-reseeds when the population collapses.
Source: research/R2 section 8.
"""
from __future__ import annotations
import random
from ..base import Effect, FrameCtx, Param
from ..registry import register
from ..util import clamp, grid_to_str, new_grid
@register
class GameOfLife(Effect):
name = "life"
aliases = ("game_of_life",)
description = "Conway's Game of Life, toroidal wrap, age-based theme colors."
tags = ("nature", "automata", "classic")
default_fps = 12.0
params = (
Param("fill", "float", 0.22, "initial alive fraction", min=0.01, max=0.9),
Param("char", "str", "#", "glyph for a live cell"),
Param("seed", "int", 0, "RNG seed (0 = random)"),
)
def setup(self) -> None:
self._cells = None
self._age = None
self._size = None
def _reseed(self, w, h, fill, rng):
self._cells = [[1 if rng.random() < fill else 0 for _ in range(w)]
for _ in range(h)]
self._age = [[0] * w for _ in range(h)]
def render(self, ctx: FrameCtx) -> str:
w, h = ctx.width, ctx.height
p = ctx.params
if self._size != (w, h):
self._size = (w, h)
rng = random.Random(p["seed"] or None)
self._reseed(w, h, p["fill"], rng)
cells, age = self._cells, self._age
nxt = [[0] * w for _ in range(h)]
pop = 0
for y in range(h):
ym, yp = (y - 1) % h, (y + 1) % h
for x in range(w):
xm, xp = (x - 1) % w, (x + 1) % w
n = (cells[ym][xm] + cells[ym][x] + cells[ym][xp]
+ cells[y][xm] + cells[y][xp]
+ cells[yp][xm] + cells[yp][x] + cells[yp][xp])
alive = 1 if (n == 3 or (cells[y][x] and n == 2)) else 0
nxt[y][x] = alive
if alive:
pop += 1
age[y][x] = age[y][x] + 1 if cells[y][x] else 1
else:
age[y][x] = 0
self._cells = nxt
if pop < max(4, (w * h) // 200): # died out / nearly static -> reseed
self._reseed(w, h, p["fill"], random.Random())
grid = new_grid(w, h)
theme = ctx.theme
ch = (p["char"] or "#")[0]
for y in range(h):
crow, arow, grow = self._cells[y], age[y], grid[y]
for x in range(w):
if crow[x]:
# young = bright end, old = settled base tones
a = clamp(arow[x] / 14.0, 0.0, 1.0)
grow[x] = (ch, theme.color_at(1.0 - 0.75 * a))
return grid_to_str(grid)
def teardown(self) -> None:
self._cells = None
self._age = None
self._size = None
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |