Flow in the browser

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.

Games 25 of 25 running

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)

canvas 33 KB source

Asteroids

ASTEROIDS - Complete Implementation

canvas 37 KB source

Breakout

BREAKOUT - Complete Implementation

canvas 32 KB source

Checkers

CHECKERS - two-player hotseat

canvas 46 KB source

Chetris

Chetris: Chess + Tetris Hybrid (Graphical Version)

canvas 37 KB source

Connect Four

CONNECT FOUR vs AI

canvas 34 KB source

Falling Sand

THE FALLING SAND GAME

canvas 48 KB source

Flappy

FLAPPY - Complete Implementation

canvas 31 KB source

Frogger

FROGGER - Complete Implementation

canvas 34 KB source

Icy Tower

ICY TOWER - momentum platformer

canvas 38 KB source

Jumper

JUMPER - doodle-jump style vertical platformer

canvas 34 KB source

Lane Racer

LANE RACER - top-down 4-lane racing game

canvas 32 KB source

Lights Out

LIGHTS OUT - Complete Implementation

canvas 31 KB source

Match-3

MATCH-3 - Complete Implementation

canvas 43 KB source

Maze Chase

MAZE CHASE - Pac-Man style maze game

canvas 36 KB source

Minesweeper

MINESWEEPER - Complete Implementation

canvas 42 KB source

Missile Command

MISSILE COMMAND - Complete Implementation

canvas 48 KB source

Othello

OTHELLO / REVERSI vs AI

canvas 45 KB source

Pong

PONG - Complete Implementation

canvas 31 KB source

Simon

SIMON - memory game

canvas 42 KB source

Snake

SNAKE - Complete Implementation

canvas 42 KB source

Sokoban

SOKOBAN - Complete Implementation

canvas 33 KB source

Space Invaders

SPACE INVADERS - Complete Implementation

canvas 36 KB source

Tetris

TETRIS - Complete Implementation

canvas 36 KB source

Tower of Hanoi

TOWER OF HANOI - classic disk puzzle

canvas 44 KB source

Morphogenesis 40 of 40 running

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

canvas 56 KB source

Ant Pheromone

stigmergy finds the short bridge without a map

canvas 64 KB source

Belousov

spiral waves in an excitable medium

canvas 34 KB source

Bone Remodelling

Wolff's law as a mechanostat on a lattice of bars

canvas 70 KB source

Branching Vessels

leaf venation by space colonization

canvas 49 KB source

Brusselator

Prigogine's dissipative structure, and its wavelength predicted

canvas 43 KB source

Bz 3d Slice

a scroll wave in a cube, shown as a moving z-cut

canvas 54 KB source

Cahn Hilliard

phase separation and spinodal decomposition

canvas 34 KB source

Cell Sorting

differential adhesion, and tissue layers that sort

canvas 40 KB source

Coral Ballistic

ballistic deposition and the shadowing instability

canvas 34 KB source

Crack Propagation

fracture through a disordered fuse lattice

canvas 59 KB source

Cyclic CA

spirals out of pure noise

canvas 44 KB source

DLA

growth where the shape is the history

canvas 56 KB source

Eden Growth

a compact cluster with a rough surface, and the roughness

canvas 34 KB source

Fitzhugh Waves

spiral waves in a 2D FitzHugh-Nagumo excitable medium

canvas 54 KB source

Flocking Patterns

a direction chosen by nobody, and the noise that destroys it

canvas 66 KB source

Gierer Meinhardt

activator-inhibitor Turing patterns with a predicted wavelength

canvas 61 KB source

Gray Scott

the canonical morphogenesis model

canvas 37 KB source

Heat Morph

anisotropic diffusion sculpting a shape out of noise

canvas 33 KB source

Hexagonal CA

snow crystal growth on a triangular lattice

canvas 35 KB source

Kuramoto Sivashinsky

1D spatiotemporal chaos, drawn as a space-time field

canvas 60 KB source

L-System Plant

a stochastic rewriting grammar, drawn as it grows

canvas 42 KB source

L-System Tree

a three-dimensional branching grammar, projected and

canvas 41 KB source

Laplacian Growth

dielectric breakdown, and its fractal dimension from Rg

canvas 69 KB source

Life Variants

three outer-totalistic rules on the same soup

canvas 43 KB source

Mycelium

hyphal branching under nutrient depletion, and its dimension measured

canvas 74 KB source

Phase Field Dendrite

anisotropic solidification from a seed crystal

canvas 67 KB source

River Erosion

drainage networks from the stream-power law

canvas 70 KB source

Sandpile

grains in, grains out, and a straight line over two decades

canvas 69 KB source

Schelling Segregation

mild preferences, and the pattern nobody wanted

canvas 60 KB source

