161 Flow examples compiled to WebAssembly and running
live on this page. Each one is the unedited source from the repository, put
through Flow → C → emcc. Graphics programs link
runtime/gfx_wasm.c, a canvas backend for the same gfx API that
drives the native window and the headless GIF recorder, so nothing in the
games or the field simulations had to change.
Click Run, then click inside the frame so it takes the
keyboard. Esc closes the frame.
The same sources docs/demos/games.md records as GIFs, running live on the gfx canvas backend.
2048
2048 in an actual native window (FLOW gfx backend)
Asteroids
ASTEROIDS - Complete Implementation
Breakout
BREAKOUT - Complete Implementation
Checkers
CHECKERS - two-player hotseat
Chetris
Chetris: Chess + Tetris Hybrid (Graphical Version)
Connect Four
CONNECT FOUR vs AI
Falling Sand
THE FALLING SAND GAME
Flappy
FLAPPY - Complete Implementation
Frogger
FROGGER - Complete Implementation
Icy Tower
ICY TOWER - momentum platformer
Jumper
JUMPER - doodle-jump style vertical platformer
Lane Racer
LANE RACER - top-down 4-lane racing game
Lights Out
LIGHTS OUT - Complete Implementation
Match-3
MATCH-3 - Complete Implementation
Maze Chase
MAZE CHASE - Pac-Man style maze game
Minesweeper
MINESWEEPER - Complete Implementation
Missile Command
MISSILE COMMAND - Complete Implementation
Othello
OTHELLO / REVERSI vs AI
Pong
PONG - Complete Implementation
Simon
SIMON - memory game
Snake
SNAKE - Complete Implementation
Sokoban
SOKOBAN - Complete Implementation
Space Invaders
SPACE INVADERS - Complete Implementation
Tetris
TETRIS - Complete Implementation
Tower of Hanoi
TOWER OF HANOI - classic disk puzzle
Reaction-diffusion, growth and cellular automata fields. Number keys switch presets, R reseeds, P pauses.
Allen Cahn
curvature-driven interface motion toward mean-curvature flow
Ant Pheromone
stigmergy finds the short bridge without a map
Belousov
spiral waves in an excitable medium
Bone Remodelling
Wolff's law as a mechanostat on a lattice of bars
Branching Vessels
leaf venation by space colonization
Brusselator
Prigogine's dissipative structure, and its wavelength predicted
Bz 3d Slice
a scroll wave in a cube, shown as a moving z-cut
Cahn Hilliard
phase separation and spinodal decomposition
Cell Sorting
differential adhesion, and tissue layers that sort
Coral Ballistic
ballistic deposition and the shadowing instability
Crack Propagation
fracture through a disordered fuse lattice
Cyclic CA
spirals out of pure noise
DLA
growth where the shape is the history
Eden Growth
a compact cluster with a rough surface, and the roughness
Fitzhugh Waves
spiral waves in a 2D FitzHugh-Nagumo excitable medium
Flocking Patterns
a direction chosen by nobody, and the noise that destroys it
Gierer Meinhardt
activator-inhibitor Turing patterns with a predicted wavelength
Gray Scott
the canonical morphogenesis model
Heat Morph
anisotropic diffusion sculpting a shape out of noise
Hexagonal CA
snow crystal growth on a triangular lattice
Kuramoto Sivashinsky
1D spatiotemporal chaos, drawn as a space-time field
L-System Plant
a stochastic rewriting grammar, drawn as it grows
L-System Tree
a three-dimensional branching grammar, projected and
Laplacian Growth
dielectric breakdown, and its fractal dimension from Rg
Life Variants
three outer-totalistic rules on the same soup
Mycelium
hyphal branching under nutrient depletion, and its dimension measured
Phase Field Dendrite
anisotropic solidification from a seed crystal
River Erosion
drainage networks from the stream-power law
Sandpile
grains in, grains out, and a straight line over two decades
Schelling Segregation
mild preferences, and the pattern nobody wanted
Schnakenberg
a cubic autocatalytic Turing system with a predicted wavelength
Slime Mold
Physarum agents building a transport network
Somite Clock
segmentation by a clock and a wavefront
Swift Hohenberg
rolls and hexagons from a wavelength-selecting operator
Turing Hex Ca
a Turing pattern with no differential equation in it
Turing Spots
the activator-inhibitor system behind animal coats
Turing Stripes
the same activator-inhibitor system, one parameter away
Viscous Fingering
a Saffman-Taylor finger in a Hele-Shaw channel
Voronoi Growth
Johnson-Mehl nucleation, and the Avrami exponent
WFC Growth
structure appearing by constraint propagation
Pure computation. No graphics, no host services: the program runs and prints into the page.
Bigint Smoke
BigInt smoke (#252) — standalone subset of lib/stdlib/bigint.flow
Bubble Sort
Bubble Sort - FLOW version of C++ bubble sort
Checked Arith Smoke
Smoke for checked / saturating / wrapping arith (#275)
Declarative Sort
Declarative ordering (Phase 1)
Factorial
Factorial - FLOW version of C++ factorial example
GCD
Greatest Common Divisor - FLOW version of C++ Euclidean algorithm
Hashmap I64 Smoke
HashMap_i64_i64 smoke (#252)
Hello WASM
Minimal Flow program for the WASM path (Flow → C|MLIR → emcc)
Hello World
Hello World in FLOW
Loops
Loop examples in FLOW
Match Enums
Basics: match on a simple enum
Palindrome
Palindrome Checker - FLOW version of C++ string palindrome
Parallel Scaling
Coarse-grained Monte Carlo pi, timed at 2, 4 and 8 pthread workers
Run
console threads
57 KB
source
Parallel Sum
Coarse-grained data-parallel reduction, built for the WASM threads crossing
Run
console threads
57 KB
source
Pipeline Choose
Pipeline `choose` — a state-driven stage that picks which pipeline runs
Pipeline Fork
Pipeline fork block — apply several pipelines to one value, collect a record
Pipeline Fork Inferred
Anonymous fork block — the record type is inferred, no struct declaration
Pipeline Placeholder
Pipeline placeholder `_` — route the piped value to any argument slot
Power
Power Function - FLOW version of C++ pow() function
Prime Numbers
Prime Numbers - FLOW version of C++ prime number checker
Result Pipeline
Result pipeline — chain fallible steps with stdlib Result helpers
Simple Search
Simple Search - FLOW version
Spans
Spans: a borrowed view over contiguous storage
Type Safety Demo
Advanced Type Safety with Type Aliases and Distinct Types
Generics, traits, enums, effect rows, and Flow tools written in Flow. Output goes to the page.
Async Effects
Async / Timeout / Retry as Policy Effects
Async Primitives
Async primitives (effects-based) — SimulatedAsync / BlockingAsyncIO / FiberAsync
Calculator
Expression Calculator
Claim Address Demo
Claim Coordinates demo — Flow port of src/flow/claim_address.py
Closures Demo
Closures/Lambda Demo
Composition Car Engine
Composition Example: Car has-an Engine
Composition Team Employee
Composition Example: Team has Employees
Dependency Injection
Dependency Injection via Effects
Effect Rows
Effect-row Phase 2: declare effects on the signature with `with E`
Enum Match Exhaustive
Enum/ADT match demo - exercises path/const patterns and exhaustiveness
Enums Demo
Enums / Algebraic Data Types Demo
Flow Identifier Lexer
Flow identifier / keyword lexer (self-hosting seed)
Flow Lexer
Flow lexer Phase 2 (self-hosting) — historical seed demo
Generics Demo
Generics Demo
Know Demo
know + fingerprint dogfood
LSP Ordering Port
Flow port of src/flow/lsp_ordering.py — ordering IntelliSense strings
Math Prose Demo
math_prose + proof_sub dogfood demo
OOP Counter
OOP-style Example: Counter with encapsulated state
OOP Person
OOP-style Example: Person with "method" function
Option Result Demo
Option and Result Types Demo
Showcase
Effect System Showcase: One Service, Many Worlds
State Effects
State Effects: Policy Effects with Explicitly-Threaded State
Traits Demo
Demonstrates trait-based polymorphism
Solvers, optimisers, linear algebra and control theory. The ones that reach a native BLAS do not link here.
BLAS Demo
BLAS Demo: Comparing naive vs Accelerate-backed matrix operations
Controllability Demo
Controllability + similarity transform on mass-spring-damper
Fmm Adaptive
Carrier-Greengard-Rokhlin 1988 in the unit square
Fmm Selftest
FMM self-test: Theorem 2.1 multipole vs direct for a well-separated cluster
GA + WFC Coupled
GA + WFC coupled pipeline via dsys syntax
GA Control
GA search for stabilizing feedback on discrete double integrator
GA Dsys (namespaced)
Same GA + sense pipeline as ga_dsys_syntax.flow, using the dynamics namespace
GA Dsys Syntax
GA + control analysis via the dsys surface syntax
GA Full Analysis
GA control search + unified dynamical systems analysis
Gramian Demo
Finite vs infinite horizon controllability Gramian
LU Decomposition
LU / linear solve via stdlib BLAS (pattern-adoption #168)
LU Decomposition (pedagogical)
LU Decomposition (pedagogical) — hand-written Doolittle / pivoted LU
Lorenz Attractor
Lorenz attractor integration + Lyapunov separation proxy
Matrix Ops
Basic Matrix Operations
Natural Physics
Natural Physics in Flow
Natural Syntax Demo
Natural Physics Syntax Demo
ODE Solver
Ordinary Differential Equation Solvers
Optimization
Numerical Optimization
Regression (GD)
Linear regression via plain f32 gradient descent
WFC Demo
Wave Function Collapse on a tiny tile grid
Small models and agents. The Metal and tape-runtime variants need host services that are not linked here.
Digits MLP
Multi-class digits MLP trained from scratch on the CPU
Digits MLP (Metal)
Metal GPU status check for the digits MLP: what runs on the GPU today
The Metal GPU is CPU-emulated on wasm: buffers are plain memory and flow_gpu_mul_f32 runs an elementwise CPU loop, so the relu-gate correctness check runs and passes, but the 'gpu ms' timing rows measure a CPU loop, not a GPU dispatch.
Digits MLP (parallel)
Data-parallel gradient accumulation for the digits MLP
Run
console threads
64 KB
source
FlowLM Char-LM
flowlm — train a character language model from scratch, in Flow
GA Flappy
GA-FLAPPY - neuroevolution on headless flappy
MLIR Tensor Bench
MLIR-first tensor benchmark — matmul + activations
NN Layers
Neural Network Layers
Optimizers
Neural Network Optimizers
Policy Pong
POLICY-PONG - REINFORCE policy gradient on headless pong
Q-Snake
Q-SNAKE - tabular Q-learning on headless snake
Tape Mul
Live reverse-mode Tape via ArrayTape (runtime/flow_tape.c)
Tensor
Tensor demo — uses stdlib/tensor.flow
Allocators, hash tables, hashing, parsers, file formats. Anything asking the OS about itself stops at the link step.
Arena Frame
Per-frame arena: bump allocate, then arena_reset each frame
CSV Parser
Streaming CSV parser demonstrating data processing in Flow
GIF Writer
Animated GIF from pure Flow: 24 frames of a square bouncing over a
Graphics
Graphics Module for FLOW
Hash Table
Hash Table Implementation
Manual Memory
Manual heap + arena demo (stdlib/memory.flow)
Memory Pool
Memory Pool Allocator
Ring Buffer
Lock-Free Ring Buffer
Runtime SHA-256
Crypto self-test via always-linked lib/runtime/crypto.flow
SHA-256 runs Flow's own implementation (lib/runtime/crypto.flow), same code as native; only the random bytes come from the browser's WebCrypto CSPRNG (crypto.getRandomValues) instead of the native OS kernel.
SHA-256
SHA-256 Implementation
Shader Demo
FLOW Shader Demo
System Info
System info demo in FLOW (extern-backed)
Text Demo
Text rendering: full character set, scales, alignment, numeric helpers
Tiny Pointers
Tiny Pointers — arXiv:2111.12800 (Bender, Conway, Farach-Colton, Kuszmaul,
Rows marked “runs” are verified in a browser. The
threads row needs the card opened in a tab (an iframe cannot become
cross-origin isolated on its own). The rest name the mechanism and say
plainly that it is not built here yet.
Capability State Route
Pure computation
Runs today
Arithmetic, arrays, structs, strings, printf. Straight Flow to C to wasm32 with nothing else linked in.
gfx graphics and keyboard
Runs today
runtime/gfx_wasm.c paints the framebuffer onto a canvas and maps DOM key events to the macOS keycodes the programs already use.
Threads and channels
Runs today
digits_mlp_parallel and parallel_sum run on real Emscripten pthreads over SharedArrayBuffer and Web Workers. SharedArrayBuffer needs a cross-origin-isolated page, so open those cards in a tab and let their service worker reload once.
Sockets and HTTP
In progress
Emscripten's WebSocket-backed POSIX socket bridge (-lwebsocket.js / PROXY_POSIX_SOCKETS). Not built here.
GPU kernels
In progress
WebGPU, with WGSL generated from the same @gpu AST that already emits Metal. Not built here.
Embedded CPython
In progress
Pyodide, which is CPython itself compiled to WebAssembly. Not built here.
File I/O
In progress
Emscripten's MEMFS and IDBFS filesystems. Not wired into these pages.
Audio
Not attempted
The miniaudio and Metal audio backends have no browser counterpart here yet; WebAudio would be the route.