Schnakenberg

a cubic autocatalytic Turing system with a predicted wavelength

canvas 61 KB source

Slime Mold

Physarum agents building a transport network

canvas 42 KB source

Somite Clock

segmentation by a clock and a wavefront

canvas 53 KB source

Swift Hohenberg

rolls and hexagons from a wavelength-selecting operator

canvas 34 KB source

Turing Hex Ca

a Turing pattern with no differential equation in it

canvas 67 KB source

Turing Spots

the activator-inhibitor system behind animal coats

canvas 35 KB source

Turing Stripes

the same activator-inhibitor system, one parameter away

canvas 35 KB source

Viscous Fingering

a Saffman-Taylor finger in a Hele-Shaw channel

canvas 65 KB source

Voronoi Growth

Johnson-Mehl nucleation, and the Avrami exponent

canvas 67 KB source

WFC Growth

structure appearing by constraint propagation

canvas 49 KB source

Basics 27 of 27 running

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

console 17 KB source

Bubble Sort

Bubble Sort - FLOW version of C++ bubble sort

console 17 KB source

Checked Arith Smoke

Smoke for checked / saturating / wrapping arith (#275)

console 17 KB source

Declarative Sort

Declarative ordering (Phase 1)

console 26 KB source

Dot Product

console 17 KB source

Factorial

Factorial - FLOW version of C++ factorial example

console 17 KB source

Fibonacci

console 17 KB source

GCD

Greatest Common Divisor - FLOW version of C++ Euclidean algorithm

console 17 KB source

Hashmap I64 Smoke

HashMap_i64_i64 smoke (#252)

console 18 KB source

Hello WASM

Minimal Flow program for the WASM path (Flow → C|MLIR → emcc)

console 24 KB source

Hello World

Hello World in FLOW

console 17 KB source

Loops

Loop examples in FLOW

console 17 KB source

Match Enums

Basics: match on a simple enum

console 24 KB source

Palindrome

Palindrome Checker - FLOW version of C++ string palindrome

console 17 KB source

Parallel Scaling

Coarse-grained Monte Carlo pi, timed at 2, 4 and 8 pthread workers

console threads 57 KB source

Parallel Sum

Coarse-grained data-parallel reduction, built for the WASM threads crossing

console threads 57 KB source

Pipeline Choose

Pipeline `choose` — a state-driven stage that picks which pipeline runs

console 24 KB source

Pipeline Fork

Pipeline fork block — apply several pipelines to one value, collect a record

console 24 KB source

Pipeline Fork Inferred

Anonymous fork block — the record type is inferred, no struct declaration

console 24 KB source

Pipeline Placeholder

Pipeline placeholder `_` — route the piped value to any argument slot

console 24 KB source

Power

Power Function - FLOW version of C++ pow() function

console 17 KB source

Prime Numbers

Prime Numbers - FLOW version of C++ prime number checker

console 18 KB source

Result Pipeline

Result pipeline — chain fallible steps with stdlib Result helpers

console 24 KB source

Simple For

console 20 KB source

Simple Search

Simple Search - FLOW version

console 17 KB source

Spans

Spans: a borrowed view over contiguous storage

console 17 KB source

Type Safety Demo

Advanced Type Safety with Type Aliases and Distinct Types

console 20 KB source

Language and compilers 23 of 23 running

Generics, traits, enums, effect rows, and Flow tools written in Flow. Output goes to the page.

Async Effects

Async / Timeout / Retry as Policy Effects

console 29 KB source

Async Primitives

Async primitives (effects-based) — SimulatedAsync / BlockingAsyncIO / FiberAsync

console 50 KB source

Calculator

Expression Calculator

console 31 KB source

Claim Address Demo

Claim Coordinates demo — Flow port of src/flow/claim_address.py

console 31 KB source

Closures Demo

Closures/Lambda Demo

console 25 KB source

Composition Car Engine

Composition Example: Car has-an Engine

console 17 KB source

Composition Team Employee

Composition Example: Team has Employees

console 17 KB source

Dependency Injection

Dependency Injection via Effects

console 29 KB source

Effect Rows

Effect-row Phase 2: declare effects on the signature with `with E`

console 27 KB source

Enum Match Exhaustive

Enum/ADT match demo - exercises path/const patterns and exhaustiveness

console 24 KB source

Enums Demo

Enums / Algebraic Data Types Demo

console 25 KB source

Flow Identifier Lexer

Flow identifier / keyword lexer (self-hosting seed)

console 22 KB source

Flow Lexer

Flow lexer Phase 2 (self-hosting) — historical seed demo

console 24 KB source

Generics Demo

Generics Demo

console 28 KB source

Know Demo

know + fingerprint dogfood

console 29 KB source

LSP Ordering Port

Flow port of src/flow/lsp_ordering.py — ordering IntelliSense strings

console 20 KB source

Math Prose Demo

math_prose + proof_sub dogfood demo

console 34 KB source

OOP Counter

OOP-style Example: Counter with encapsulated state

console 17 KB source

OOP Person

OOP-style Example: Person with "method" function

console 17 KB source

Option Result Demo

Option and Result Types Demo

console 28 KB source

Showcase

Effect System Showcase: One Service, Many Worlds

console 30 KB source

State Effects

State Effects: Policy Effects with Explicitly-Threaded State

console 32 KB source

Traits Demo

Demonstrates trait-based polymorphism

console 28 KB source

Numerics and dynamics 20 of 20 running

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

console 33 KB source

Controllability Demo

Controllability + similarity transform on mass-spring-damper

console 22 KB source

Fmm Adaptive

Carrier-Greengard-Rokhlin 1988 in the unit square

canvas 81 KB source

Fmm Selftest

FMM self-test: Theorem 2.1 multipole vs direct for a well-separated cluster

console 46 KB source

GA + WFC Coupled

GA + WFC coupled pipeline via dsys syntax

console 45 KB source

GA Control

GA search for stabilizing feedback on discrete double integrator

console 28 KB source

GA Dsys (namespaced)

Same GA + sense pipeline as ga_dsys_syntax.flow, using the dynamics namespace

console 42 KB source

GA Dsys Syntax

GA + control analysis via the dsys surface syntax

console 43 KB source

GA Full Analysis

GA control search + unified dynamical systems analysis

console 42 KB source

Gramian Demo

Finite vs infinite horizon controllability Gramian

console 21 KB source

LU Decomposition

LU / linear solve via stdlib BLAS (pattern-adoption #168)

console 32 KB source

LU Decomposition (pedagogical)

LU Decomposition (pedagogical) — hand-written Doolittle / pivoted LU

console 30 KB source

Lorenz Attractor

Lorenz attractor integration + Lyapunov separation proxy

console 26 KB source

Matrix Ops

Basic Matrix Operations

console 30 KB source

Natural Physics

Natural Physics in Flow

console 20 KB source

Natural Syntax Demo

Natural Physics Syntax Demo

console 28 KB source

ODE Solver

Ordinary Differential Equation Solvers

console 34 KB source

Optimization

Numerical Optimization

console 31 KB source

Regression (GD)

Linear regression via plain f32 gradient descent

console 28 KB source

WFC Demo

Wave Function Collapse on a tiny tile grid

console 19 KB source

Learning 12 of 12 running

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

console 36 KB source

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.
console 32 KB source

Digits MLP (parallel)

Data-parallel gradient accumulation for the digits MLP

console threads 64 KB source

FlowLM Char-LM

flowlm — train a character language model from scratch, in Flow

console 76 KB source

GA Flappy

GA-FLAPPY - neuroevolution on headless flappy

console 34 KB source

MLIR Tensor Bench

MLIR-first tensor benchmark — matmul + activations

console 28 KB source

NN Layers

Neural Network Layers

console 29 KB source

Optimizers

Neural Network Optimizers

console 29 KB source

Policy Pong

POLICY-PONG - REINFORCE policy gradient on headless pong

console 37 KB source

Q-Snake

Q-SNAKE - tabular Q-learning on headless snake

console 31 KB source

Tape Mul

Live reverse-mode Tape via ArrayTape (runtime/flow_tape.c)

console 28 KB source

Tensor

Tensor demo — uses stdlib/tensor.flow

console 29 KB source

Systems and data 14 of 14 running

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

console 25 KB source

CSV Parser

Streaming CSV parser demonstrating data processing in Flow

console 27 KB source

GIF Writer

Animated GIF from pure Flow: 24 frames of a square bouncing over a

console 77 KB source

Graphics

Graphics Module for FLOW

console 29 KB source

Hash Table

Hash Table Implementation

console 28 KB source

Manual Memory

Manual heap + arena demo (stdlib/memory.flow)

console 24 KB source

Memory Pool

Memory Pool Allocator

console 26 KB source

Ring Buffer

Lock-Free Ring Buffer

console 27 KB source

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.
console 22 KB source

SHA-256

SHA-256 Implementation

console 25 KB source

Shader Demo

FLOW Shader Demo

console 25 KB source

System Info

System info demo in FLOW (extern-backed)

console 25 KB source

Text Demo

Text rendering: full character set, scales, alignment, numeric helpers

canvas 32 KB source

Tiny Pointers

Tiny Pointers — arXiv:2111.12800 (Bender, Conway, Farach-Colton, Kuszmaul,

console 129 KB source

What runs, and what is still being crossed

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.

CapabilityStateRoute
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.