Overview › Models › Claude Haiku 4.5
Model profile

Claude Haiku 4.5

Cloud
149frontier references (R31–R180)
—not scored, by design

Rounds & answers 149

▶ R31 · Bat and ball (the classic reasoning trap)author reference Open round →
0,05 Euro. Wenn der Ball x Euro kostet, dann kostet der Schläger (x + 1,00) Euro. Zusammen: x + (x + 1,00) = 1,10 €, also 2x = 0,10 € und x = 0,05 €.
▶ R32 · Four houses, four clues (constraint puzzle)author reference Open round →
1 grün, 2 rot, 3 blau, 4 gelb. Das grüne Haus steht an Position 1 (Fakt 2). Das rote Haus steht direkt links vom blauen (Fakt 1), also rot-blau. Das gelbe Haus steht direkt rechts vom blauen (Fakt 3), also blau-gelb. Daraus ergibt sich: grün, rot, blau, gelb.
▶ R33 · Idioms that break literal translation (EN→DE)author reference Open round →
1) in den sauren Apfel beißen
2) am Zug sein
3) es gießt wie aus Eimern
▶ R34 · Constrained taglines (word ban + length cap)author reference Open round →
1. Putzen mit Gewissen – die Bambuszahnbürste.
2. Biologisch abbaubar, sanft zum Lächeln.
3. Ein Griff, der Gutes tut – jeden Tag.
▶ R35 · Minutes in a (non-leap) year — show the mathauthor reference Open round →
525600 Minuten.

365 Tage × 24 Stunden pro Tag × 60 Minuten pro Stunde = 525600 Minuten.
▶ R36 · Continue the sequence (doubling gaps)author reference Open round →
33. Die Differenzen zwischen aufeinanderfolgenden Zahlen verdoppeln sich: +1, +2, +4, +8, +16, also 17 + 16 = 33.
▶ R37 · False friend: 'control' EN→DEauthor reference Open round →
Bevor wir ausliefern, muss ich die Testergebnisse überprüfen und am Ende zwei Fehler beheben.
▶ R38 · Register shift: formal → casual (DE)author reference Open round →
Hi, kurze Info: das Meeting mussten wir auf morgen 10 Uhr verschieben.
▶ R39 · 40-word product blurb with 3 required wordsauthor reference Open round →
Diese Edelstahl-Trinkflasche ist auslaufsicher und hält Getränke stundenlang kalt oder heiß. Sie ist spülmaschinenfest, robust und leicht. Perfekt für Arbeit, Sport und Reisen.
▶ R40 · isPalindrome (ignore case & non-alphanumerics)author reference Open round →
function isPalindrome(s) {
  const cleaned = s.toLowerCase().replace(/[^a-z0-9]/g, '');
  return cleaned === cleaned.split('').reverse().join('');
}
▶ R41 · Prose → valid JSONauthor reference Open round →
{"name":"Anna Schmidt","alter":30,"stadt":"Freiburg","hobbys":["Lesen","Radfahren"],"newsletter":true}
▶ R42 · All but nine (word-problem trap)author reference Open round →
9 Schafe. "Alle bis auf 9" bedeutet, dass 9 Schafe am Leben bleiben.
▶ R43 · Five machines (rate-reasoning trap)author reference Open round →
5 Minuten. Wenn 5 Maschinen 5 Minuten brauchen, um 5 Teile herzustellen, braucht jede Maschine 5 Minuten pro Teil. 100 Maschinen arbeiten parallel und fertigen 100 Teile in den gleichen 5 Minuten.
▶ R44 · Appointment extraction to strict JSONauthor reference Open round →
[
  {
    "datum": "2026-08-12",
    "uhrzeit": "14:30",
    "titel": "Budgetplanung"
  },
  {
    "datum": "2026-09-03",
    "uhrzeit": "09:00",
    "titel": "Zahnarzttermin"
  },
  {
    "datum": "2026-12-31",
    "uhrzeit": "20:30",
    "titel": "Silvesterparty"
  }
]
▶ R45 · Idiom-dense German to natural Englishauthor reference Open round →
It's not perfect, but we shouldn't make a mountain out of a molehill — ultimately, we can live with it.
▶ R46 · Energy conservation on a frictionless inclineauthor reference Open round →
Energy Conservation: PE_initial = KE_final
mgh = (1/2)mv²

(a) Speed at the bottom:
v = √(2gh) = √(2 × 9.8 × 5) = √98 = 9.90 m/s

(b) Kinetic energy at the bottom:
KE = mgh = 2 × 9.8 × 5 = 98 J

Final answers:
(a) 9.90 m/s
(b) 98 J
▶ R47 · Unit conversion: km/h to m/s and mphauthor reference Open round →
(a) Conversion to m/s:
108 km/h = 108 × (1000 m / 3600 s) = 108000 / 3600 = 30.0 m/s

(b) Conversion to mph:
108 km/h × (1 mile / 1.60934 km) = 108 / 1.60934 = 67.1 mph

Final answers:
(a) 30.0 m/s
(b) 67.1 mph
▶ R48 · Low-orbit satellite: speed and period (orbital/Kepler estimate)author reference Open round →
Given: altitude = 400 km, Earth radius = 6371 km, μ = 398600 km³/s²
r = 6371 + 400 = 6771 km

(a) Orbital speed:
v = √(μ/r) = √(398600 / 6771) = √58.852 = 7.67 km/s

(b) Orbital period:
T = 2πr/v = (2π × 6771) / 7.67 = 42,573.6 / 7.67 = 5548.7 s = 92.5 minutes

Final answers:
(a) 7.67 km/s
(b) 92.5 minutes
▶ R49 · Ohm's law: resistance and power dissipationauthor reference Open round →
Using Ohm's Law: V = I × R, and Power formulas.

Given: V = 12 V, I = 0.5 A

(a) Resistance:
R = V / I = 12 / 0.5 = 24 Ω

(b) Power dissipated:
P = V × I = 12 × 0.5 = 6 W

Final answers:
(a) 24 Ω
(b) 6 W
▶ R50 · Thin lens equation: image distance and magnificationauthor reference Open round →
Using thin lens equation: 1/f = 1/d_o + 1/d_i

Given: f = 10 cm, d_o = 15 cm

(a) Image distance:
1/d_i = 1/f - 1/d_o = 1/10 - 1/15 = 3/30 - 2/30 = 1/30
d_i = 30 cm

(b) Magnification:
m = -d_i/d_o = -30/15 = -2

Image properties:
- Real (d_i > 0, image forms on opposite side of lens)
- Inverted (m < 0)
- Magnified (|m| = 2, twice the size)

Final answers:
(a) d_i = 30 cm
(b) m = -2 (real, inverted)
▶ R51 · Heat required to warm water (specific heat capacity)author reference Open round →
Using Q = m*c*ΔT

Given: m = 2 kg, T_initial = 20°C, T_final = 80°C, c = 4186 J/(kg*K)
ΔT = 80 - 20 = 60 K

Calculation:
Q = m × c × ΔT = 2 × 4186 × 60 = 502,320 J

Converting to kilojoules:
Q = 502,320 J / 1000 = 502.32 kJ

Final answers:
- 502,320 J (or 502,320 joules)
- 502.3 kJ (or 502.3 kilojoules)
▶ R52 · Fermi estimate: how many piano tuners in a 10-million-person city?author reference Open round →
Fermi Estimation: Piano Tuners in a 10-Million City

Assumption Chain:

1. Households in city:
   Population = 10 million, average household size ≈ 2.5
   Households = 10,000,000 / 2.5 = 4 million

2. Households with pianos:
   Pianos are expensive, luxury items
   Estimate: 2% of households own a piano
   Piano-owning households = 4 million × 0.02 = 80,000

3. Total pianos (including institutional):
   Schools, concert halls, studios, studios: +20% institutional
   Total pianos ≈ 80,000 × 1.2 ≈ 96,000 → round to 100,000

4. Tunings per year (all pianos):
   Private: 1-2 times/year; Professional: 4-6 times/year
   Average: ~2 tunings/year per piano
   Total tunings/year = 100,000 × 2 = 200,000

5. Tunings per tuner per year:
   Time per tuning: 1.5 hours (service) + 0.5 hours (travel/breaks) ≈ 2 hours per job
   Working days/year: ~250 (52 weeks × 5 days, accounting for vacation)
   Real …

Excerpt — the full answer is on the round page.

▶ R53 · Why is the sky blue? (conceptual)author reference Open round →
The sky appears blue because sunlight is made up of different colors, each with different wavelengths. When sunlight enters Earth's atmosphere, it collides with tiny gas molecules (nitrogen and oxygen). Blue light has a shorter wavelength than red light and is scattered much more easily by these small molecules. This scattering sends blue light in all directions across the sky. Your eyes see this scattered blue light coming from every direction, making the sky appear blue. Red and yellow light, which have longer wavelengths, pass straight through the atmosphere more easily, which is why the sun itself looks yellow or orange.

Physical phenomenon: Rayleigh scattering
▶ R54 · Time dilation: why do moving clocks run slow? (conceptual, special relativity)author reference Open round →
Why a Moving Clock Runs Slow:

Imagine you observe a clock moving toward you at very high speed. That clock sends you light signals marking each tick. Because the clock is moving, the light from each tick has to travel at an angle (backward relative to the clock's direction, then toward you). Since the speed of light is always the same for all observers, and the light must cover a longer path in space, the only way this works is if the clock ticks more slowly. Time itself "dilates" when things move relative to you.

Why This Is Symmetric (No Contradiction):

From the moving clock's perspective, YOU are the one moving away, so by the same logic, your clock should appear to run slow to them. This seems contradictory, but it isn't—both observations are simultaneously true. The resolution is that time is relative to your reference frame. Each observer measures times in their own frame as nor …

Excerpt — the full answer is on the round page.

▶ R55 · The double-slit experiment and wave-particle duality (conceptual, quantum mechanics)author reference Open round →
The Double-Slit Experiment Without Detection:

Imagine firing electrons one at a time through two slits toward a screen. You might expect each electron to pass through either the left or right slit, creating two simple bands of hits on the screen (like throwing balls through two holes). Instead, you see an interference pattern—alternating bright and dark stripes, like waves spreading from both slits and canceling or amplifying each other.

This is bizarre because you only fired one electron at a time. How can a single electron interfere with itself? The answer: the electron exists in a quantum superposition—it goes through both slits simultaneously. The electron "waves" from each slit interfere with each other before hitting the screen.

Adding a Which-Path Detector:

Now place a detector at the slits to catch which one each electron goes through. The moment you do this, the interference …

Excerpt — the full answer is on the round page.

▶ R56 · Double-slit interference, particle by particleauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Double Slit Experiment</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; overflow: hidden; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 14px; }
</style>
</head>
<body>
<div id="count">Particles: 0</div>
<canvas id="c" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

let particles = 0;
let dots = [];

const sourceX = 50;
const slitY1 = h / 2 - 40;
const slitY2 = h / 2 + 40;
const slitWidth = 10;
const detectorX = w - 50;

function sampleDetectorY() {
  const y1 = slitY1 + slitWidth / 2;
  const y2 = slitY2 + slitWidth / 2;
  const d1 = Math.abs(y1 - (h / 2));
  const d2 = …

Excerpt — the full answer is on the round page.

▶ R57 · Hanging rope with Verlet integrationauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Verlet Rope Simulation</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

const n = 40;
const gravity = 0.2;
const damping = 0.99;
const segLen = 400 / n;

let pos = [], oldPos = [], pinned = new Set();
let time = 0;

for (let i = 0; i < n; i++) {
  const x = 200 + (i * segLen);
  const y = 100;
  pos[i] = { x, y };
  oldPos[i] = { x, y };
}
pinned.add(0);
pinned.add(n - 1);

function simulate() {
  for (let i = 0; i < n; i++) {
    if (pinned.has(i)) continue;
    const vx = (po …

Excerpt — the full answer is on the round page.

▶ R58 · 2D wave propagation with reflectionauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>2D Wave Equation</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #000; border: 1px solid #0f0; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

const nx = 120, ny = 90;
const dx = w / nx, dy = h / ny;
const dt = 0.1, c = 1, damp = 0.98;

let u = Array(nx * ny).fill(0);
let u_old = Array(nx * ny).fill(0);
let u_new = Array(nx * ny).fill(0);
let time = 0;

function idx(x, y) {
  return Math.max(0, Math.min(nx - 1, x)) * ny + Math.max(0, Math.min(ny - 1, y));
}

function simulate() {
  for (let x = 1; x < nx - 1; x++) {
    for (let y = 1; y < ny - 1; y++) …

Excerpt — the full answer is on the round page.

▶ R59 · Billiard break with spin and frictionauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Billiard Simulation</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #1a3a1a; border: 1px solid #0f0; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

const r = 12;
const friction = 0.98;
const cushionRestitution = 0.8;
const ballRestitution = 0.9;
let balls = [];
let time = 0;

function breakRack() {
  balls = [{ x: 150, y: h / 2, vx: 20, vy: 0 }];
  const pyramid = 0.5;
  for (let row = 0; row < 4; row++) {
    for (let col = 0; col <= row; col++) {
      balls.push({
        x: w - 200 + row * 25,
        y: h / 2 - row * 12 + col * 25,
        vx: 0, …

Excerpt — the full answer is on the round page.

▶ R60 · Dijkstra vs A* on a weighted gridauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dijkstra vs A*</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = 800, h = 500;
const gw = 30, gh = 20;
const cw = w / (2 * gw), ch = h / gh;

let grid = [];
for (let i = 0; i < gw * gh; i++) grid[i] = Math.random() * 10 + 1;

const start = { x: 1, y: 1 };
const goal = { x: gw - 2, y: gh - 2 };

function idx(x, y) { return y * gw + x; }
function heur(a, b) { return Math.abs(a.x - b.x) + Math.abs(a.y - b.y); }

function runDijkstra() {
  const vi …

Excerpt — the full answer is on the round page.

▶ R61 · Convex hull built step by stepauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Graham Scan Convex Hull</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 14px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="step">Step: 0</div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

let points = [];
let hull = [];
let step = 0;
let sorted = [];
let phase = 'sort';
let time = 0;

function reset() {
  points = [];
  for (let i = 0; i < 40; i++) {
    points.push({ x: Math.random() * (w - 100) + 50, y: Math.random() * (h - 100) + 50 });
  }
  const lowest = points.reduce((a, b) => a.y < b.y ? a : b);
  sorted = p …

Excerpt — the full answer is on the round page.

▶ R62 · Huffman tree from letter frequenciesauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Huffman Coding</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

const text = 'the quick brown fox jumps over the lazy dog the fox jumps again';
const freq = {};
for (let c of text) {
  if (c !== ' ') freq[c] = (freq[c] || 0) + 1;
}

class Node {
  constructor(char, f) { this.char = char; this.freq = f; this.left = null; this.right = null; }
}

let heap = Object.entries(freq).map(([c, f]) => new Node(c, f));
le …

Excerpt — the full answer is on the round page.

▶ R63 · Kruskal's MST with union-findauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Kruskal's MST</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

const n = 25;
const nodes = [];
const edges = [];

for (let i = 0; i < n; i++) {
  nodes[i] = {
    x: Math.random() * (w - 100) + 50,
    y: Math.random() * (h - 100) + 50,
    comp: i
  };
}

for (let i = 0; i < n; i++) {
  for (let j = i + 1; j < n; j++) {
    const dx = nodes[j].x - nodes[i].x;
    const dy = nodes[j].y - nodes[i].y;
    const …

Excerpt — the full answer is on the round page.

▶ R64 · N-Queens solved by backtrackingauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>N-Queens Backtracking</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="600" height="700"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height - 50;

let n = 8;
let board = [];
let placements = 0;
let backtracks = 0;
let solving = true;
let time = 0;
let holdTime = 0;
let attacked = new Set();

function isSafe(col) {
  const row = board.length;
  for (let i = 0; i < row; i++) {
    const qCol = board[i];
    if (qCol === col || Math.abs(qCol - col) === Math.abs(i - row)) {
      ret …

Excerpt — the full answer is on the round page.

▶ R65 · Delaunay triangulation, triangle by triangleauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Delaunay Triangulation</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

let points = [];
let triangles = [];
let step = 0;
let time = 0;

function reset() {
  points = [];
  triangles = [];
  step = 0;
  time = 0;
  for (let i = 0; i < 30; i++) {
    points.push({ x: Math.random() * (w - 100) + 50, y: Math.random() * (h - 100) + 50 });
  }
  const huge = 5000;
  triangles.push([
    { x: -huge, y: -huge }, …

Excerpt — the full answer is on the round page.

▶ R66 · AVL tree rebalancing with rotationsauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AVL Tree</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

class Node {
  constructor(key) { this.key = key; this.left = null; this.right = null; this.h = 1; }
  bf() { return (this.left?.h || 0) - (this.right?.h || 0); }
}

let root = null;
let keys = [];
let rotations = 0;
let step = 0;
let time = 0;

function reset() {
  root = null;
  keys = Array(20).fill(0).map((_, i) => Math.floor(Math.random() * 100)); …

Excerpt — the full answer is on the round page.

▶ R67 · Sieve of Eratosthenes on a number gridauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sieve of Eratosthenes</title>
<style>
  body { margin: 0; padding: 10px; font-family: monospace; background: #000; color: #0f0; }
  canvas { display: block; margin: 10px auto; background: #111; border: 1px solid #0f0; }
  div { text-align: center; font-size: 12px; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;

const limit = 400;
const cols = Math.floor(Math.sqrt(limit));
const rows = Math.ceil(limit / cols);
const cellSize = Math.min(w / cols, h / rows) - 1;

let sieve = Array(limit + 1).fill(true);
sieve[0] = sieve[1] = false;

let current = 2;
let multiples = [];
let primeCount = 1;
let eliminated = 0;
let step = 0;
let time = 0;
let colors = { …

Excerpt — the full answer is on the round page.

▶ R68 · Edit-distance DP matrix with backtraceauthor reference Open round →
<!DOCTYPE html><html><head><title>r68</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=900;c.height=600;
let a="kitten",b="sitting",m=a.length+1,n=b.length+1;
let d=Array(m).fill(0).map(()=>Array(n).fill(0));
for(let i=0;i<m;i++)d[i][0]=i;for(let j=0;j<n;j++)d[0][j]=j;
let f=0,p=0,t=m*n,path=[],bt=0;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,900,600);
  if(p<t-1){let i=Math.floor((p+1)/n);let j=(p+1)%n;if(i>0&&j>0){
    let s=d[i-1][j-1]+(a[i-1]!==b[j-1]?1:0),de=d[i-1][j]+1,in_=d[i][j-1]+1;
    d[i][j]=Math.min(s,de,in_);f++;p++;
  }}else if(bt<m+n){
    if(!path.length)path=[m-1,n-1];
    let i=path[path.length-2]||m-1,j=path[path.length-1]||n-1;
    if(i>0||j>0){
      if(i>0&&j>0&&d[i-1][j-1]<=d[i-1][j]&&d[i-1][j-1]<=d[i][j-1])path.push(i-1,j-1);
      else if(i>0&&d[i-1][j]<d[i][j-1])path.push(i-1,j); …

Excerpt — the full answer is on the round page.

▶ R69 · Replanning when the map changesauthor reference Open round →
<!DOCTYPE html><html><head><title>r69</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let W=30,H=20,g=Array(H).fill(0).map(()=>Array(W).fill(0));
let rx=2,ry=2,gx=W-2,gy=H-2,path=[],t=0,rep=0,steps=0;
function astar(){
  let open=[{x:rx,y:ry,f:0,g:0}],closed=new Set(),par=new Map();
  while(open.length){
    open.sort((a,b)=>a.f-b.f);let cur=open.shift();
    if(cur.x===gx&&cur.y===gy){
      path=[{x:gx,y:gy}];
      while(par.has(cur.x+","+cur.y)){let p=par.get(cur.x+","+cur.y);path.unshift(p);cur=p;}
      return true;
    }
    closed.add(cur.x+","+cur.y);
    for(let[dx,dy]of[[1,0],[-1,0],[0,1],[0,-1]]){
      let nx=cur.x+dx,ny=cur.y+dy;
      if(nx<0||nx>=W||ny<0||ny>=H||g[ny][nx]||closed.has(nx+","+ny))continue;
      let ng=cur.g+1,nf=ng+Math.abs(nx-gx)+Math.abs(ny-gy);
      if(!open.find(o=> …

Excerpt — the full answer is on the round page.

▶ R70 · Binary search, step by stepauthor reference Open round →
<!DOCTYPE html><html><head><title>r70</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let n=40,arr=Array(n).fill(0).map((v,i)=>i*25+Math.floor(Math.random()*5));
let lo=0,hi=n-1,mid=(lo+hi)>>1,cmp=0,done=false,tgt=arr[Math.floor(Math.random()*n)],t=0;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  let w=Math.floor(750/n);
  // Draw bars
  x.fillStyle="#000";x.font="10px mono";
  for(let i=0;i<n;i++){
    let h=(arr[i]/1000)*300;
    if(i<lo||i>hi)x.fillStyle="#ccc";else if(i===mid)x.fillStyle="#f00";else if(i<mid)x.fillStyle="#0f0";else x.fillStyle="#00f";
    x.fillRect(i*w+10,500-h,w-2,h);
    if(i%5===0)x.fillText(arr[i],i*w+10,520);
  }
  // Search step
  if(!done){
    if(arr[mid]===tgt){done=true;}
    else if(arr[mid]<tgt){lo=mid+1;cmp++;}
    else{hi=mid-1;cmp++;}
    mid=(lo+ …

Excerpt — the full answer is on the round page.

▶ R71 · Flood fill on a pixel gridauthor reference Open round →
<!DOCTYPE html><html><head><title>r71</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let W=60,H=40,g=Array(H).fill(0).map(()=>Array(W).fill(0));
let cols=["#f00","#0f0","#00f","#ff0","#f0f","#0ff"];
for(let i=0;i<5;i++){let cx=Math.random()*W,cy=Math.random()*H;
  for(let j=0;j<Math.random()*30+10;j++){let nx=cx+Math.random()*8-4,ny=cy+Math.random()*8-4;
    if(nx>=0&&nx<W&&ny>=0&&ny<H)g[Math.floor(ny)][Math.floor(nx)]=i+1;
  }
}
let sx=Math.floor(Math.random()*W),sy=Math.floor(Math.random()*H);
let tgt=g[sy][sx],q=[{x:sx,y:sy}],vis=new Set(),fill=0,front=1;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  let s=Math.floor(750/W);
  // Grid
  for(let i=0;i<H;i++)for(let j=0;j<W;j++){
    if(vis.has(j+","+i))x.fillStyle="#888";else x.fillStyle=tgt===g[i][j]&&g[i][j]>0?cols[g[i][j]-1]:"# …

Excerpt — the full answer is on the round page.

▶ R72 · Maze generation by recursive backtrackingauthor reference Open round →
<!DOCTYPE html><html><head><title>r72</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let W=30,H=20,m=Array(H).fill(0).map(()=>Array(W).fill(1));
let st=[],cur={x:0,y:0},vis=new Set(),cv=0,sd=0;
function ca(){
  st=[];cur={x:0,y:0};vis=new Set();cv=0;sd=0;
  m=Array(H).fill(0).map(()=>Array(W).fill(1));
}
function step(){
  if(!cur){ca();return;}
  let k=cur.x+","+cur.y;if(!vis.has(k)){vis.add(k);cv++;m[cur.y][cur.x]=0;}
  let dirs=[[2,0],[0,2],[-2,0],[0,-2]].sort(()=>Math.random()-0.5);
  let found=false;
  for(let[dx,dy]of dirs){
    let nx=cur.x+dx,ny=cur.y+dy;
    if(nx>0&&nx<W&&ny>0&&ny<H&&!vis.has(nx+","+ny)){
      m[cur.y+dy/2][cur.x+dx/2]=0;st.push(cur);cur={x:nx,y:ny};sd=st.length;found=true;break;
    }
  }
  if(!found&&st.length){cur=st.pop();sd=st.length;}
  else if(!found){if(cv<W*H-1)set …

Excerpt — the full answer is on the round page.

▶ R73 · KMP string search with prefix tableauthor reference Open round →
<!DOCTYPE html><html><head><title>r73</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=900;c.height=600;
let p="ABABD",t="ABABDABABAC",m=[0];
// Prefix table
for(let i=1;i<p.length;i++){let j=m[i-1];
  while(j>0&&p[i]!==p[j])j=m[j-1];m.push(p[i]===p[j]?j+1:0);
}
let i=0,j=0,cmp=0,found=[],phase=0,t_=0;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,900,600);
  x.fillStyle="#000";x.font="14px mono";
  // Prefix table
  x.fillText("Pattern: "+p,50,50);
  x.fillText("Text:    "+t,50,80);
  x.fillText("Prefix:  "+m.join(" "),50,110);
  // Text comparison
  x.fillText("Text:",50,200);for(let k=0;k<t.length;k++){
    x.fillStyle=k===i?"#f00":(found.some(f=>f.includes(k))?"#0f0":"#000");
    x.fillText(t[k],100+k*20,200);
  }
  x.fillText("Pattern:",50,250);for(let k=0;k<p.length;k++){
    x.fillStyle=k===j?"#00f":"#000"; …

Excerpt — the full answer is on the round page.

▶ R74 · Quadtree collision detectionauthor reference Open round →
<!DOCTYPE html><html><head><title>r74</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let b=Array(120).fill(0).map(()=>({x:Math.random()*700+50,y:Math.random()*500+50,vx:(Math.random()-0.5)*4,vy:(Math.random()-0.5)*4,r:5}));
class Q{constructor(x,y,w,h,d){this.x=x;this.y=y;this.w=w;this.h=h;this.d=d;this.c=[];this.sub=null;}
  insert(p){if(this.sub){this.sub.forEach(s=>s.insert(p));return;}
    this.c.push(p);if(this.c.length>4&&this.d<3)this.split();
  }
  split(){let hw=this.w/2,hh=this.h/2;this.sub=[
    new Q(this.x,this.y,hw,hh,this.d+1),new Q(this.x+hw,this.y,hw,hh,this.d+1),
    new Q(this.x,this.y+hh,hw,hh,this.d+1),new Q(this.x+hw,this.y+hh,hw,hh,this.d+1)];
    this.c.forEach(p=>this.sub.forEach(s=>s.insert(p)));this.c=[];
  }
  query(x,y,w,h){let r=[];if(x+w<this.x||y+h<this.y||x>this.x+this …

Excerpt — the full answer is on the round page.

▶ R75 · Falling sand on a cell gridauthor reference Open round →
<!DOCTYPE html><html><head><title>r75</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let W=150,H=100,g=Array(H).fill(0).map(()=>Array(W).fill(0));
let rest=0,step=0;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  let s=Math.floor(750/W);
  // Pour sand
  if(Math.random()>0.7){g[0][Math.floor(Math.random()*W)]=1;}
  // Update
  let ng=Array(H).fill(0).map(()=>Array(W).fill(0));
  for(let i=0;i<H;i++)for(let j=0;j<W;j++){ng[i][j]=g[i][j];}
  for(let i=H-2;i>=0;i--){for(let j=0;j<W;j++){
    if(g[i][j]){
      if(i+1<H&&!g[i+1][j]){ng[i][j]=0;ng[i+1][j]=1;}
      else if(i+1<H&&j>0&&!g[i+1][j-1]){ng[i][j]=0;ng[i+1][j-1]=1;}
      else if(i+1<H&&j+1<W&&!g[i+1][j+1]){ng[i][j]=0;ng[i+1][j+1]=1;}
    }
  }}
  g=ng;
  // Count rest
  rest=0;
  for(let i=0;i<H;i++)for(let j=0;j<W;j++){if(g[i] …

Excerpt — the full answer is on the round page.

▶ R76 · Falling sand as free particlesauthor reference Open round →
<!DOCTYPE html><html><head><title>r76</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let g=9.8,p=[],rest=0,maxh=0;
for(let i=0;i<1500;i++){p.push({x:Math.random()*780+10,y:-30,vx:0,vy:0,r:2});}
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  // Update
  let moving=0;
  p.forEach(pa=>{
    pa.vy+=g*0.016;pa.y+=pa.vy*0.016;pa.x+=pa.vx*0.016;
    if(pa.y>560){pa.y=560;pa.vy*=-0.3;if(Math.abs(pa.vy)<1)pa.vy=0;}
    if(pa.x<10)pa.x=10;if(pa.x>790)pa.x=790;
    if(Math.abs(pa.vy)<0.1&&pa.y>555)rest++;else moving++;
    maxh=Math.max(maxh,600-pa.y);
  });
  // Draw
  x.fillStyle="#d4a574";
  p.forEach(pa=>{x.beginPath();x.arc(pa.x,pa.y,pa.r,0,Math.PI*2);x.fill();});
  // Gravity indicator
  x.strokeStyle="#999";x.lineWidth=1;
  for(let i=0;i<800;i+=50){x.beginPath();x.moveTo(i,565);x.lineTo( …

Excerpt — the full answer is on the round page.

▶ R77 · Crowd leaving a room, cell by cellauthor reference Open round →
<!DOCTYPE html><html><head><title>r77</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let W=40,H=30,ppl=Array(60).fill(0).map(()=>({x:Math.floor(Math.random()*W),y:Math.floor(Math.random()*H),left:false}));
let g=Array(H).fill(0).map((,i)=>Array(W).fill(999));
// Distance field from exit (37, H/2)
for(let i=0;i<H;i++)g[i][W-1]=Math.abs(i-Math.floor(H/2));
for(let r=W-2;r>=0;r--)for(let i=0;i<H;i++){
  g[i][r]=Math.min(g[i][r],Math.min(g[i][r+1],i>0?g[i-1][r+1]:999,i<H-1?g[i+1][r+1]:999)+1);
}
let left=0,step=0;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  let s=Math.floor(750/W);
  // Heatmap
  for(let i=0;i<H;i++)for(let j=0;j<W;j++){
    let v=Math.min(g[i][j]/W*255,255);x.fillStyle=`rgb(${255-v},${v/2},${v/2})`;
    x.fillRect(j*s+10,i*s+10,s,s);
  }
  // Move people
  let occ=Ar …

Excerpt — the full answer is on the round page.

▶ R78 · Crowd leaving a room by steeringauthor reference Open round →
<!DOCTYPE html><html><head><title>r78</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let ppl=Array(60).fill(0).map(()=>({x:Math.random()*600+50,y:Math.random()*400+50,vx:0,vy:0,r:4,left:false}));
let gx=700,gy=300,left=0;
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  // Update
  ppl.forEach(p=>{
    if(!p.left){
      let dx=gx-p.x,dy=gy-p.y,d=Math.sqrt(dx*dx+dy*dy);
      if(d<10){p.left=true;left++;return;}
      // Steer to exit
      p.vx+=(dx/d)*0.1;p.vy+=(dy/d)*0.1;
      // Separate
      ppl.forEach(q=>{if(p!==q&&!q.left){
        let edx=q.x-p.x,edy=q.y-p.y,ed=Math.sqrt(edx*edx+edy*edy);
        if(ed<15){p.vx-=(edx/ed)*0.2;p.vy-=(edy/ed)*0.2;}
      }});
      // Damping
      p.vx*=0.95;p.vy*=0.95;
      // Limit speed
      let sv=Math.sqrt(p.vx*p.vx+p.vy*p.vy);if(sv>2){ …

Excerpt — the full answer is on the round page.

▶ R79 · Aggregation on a latticeauthor reference Open round →
<!DOCTYPE html><html><head><title>r79</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let W=200,H=150,g=Array(H).fill(0).map(()=>Array(W).fill(0));
g[Math.floor(H/2)][Math.floor(W/2)]=1;
let w=[],frozen=1,maxr=0;
for(let i=0;i<200;i++)w.push({x:Math.floor(Math.random()*W),y:Math.floor(Math.random()*H)});
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  let s=Math.floor(750/W);
  // Update walkers
  let nw=[];
  w.forEach(wa=>{
    let r=Math.floor(Math.random()*4),dx=[1,-1,0,0][r],dy=[0,0,1,-1][r];
    let nx=(wa.x+dx+W)%W,ny=(wa.y+dy+H)%H;
    if(g[ny][nx]){g[wa.y][wa.x]=1;frozen++;
      let d=Math.sqrt((wa.x-W/2)**2+(wa.y-H/2)**2);maxr=Math.max(maxr,d);
    }else{wa.x=nx;wa.y=ny;nw.push(wa);}
  });
  w=nw;
  // Add walkers
  if(Math.random()>0.7&&w.length<300)w.push({x:Math.floor(Mat …

Excerpt — the full answer is on the round page.

▶ R80 · Aggregation by continuous driftauthor reference Open round →
<!DOCTYPE html><html><head><title>r80</title></head><body><canvas id="c"></canvas><script>
let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=600;
let p=[],stuck=[],c_=[400,300],crad=10,sw=200,sh=150;
for(let i=0;i<800;i++)p.push({x:Math.random()*sw,y:Math.random()*sh,vx:(Math.random()-0.5)*2,vy:(Math.random()-0.5)*2});
function draw(){
  x.fillStyle="#fff";x.fillRect(0,0,800,600);
  let s=Math.floor(750/sw);
  // Update
  let ns=[];
  p.forEach(pa=>{
    // Brownian
    pa.vx+=(Math.random()-0.5)*0.2;pa.vy+=(Math.random()-0.5)*0.2;
    // Drift to center
    let dx=c_[0]/s-pa.x,dy=c_[1]/s-pa.y,d=Math.sqrt(dx*dx+dy*dy);
    if(d>1){pa.vx+=dx/d*0.05;pa.vy+=dy/d*0.05;}
    pa.x+=pa.vx;pa.y+=pa.vy;
    // Damping
    pa.vx*=0.98;pa.vy*=0.98;
    // Wrap
    if(pa.x<0)pa.x+=sw;if(pa.x>=sw)pa.x-=sw;if(pa.y<0)pa.y+=sh;if(pa.y>=sh)pa.y-=sh;
    // Check collision
    i …

Excerpt — the full answer is on the round page.

▶ R82 · Conway's Game of Life with seeded patternsauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const W=120,H=80,S=6;const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=W*S;c.height=H*S;let s=new Uint8Array(W*H),a=new Uint8Array(W*H),g=0;function sd(){s.fill(0);a.fill(0);g=0;const p=[[1,0],[2,1],[0,2],[1,2],[2,2]];p.forEach(([x,y])=>{let idx=(y+5)*W+(x+5);if(idx>=0&&idx<W*H)s[idx]=1});[[30,30],[31,30],[32,30]].forEach(([x,y])=>{let idx=y*W+x;if(idx>=0&&idx<W*H)s[idx]=1});for(let i=0;i<W*H/8;i++){let idx=Math.floor(Math.random()*W*H);s[idx]=1}}function st(){let n=new Uint8Array(W*H);let ch=false;for(let y=0;y<H;y++){for(let x=0;x<W;x++){let idx=y*W+x;let nc=0;for(le …

Excerpt — the full answer is on the round page.

▶ R83 · Fourier epicycles tracing a shapeauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const mx=c.width/2,my=c.height/2;let path=[];const N=30;let coef=[];for(let k=-N;k<=N;k++){let r=0,im=0;for(let t=0;t<64;t++){let a=t/64*Math.PI*2;let x=150*Math.cos(a)+100*Math.cos(3*a),y=150*Math.sin(a)+100*Math.sin(3*a);r+=x*Math.cos(k*a);im+=x*Math.sin(k*a)}coef.push({r:r/64,i:im/64})}function f(t){let x=0,y=0;for(let k=0;k<coef.length;k++){let ang=k*t;x+=coef[k].r*Math.cos(ang)-coef[k].i*Math.sin(ang);y+=coef[k].r*Math.sin(ang)+coef[k].i*Math.cos(ang)}return{x:x/coef.length,y:y/coef.length}}functio …

Excerpt — the full answer is on the round page.

▶ R84 · Voronoi cells with moving seedsauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const W=800,H=600;let s=[];for(let j=0;j<25;j++){s.push({x:Math.random()*W,y:Math.random()*H,vx:(Math.random()-0.5)*2,vy:(Math.random()-0.5)*2})}function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,W,H);let cn=new Uint32Array(25);for(let py=0;py<H;py+=2){for(let px=0;px<W;px+=2){let mi=0,md=1e9;for(let j=0;j<25;j++){let d=(s[j].x-px)**2+(s[j].y-py)**2;if(d<md){md=d;mi=j}}cn[mi]++;ctx.fillStyle=`hsl(${mi*14},100%,50%)`;ctx.fillRect(px,py,2,2)}}for(let j=0;j<25;j++){s[j].x+=s[j].vx;s[j].y+=s[j].vy;if(s[j]. …

Excerpt — the full answer is on the round page.

▶ R85 · Travelling salesman improved by 2-optauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;let ct=[];for(let j=0;j<60;j++){ct.push({x:Math.random()*700+50,y:Math.random()*500+50})}function d(p1,p2){return Math.hypot(p1.x-p2.x,p1.y-p2.y)}function tl(t){let l=0;for(let j=0;j<t.length;j++){l+=d(ct[t[j]],ct[t[(j+1)%t.length]])}return l}let t=Array.from({length:60},((_,i)=>i));t=[t[0]];let u=new Set([0]);for(let j=1;j<60;j++){let mi=-1,md=1e9;for(let k=0;k<60;k++){if(!u.has(k)){let d2=d(ct[t[t.length-1]],ct[k]);if(d2<md){md=d2;mi=k}}}t.push(mi);u.add(mi)}let im=0;function dr(){ctx.fillStyle='#000' …

Excerpt — the full answer is on the round page.

▶ R86 · Scrolling terrain from value noiseauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=400;const W=800,H=400;let p={};function pn(x){let xi=Math.floor(x),xf=x-xi;let i0=xi%256,i1=(xi+1)%256;if(!p[i0])p[i0]=Math.random();if(!p[i1])p[i1]=Math.random();let u=xf*xf*(3-2*xf);return p[i0]*(1-u)+p[i1]*u}function n(x){let v=0,a=1,f=1;for(let j=0;j<3;j++){v+=a*pn(x*f);a/=2;f*=2}return v}function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,W,H);let t=(Date.now()/30)%256;for(let x=0;x<W;x++){let v=n((x+t)*0.01);let h=Math.floor(v*H);let col;if(v<0.3)col='#00f';else if(v<0.45)col='#d4a574';else if(v<0.7)c …

Excerpt — the full answer is on the round page.

▶ R87 · Gray-Scott reaction-diffusionauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=600;c.height=600;const S=120,sz=S*S,du=0.16,dv=0.08,f=0.035,k=0.065;let u=new Float32Array(sz),v=new Float32Array(sz),nu=new Float32Array(sz),nv=new Float32Array(sz);u.fill(1);v.fill(0);for(let j=40;j<80;j++){for(let l=40;l<80;l++){u[j*S+l]=0.5;v[j*S+l]=0.25}}let st=0;function dr(){for(let y=1;y<S-1;y++){for(let x=1;x<S-1;x++){let j=y*S+x;let la=(u[j-1]+u[j+1]+u[j-S]+u[j+S]-4*u[j]);let lb=(v[j-1]+v[j+1]+v[j-S]+v[j+S]-4*v[j]);nu[j]=u[j]+du*la-u[j]*v[j]*v[j]+f*(1-u[j]);nv[j]=v[j]+dv*lb+u[j]*v[j]*v[j]-(k+f)*v[j]}}[u,v]=[nu …

Excerpt — the full answer is on the round page.

▶ R88 · L-system tree growing in windauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;let ls='F';for(let j=0;j<4;j++){ls=ls.replace(/F/g,'FF[F]-[F]')}let br=0,mx=400,my=550;function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,800,600);ctx.strokeStyle='#0f0';ctx.lineWidth=1;let st=[],x=mx,y=my,ang=Math.PI/2;let wnd=(Math.sin(Date.now()/1000)*0.3);for(let ch of ls){if(ch==='F'){let nx=x+Math.cos(ang+wnd)*8,ny=y-Math.sin(ang+wnd)*8;ctx.beginPath();ctx.moveTo(x,y);ctx.lineTo(nx,ny);ctx.stroke();x=nx;y=ny;br++}else if(ch==='['){st.push({x,y,a:ang})}else if(ch===']'){let p=st.pop();x=p.x;y=p.y; …

Excerpt — the full answer is on the round page.

▶ R89 · Marching squares on a moving fieldauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const W=800,H=600,G=20;let mb=[];for(let j=0;j<4;j++){mb.push({x:Math.random()*W,y:Math.random()*H,vx:(Math.random()-0.5),vy:(Math.random()-0.5)})}let sg=0;function v(x,y){let s=0;for(let m of mb){let d=Math.hypot(x-m.x,y-m.y);if(d<200)s+=1000/(d*d+1)}return s}function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,W,H);for(let m of mb){m.x+=m.vx;m.y+=m.vy;if(m.x<0||m.x>W)m.vx*=-1;if(m.y<0||m.y>H)m.vy*=-1;m.x=Math.max(0,Math.min(W,m.x));m.y=Math.max(0,Math.min(H,m.y))}sg=0;ctx.strokeStyle='#0f0';ctx.lineWid …

Excerpt — the full answer is on the round page.

▶ R90 · Poisson-disk sampling, Bridson's algorithmauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const W=800,H=600,r=20,gx=Math.ceil(W/r),gy=Math.ceil(H/r);let gr=Array(gx*gy).fill(null);let sp=[],ac=[];function a(x,y){let gxi=Math.floor(x/r),gyi=Math.floor(y/r);if(gxi<0||gxi>=gx||gyi<0||gyi>=gy)return true;for(let dy=-2;dy<=2;dy++){for(let dx=-2;dx<=2;dx++){let gi=(gyi+dy)*gx+(gxi+dx);if(gi>=0&&gi<gr.length&&gr[gi]){let p=gr[gi];if(Math.hypot(p.x-x,p.y-y)<r)return true}}}return false}let d=false;function dr(){if(!d){if(ac.length===0){if(sp.length===0){let p={x:Math.random()*W,y:Math.random()*H};if …

Excerpt — the full answer is on the round page.

▶ R91 · Starfield tunnel in perspectiveauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const cx=400,cy=300;let st=[];for(let j=0;j<400;j++){st.push({x:(Math.random()-0.5)*400,y:(Math.random()-0.5)*300,z:Math.random()*500+100})}let sp=5;function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,800,600);let n=[];for(let s of st){s.z-=sp;if(s.z<10){s.x=(Math.random()-0.5)*400;s.y=(Math.random()-0.5)*300;s.z=500}}for(let s of st){if(s.z>0){let px=cx+s.x/(s.z/50);let py=cy+s.y/(s.z/50);if(px>0&&px<800&&py>0&&py<600){let b=Math.floor(255*(1-s.z/500));let sz=Math.max(1,(100-s.z)/100);ctx.fillStyle=`rg …

Excerpt — the full answer is on the round page.

▶ R92 · Rotating wireframe solids with depth sortingauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const v=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]];const e=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[1,5],[2,6],[3,7]];const v2=[[0,0,1],[1,0,0],[0,1,0]];const e2=[[0,1],[1,2],[2,0]];function rx(p,a){let c=Math.cos(a),s=Math.sin(a);return[p[0],p[1]*c-p[2]*s,p[1]*s+p[2]*c]}function ry(p,a){let c=Math.cos(a),s=Math.sin(a);return[p[0]*c+p[2]*s,p[1],-p[0]*s+p[2]*c]}function prj(p){return[400+p[0]/p[2]*200,300+p[1]/p[2]*200]}let t=Date.now()/1000;let rx1=rx,ry …

Excerpt — the full answer is on the round page.

▶ R93 · Rotating wireframe height fieldauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const G=20;function h(x,y,t){return Math.sin(x/10+t/500)*Math.cos(y/10+t/500)*10}function rx(p,a){let c=Math.cos(a),s=Math.sin(a);return[p[0],p[1]*c-p[2]*s,p[1]*s+p[2]*c]}function ry(p,a){let c=Math.cos(a),s=Math.sin(a);return[p[0]*c+p[2]*s,p[1],-p[0]*s+p[2]*c]}function prj(p){return[400+p[0]/Math.max(0.1,p[2])*100,300+p[1]/Math.max(0.1,p[2])*100]}function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,800,600);let t=Date.now();let ax=t/3000,ay=t/2000;let gr=[];for(let y=0;y<=G;y++){let row=[];for(let x=0;x …

Excerpt — the full answer is on the round page.

▶ R94 · Raycast maze walkthroughauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const mz=[[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]];let cx=1.5,cy=1.5,a=0;function dr(){ctx.fillStyle='#111';ctx.fillRect(0,0,800,600);let fov=Math.PI/3;let dx=Math.cos(a),dy=Math.sin(a);for(let col=0;col<800;col++){let ang=a-fov/2+fov*col/800;let rdx=Math.cos(ang),rdy=Math.sin(ang);let dist=1e9;for(let s=0;s<100;s+=0.1){let rx=cx+rdx*s,ry=cy+rdy*s;let mx=Math.floor(rx),my=Math.floor(ry);if(mx<0||mx>=5||my<0||my>=5||mz[my][mx]){dist=s;break}}let c_dist=dist*Math.cos(ang-a);let h=Math. …

Excerpt — the full answer is on the round page.

▶ R95 · Shaded sphere by painter's algorithmauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #666}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Points: <span id="n">500</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=600;
let pts=[],a=[0,0,0];
function gen(n){pts=[];for(let i=0;i<n;i++){const p=Math.acos(1-2*i/n),t=Math.PI*(3-Math.sqrt(5))*i;pts.push({x:Math.sin(p)*Math.cos(t),y:Math.cos(p),z:Math.sin(p)*Math.sin(t)});}document.getElementById('n').textContent=n;}
function rot(p,x,y,z,a){const c=Math.cos(a),s=Math.sin(a);let r=p;if(x)r={x:r.x,y:r.y*c-r.z*s,z:r.y*s+r.z*c};else if(y)r={x:r.x*c+r.z*s, …

Excerpt — the full answer is on the round page.

▶ R96 · Force-directed graph settlingauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #666}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Nodes: 25 | Energy: <span id="e">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=700;c.height=500;
let g={n:[],e:[]};
function init(){g={n:[],e:[]};for(let i=0;i<25;i++)g.n.push({x:Math.random()*c.width,y:Math.random()*c.height,vx:0,vy:0});const adj=[[0,1],[1,2],[2,3],[3,4],[4,0],[0,5],[1,6],[2,7],[3,8],[4,9],[5,10],[6,11],[7,12],[8,13],[9,14],[10,15],[11,16],[12,17],[13,18],[14,19],[5,20],[6,21],[7,22],[8,23],[9,24]];g.e=adj;}
function step(){const d=0.01,f=100,k=50 …

Excerpt — the full answer is on the round page.

▶ R97 · Circle packing without overlapauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #666}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Circles: <span id="n">0</span> | Coverage: <span id="p">0</span>%</div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=500;c.height=500;
let circles=[];
function newRound(){circles=[];}
function canPlace(x,y,r){if(x-r<0||x+r>c.width||y-r<0||y+r>c.height)return 0;for(let ci of circles){const dx=ci.x-x,dy=ci.y-y,d=Math.sqrt(dx*dx+dy*dy);if(d<ci.r+r+1)return 0;}return 1;}
function grow(x,y){let r=1;while(canPlace(x,y,r))r++;return r-1;}
function f(){if(circles.length<150){let ok=0;fo …

Excerpt — the full answer is on the round page.

▶ R98 · Squarified treemap of changing dataauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #666}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Items: 20</div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=400;
let data=[],rects=[],t=0;
function init(){data=[];for(let i=0;i<20;i++)data.push({val:Math.random()*100,id:i,x:0,y:0,w:0,h:0,tx:0,ty:0,tw:0,th:0});}
function treemap(items,x,y,w,h,depth=0){if(items.length===0)return;if(items.length===1){items[0].tx=x;items[0].ty=y;items[0].tw=w;items[0].th=h;return;}
const total=items.reduce((a,b)=>a+b.val,0);const vert=w>=h;const s=(vert?h:w);let row=[],rowSum=0,rowA …

Excerpt — the full answer is on the round page.

▶ R99 · Three sorting algorithms racingauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #666}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:11px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Bubble: <span id="b">0</span> | Insert: <span id="in">0</span> | Quick: <span id="q">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=900;c.height=300;
let bubble,insert,quick,base;
function init(){base=[];for(let i=0;i<60;i++)base.push(Math.random()*100);bubble={a:base.slice(),cmp:0,done:0,ci:0,cj:0};insert={a:base.slice(),cmp:0,done:0,ci:0,cj:0};quick={a:base.slice(),cmp:0,done:0,ci:0,cj:0};}
function bubbleStep(){if(bubble.done)return;for(let s=0;s<3;s++){if(bubble …

Excerpt — the full answer is on the round page.

▶ R100 · Sankey flow with travelling particlesauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #666}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Total: <span id="t">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=700;c.height=400;
let flows=[],part=[],time=0;
function init(){flows=[[10,12,15],[20,10,8],[8,18,12]];for(let s=0;s<3;s++){for(let t=0;t<4;t++){for(let p=0;p<Math.floor(flows[s][t%3])/3;p++){part.push({s,t,p:Math.random(),age:0});}}}
}
function f(){time+=0.016;flows.forEach((f,i)=>{f.forEach((v,j)=>{f[j]+=Math.sin(time*0.5+i*1.5+j*0.3)*0.3;f[j]=Math.max(1,f[j]);});});
ctx.fillStyle='#000';ctx.fillRec …

Excerpt — the full answer is on the round page.

▶ R101 · Langton's ant building a highwayauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Steps: <span id="s">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=600;
const sz=3;const w=Math.floor(c.width/sz),h=Math.floor(c.height/sz);
let grid=new Uint8Array(w*h),ant={x:w>>1,y:h>>1,d:0},steps=0;
function f(){for(let i=0;i<300;i++){const idx=ant.y*w+ant.x;const isWhite=grid[idx]===0;if(isWhite){ant.d=(ant.d+1)%4;grid[idx]=1;}else{ant.d=(ant.d+3)%4;grid[idx]=0;}
const dx=[1,0,-1,0],dy=[0,1,0,-1];ant.x+=dx[ant.d];ant.y+=dy[ant.d];ant.x=(ant.x+w)%w; …

Excerpt — the full answer is on the round page.

▶ R102 · Rule 110 growing line by lineauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Row: <span id="r">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=600;
const sz=2;const w=Math.floor(c.width/sz),h=Math.floor(c.height/sz);
const rule=110;let current=new Uint8Array(w),scroll=0,row=0;
current[w>>1]=1;
function step(){const next=new Uint8Array(w);for(let x=0;x<w;x++){const l=current[(x-1+w)%w],c=current[x],r=current[(x+1)%w];const idx=(l<<2)|(c<<1)|r;next[x]=(rule>>(idx))&1;}
current=next;row++;}
function f(){for(let i=0;i<3;i++)step();if …

Excerpt — the full answer is on the round page.

▶ R103 · Wireworld with a clock and a diodeauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Steps: <span id="s">0</span> | Electrons: <span id="e">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=500;c.height=500;
const sz=2;const w=250,h=250;let grid=new Uint8Array(w*h),steps=0;
for(let x=10;x<100;x++)grid[50*w+x]=1;grid[50*w+50]=2;
for(let y=50;y<100;y++)grid[y*w+100]=1;grid[75*w+100]=2;
for(let x=100;x<150;x++)grid[100*w+x]=1;
for(let y=50;y<100;y++)grid[y*w+50]=1;
function f(){const next=new Uint8Array(w*h);for(let y=0;y<h;y++){for(let x=0;x<w;x++){const …

Excerpt — the full answer is on the round page.

▶ R104 · Abelian sandpile topplingauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Grains: <span id="g">0</span> | Topplings: <span id="t">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=500;c.height=500;
const sz=2;const w=250,h=250;let grid=new Uint8Array(w*h),grains=0,topplings=0;
function f(){grains++;grid[(h>>1)*w+(w>>1)]+=4;let changed=1;while(changed){changed=0;for(let y=0;y<h;y++){for(let x=0;x<w;x++){const idx=y*w+x;if(grid[idx]>=4){topplings++;const g=grid[idx]>>2;grid[idx]&=3;if(y>0)grid[(y-1)*w+x]+=g;if(y<h-1)grid[(y+1)*w+x]+=g;if(x>0)g …

Excerpt — the full answer is on the round page.

▶ R105 · Brian's Brainauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Gen: <span id="g">0</span> | Live: <span id="l">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=600;
const sz=5;const w=120,h=120;
let grid=new Uint8Array(w*h),next=new Uint8Array(w*h),gen=0;
for(let i=0;i<w*h;i++)grid[i]=Math.random()>0.7?1:0;
function f(){next.fill(0);for(let y=0;y<h;y++){for(let x=0;x<w;x++){const idx=y*w+x;const c=grid[idx];let cnt=0;for(let dy=-1;dy<=1;dy++){for(let dx=-1;dx<=1;dx++){if(dx===0&&dy===0)continue;const nx=(x+dx+w)%w,ny …

Excerpt — the full answer is on the round page.

▶ R106 · Truchet tiles rearrangingauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Grid: 20x20 | Flipped: <span id="f">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=600;
const g=20;const s=c.width/g;let tiles=new Uint8Array(g*g),flipped=0,time=0;
for(let i=0;i<g*g;i++)tiles[i]=Math.random()>0.5?1:0;
function f(){time+=0.016;if(Math.random()<0.05){const idx=Math.floor(Math.random()*g*g);tiles[idx]=1-tiles[idx];flipped++;}
ctx.fillStyle='#000';ctx.fillRect(0,0,c.width,c.height);ctx.strokeStyle='#333';ctx.lineWidth=0.5;
for(let y=0;y<g; …

Excerpt — the full answer is on the round page.

▶ R107 · Hilbert curve drawing itselfauthor reference Open round →
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{border:1px solid #333}#i{position:absolute;top:10px;left:10px;color:#fff;font-family:monospace;font-size:12px}</style></head>
<body>
<canvas id="c"></canvas>
<div id="i">Order: <span id="o">5</span> | Points: <span id="p">0</span></div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d');
c.width=600;c.height=600;
let order=5,points=[],idx=0,drawn=0;
function hilbert(x,y,ax,ay,bx,by,n){if(n<=0){points.push([x+ax/2+bx/2,y+ay/2+by/2]);}else{hilbert(x,y,bx/2,by/2,ax/2,ay/2,n-1);hilbert(x+ax/2,y+ay/2,ax/2,ay/2,bx/2,by/2,n-1);hilbert(x+ax/2+bx/2,y+ay/2+by/2,ax/2,ay/2,bx/2,by/2,n-1);hilbert(x+ax+bx/2,y+ay+by/2,-bx/2,-by/2,-ax/2,-ay/2,n-1);}}
function build(n){points= …

Excerpt — the full answer is on the round page.

▶ R108 · Interlocking star pattern on a gridauthor reference Open round →
<!DOCTYPE html><html><head><title>Islamic Stars</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#fff;font-family:mono;font-size:11px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=600;const n=6,s=70;
function d(){x.fillStyle='#000';x.fillRect(0,0,600,600);x.strokeStyle='#ccc';x.lineWidth=0.7;let t=0;x.save();x.translate(300,300);x.rotate(performance.now()*0.00008);for(let a=-n;a<=n;a++){for(let b=-n;b<=n;b++){const px=a*s,py=b*s;const r=30;for(let j=0;j<12;j++){const a1=j*Math.PI/6,a2=(j+1)*Math.PI/6;const x1=px+r*Math.cos(a1),y1=py+r*Math.sin(a1);const x2=px+r*Math.cos(a2),y2=py+r*Math.sin(a2);x.beginPath();x.moveTo(x1,y1);x.lineTo(x2,y2);x.stroke();t++;}}} …

Excerpt — the full answer is on the round page.

▶ R109 · Moire from two rotating rastersauthor reference Open round →
<!DOCTYPE html><html><head><title>Moire</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=500;
function d(){x.fillStyle='#000';x.fillRect(0,0,500,500);x.strokeStyle='#0f0';x.lineWidth=0.5;const t=performance.now()*0.0005,rot=t*0.5,off=t*20;x.save();x.translate(250,250);for(let r=5;r<200;r+=4){x.beginPath();x.arc(0,0,r,0,Math.PI*2);x.stroke();}x.rotate(rot);x.translate(off*Math.cos(rot),off*Math.sin(rot));x.strokeStyle='#0f0';for(let r=5;r<200;r+=4){x.beginPath();x.arc(0,0,r,0,Math.PI*2);x.stroke();}x.restore();i.textContent=`Angle: ${(rot%6.28).toFixed(2)} | Offset: ${(off%100) …

Excerpt — the full answer is on the round page.

▶ R110 · Penrose-style aperiodic tiling growingauthor reference Open round →
<!DOCTYPE html><html><head><title>Rhombus Tiling</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#f0f;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=500;
let gen=0,rhombi=[];function init(){rhombi=[];const cx=250,cy=250,s=40;for(let a=0;a<Math.PI*2;a+=Math.PI/3){const p1=[cx,cy],p2=[cx+s*Math.cos(a),cy+s*Math.sin(a)],p3=[cx+s*Math.cos(a+Math.PI/3),cy+s*Math.sin(a+Math.PI/3)],p4=[cx+s*Math.cos(a+Math.PI*2/3),cy+s*Math.sin(a+Math.PI*2/3)];rhombi.push({p:[p1,p2,p3,p4],type:Math.random()>0.5?0:1});}}
function sub(r){const [p0,p1,p2,p3]=r.p;const mid1=[(p0[0]+p1[0])/2,(p0[1]+p1[1])/2],mid2=[(p1[0]+p2[0])/2,(p1[1]+p2[1])/2],mid3=[(p …

Excerpt — the full answer is on the round page.

▶ R111 · Ant colony laying pheromone trailsauthor reference Open round →
<!DOCTYPE html><html><head><title>Ant Colony</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#ff8;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
const w=400,h=400,gs=10,ph=Array(gs*gs).fill(0);let ants=[],food=0;
for(let j=0;j<50;j++){ants.push({x:w/2+Math.random()*20-10,y:h/2+Math.random()*20-10,dx:Math.random()-0.5,dy:Math.random()-0.5,carry:0});}
const fx=350,fy=150;
function d(){x.fillStyle='#000';x.fillRect(0,0,w,h);for(let j=0;j<ph.length;j++)ph[j]*=0.95;x.fillStyle='#440';x.fillRect(fx-10,fy-10,20,20);for(let a of ants){if(Math.hypot(a.x-fx,a.y-fy)<15){a.carry=1;}if(Math.hypot(a.x-w/2,a.y-h/2)<15&&a.carry){food++;a …

Excerpt — the full answer is on the round page.

▶ R112 · Physarum slime-mould networkauthor reference Open round →
<!DOCTYPE html><html><head><title>Physarum</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
const w=400,h=400,sz=1;let tr=new Uint8ClampedArray(w*h);let ag=[];const na=500;
for(let j=0;j<na;j++){ag.push({x:w/2+Math.random()*40-20,y:h/2+Math.random()*40-20,a:Math.random()*Math.PI*2});}
function getT(x,y){const ix=Math.floor(x),iy=Math.floor(y);if(ix<0||ix>=w||iy<0||iy>=h)return 0;return tr[iy*w+ix];}
function d(){let st=0;for(let ag1 of ag){const sa=ag1.a,s=2;const f=getT(ag1.x+s*Math.cos(sa-Math.PI/6),ag1.y+s*Math.sin(sa-Math.PI/6));const fwd=getT(ag1.x+s*Math.cos(sa),ag1 …

Excerpt — the full answer is on the round page.

▶ R113 · Predator and prey on a shared fieldauthor reference Open round →
<!DOCTYPE html><html><head><title>Predator Prey</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
let pr=[],pd=[],gr=[];for(let j=0;j<300;j++){pr.push({x:Math.random()*400,y:Math.random()*400,e:50});}for(let j=0;j<50;j++){pd.push({x:Math.random()*400,y:Math.random()*400,e:100});}for(let j=0;j<500;j++){gr.push({x:Math.random()*400,y:Math.random()*400});}
function d(){x.fillStyle='#1a3a1a';x.fillRect(0,0,400,400);for(let g of gr){x.fillStyle='#0a0';x.fillRect(g.x-2,g.y-2,4,4);}if(Math.random()<0.01){gr.push({x:Math.random()*400,y:Math.random()*400});}for(let p of pr){p.e-=0. …

Excerpt — the full answer is on the round page.

▶ R114 · Traffic jam from nothingauthor reference Open round →
<!DOCTYPE html><html><head><title>Traffic</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
const r=150,nc=30,vmax=5,p_slow=0.1;let cars=[];for(let j=0;j<nc;j++){cars.push({pos:j*r*2*Math.PI/nc,v:2});}
function d(){const cx=200,cy=200;x.fillStyle='#000';x.fillRect(0,0,400,400);x.strokeStyle='#333';x.lineWidth=2;x.beginPath();x.arc(cx,cy,r,0,Math.PI*2);x.stroke();x.beginPath();x.arc(cx,cy,r-15,0,Math.PI*2);x.stroke();for(let j=0;j<cars.length;j++){let c1=cars[j],c2=cars[(j+1)%nc];let d_gap=(c2.pos-c1.pos+r*2*Math.PI)%(r*2*Math.PI);c1.v=Math.min(c1.v+1,vmax);if(d_gap<25)c1.v …

Excerpt — the full answer is on the round page.

▶ R115 · Crowd leaving through a bottleneckauthor reference Open round →
<!DOCTYPE html><html><head><title>Crowd</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
let ppl=[];for(let j=0;j<200;j++){ppl.push({x:Math.random()*300+50,y:Math.random()*300+50,vx:0,vy:0});}let out=0;
function d(){x.fillStyle='#111';x.fillRect(0,0,400,400);x.strokeStyle='#444';x.lineWidth=2;x.strokeRect(20,20,360,360);x.strokeStyle='#f00';x.lineWidth=3;x.strokeRect(185,350,30,20);for(let p of ppl){let fx=0,fy=0;fx+=(185-p.x)*0.002;fy+=(350-p.y)*0.002;for(let q of ppl){if(p===q)continue;const dx=q.x-p.x,dy=q.y-p.y,d=Math.hypot(dx,dy);if(d<15&&d>0){fx-=(dx/d)*0.5;fy-=(dy/ …

Excerpt — the full answer is on the round page.

▶ R116 · Bresenham circles and lines, pixel by pixelauthor reference Open round →
<!DOCTYPE html><html><head><title>Bresenham</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
let px_cnt=0,id=x.createImageData(400,400);const d8=id.data;
function setPixel(x,y,c){if(x>=0&&x<400&&y>=0&&y<400){const i=(y*400+x)*4;d8[i]=c[0];d8[i+1]=c[1];d8[i+2]=c[2];d8[i+3]=255;px_cnt++;}}
function line(x0,y0,x1,y1,col){const dx=Math.abs(x1-x0),dy=Math.abs(y1-y0),sx=x0<x1?1:-1,sy=y0<y1?1:-1;let err=dx-dy;for(let x=x0,y=y0;;){setPixel(x,y,col);if(x===x1&&y===y1)break;const e2=2*err;if(e2>-dy){err-=dy;x+=sx;}if(e2<dx){err+=dx;y+=sy;}}}
function circle(xc,yc,r,col){let x=0,y=r …

Excerpt — the full answer is on the round page.

▶ R117 · De Casteljau construction of a Bezier curveauthor reference Open round →
<!DOCTYPE html><html><head><title>De Casteljau</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
const p=[{x:50,y:200,vx:0.5,vy:0.3},{x:150,y:50,vx:-0.3,vy:0.4},{x:250,y:100,vx:0.4,vy:-0.2},{x:350,y:250,vx:-0.2,vy:-0.5}];
function d(){x.fillStyle='#000';x.fillRect(0,0,400,400);for(let j=0;j<4;j++){p[j].x+=p[j].vx;p[j].y+=p[j].vy;if(p[j].x<20||p[j].x>380){p[j].vx*=-1;}if(p[j].y<20||p[j].y>380){p[j].vy*=-1;}}let cv=[];for(let t=0;t<=1;t+=0.02){let q=[...p];for(let lev=0;lev<3;lev++){let nq=[];for(let j=0;j<q.length-1;j++){nq.push({x:q[j].x+(q[j+1].x-q[j].x)*t,y:q[j].y+(q[j+1 …

Excerpt — the full answer is on the round page.

▶ R118 · Sutherland-Hodgman polygon clippingauthor reference Open round →
<!DOCTYPE html><html><head><title>Clipping</title></head><body style="margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:mono;font-size:10px"></div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=c.height=400;
let poly=[];const cx=200,cy=200,r=80;for(let j=0;j<8;j++){const a=j*Math.PI/4+Math.sin(j)*0.5;poly.push({x:cx+r*Math.cos(a),y:cy+r*Math.sin(a)});}
function clip_edge(poly,edge,val){if(poly.length<2)return poly;const clipped=[];for(let i=0;i<poly.length;i++){const p1=poly[i],p2=poly[(i+1)%poly.length];const i1=(edge===0?p1.x:edge===1?p1.y:edge===2?p1.x:p1.y)>=(edge===0||edge===2?val:val);const i2=(edge===0?p2.x:edge===1?p2.y:edge===2?p2.x:p2.y)>=(edge===0||edge===2?val:val);if(i1)cl …

Excerpt — the full answer is on the round page.

▶ R119 · Floyd-Steinberg dithering a gradientauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dither</title>
<style>
body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}
canvas{border:1px solid #fff}
#i{position:absolute;top:10px;left:10px;color:#fff;font:11px monospace}
</style>
</head>
<body>
<canvas id="c" width="180" height="180"></canvas>
<div id="i">P:4|F:0</div>
<script>
const c=document.getElementById('c'),x=c.getContext('2d'),w=180,h=180,p=[0,85,170,255];
let f=0,s=Math.random();
function n(a,b,t){return (Math.sin(a*.05+t*.02)*Math.cos(b*.05+t*.02)*.5+.5)*255}
function q(v){let m=0,d=Math.abs(v-p[0]);for(let i=1;i<p.length;i++){const j=Math.abs(v-p[i]);if(j<d){m=i;d=j}}return p[m]}
function g(){const t=f*.05+s*1000,d=x.createImageData(w,h),r=d.data,e=new Array(w*h).fill(0);for(let y=0;y<h;y++)for(let i=0;i<w;i++){const j=y*w+i;let v=n(i,y,t)+e[j];v=Math.max(0,Math.mi …

Excerpt — the full answer is on the round page.

▶ R120 · Scanline fill of a self-intersecting polygonauthor reference Open round →
<html><body style="margin:0;background:#000"><canvas id=c width=800 height=600></canvas><script>
const c=document.getElementById('c'),x=c.getContext('2d');let t=0,p=[];
function N(){t=0;const m=6+Math.random()*4|0;p=[];for(let j=0;j<m;j++){const a=j/m*6.28,r=100+Math.random()*50;p.push({ox:Math.cos(a)*r,oy:Math.sin(a)*r})}}
function T(){const r=t*.005,s=1+Math.sin(t*.002)*.3,co=Math.cos(r),si=Math.sin(r);for(let q of p){const ax=q.ox*s,ay=q.oy*s;q.x=400+ax*co-ay*si;q.y=300+ax*si+ay*co}}
function F(){let sp=0;x.fillStyle='#6c6';for(let y=0;y<600;y++){const it=[];for(let j=0;j<p.length;j++){const a=p[j],b=p[(j+1)%p.length];if((a.y<=y&&y<b.y)||(b.y<=y&&y<a.y)){it.push(a.x+(y-a.y)/(b.y-a.y)*(b.x-a.x))}}it.sort((a,b)=>a-b);for(let j=0;j<it.length-1;j+=2){const x1=Math.ceil(it[j]),x2=Math.floor(it[j+1]);if(x1<=x2){sp++;x.fillRect(x1,y,x2-x1+1,1)}}}return sp}
function A(){x.strokeStyle='#fff';x …

Excerpt — the full answer is on the round page.

▶ R121 · A* pathfinding search across an obstacle gridauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0}canvas{display:block}</style></head><body><canvas id="c"></canvas><script>
const c=document.getElementById('c'),x=c.getContext('2d'),W=25,H=25,S=18;c.width=W*S;c.height=H*S;let g,s,e,o,d,p,n,q;function z(){g=[];for(let i=0;i<H;i++){g[i]=[];for(let j=0;j<W;j++)g[i][j]=Math.random()<.2}s=[Math.random()*W|0,Math.random()*H|0];e=[Math.random()*W|0,Math.random()*H|0];if(g[s[1]][s[0]]||g[e[1]][e[0]])return z();o=[{x:s[0],y:s[1],f:0,g:0,h:0,t:0}];d=new Set;p=[];n=0;q=0}function h(a,b){return Math.abs(a-e[0])+Math.abs(b-e[1])}function m(){if(q)return;if(!o.length)return q=2;o.sort((a,b)=>a.f-b.f);const r=o.shift();n++;if(r.x==e[0]&&r.y==e[1]){let v=r;while(v)p.unshift(v),v=v.t;return q=1}if(d.has(r.x+','+r.y))return m();d.add(r.x+','+r.y);for(let i=-1;i<2;i++)for(let j=-1;j<2;j++){if(i==0&&j==0)continue;let l=r.x+i,w=r.y+j;if(l<0||l>=W||w<0||w>=H|| …

Excerpt — the full answer is on the round page.

▶ R122 · Randomized maze generation via recursive backtrackingauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#000}</style></head><body><canvas id="c"></canvas><script>
const c=document.getElementById('c'),x=c.getContext('2d'),W=30,H=25,S=20;c.width=W*S;c.height=H*S;
let m,k,p,d=0,f=0;
function i(){m=[];for(let i=0;i<W;i++){m[i]=[];for(let j=0;j<H;j++)m[i][j]={n:1,s:1,e:1,w:1,v:0}};k=[];p={x:0,y:0};d=0;f=0;m[0][0].v=1}
function g(a,b){let r=[];[[0,-1,'n','s'],[0,1,'s','n'],[1,0,'e','w'],[-1,0,'w','e']].forEach(([dx,dy,w,o])=>{let nx=a+dx,ny=b+dy;nx>=0&&nx<W&&ny>=0&&ny<H&&!m[nx][ny].v&&r.push([nx,ny,w,o])});return r}
function s(){if(f)return;let l=g(p.x,p.y);if(l.length){let e=l[Math.floor(Math.random()*l.length)];m[p.x][p.y][e[2]]=0;m[e[0]][e[1]][e[3]]=0;m[e[0]][e[1]].v=1;k.push({x:p.x,y:p.y});p={x:e[0],y:e[1]};d++}else k.length?p=k.pop():f=1}
function t(){x.fillStyle='# …

Excerpt — the full answer is on the round page.

▶ R123 · Breadth-first flood fill spreading through a regionauthor reference Open round →
<!DOCTYPE html><html><head><title>BFS Flood Fill</title><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#000;font-family:monospace}canvas{border:2px solid #666}#info{position:absolute;top:15px;left:15px;color:#fff;font-size:14px}</style></head><body><canvas id="c"></canvas><div id="info"></div><script>
const c=document.getElementById('c'),ctx=c.getContext('2d'),info=document.getElementById('info');
const W=70,H=70,S=5;
c.width=W*S;c.height=H*S;
let grid,queue,dist,step,active;
function init(){
grid=Array(H).fill().map(()=>Array(W).fill(Math.random()>0.25?1:0));
let sx,sy;
do{sx=Math.floor(Math.random()*W);sy=Math.floor(Math.random()*H);}while(grid[sy][sx]===0);
dist=new Map();
dist.set(sy*W+sx,0);
queue=[[sx,sy]];
step=0;
active=true;
}
function draw(){
ctx.fillStyle='#000';
ctx.fillRect(0,0,c.width,c.height);
for(let y=0;y<H;y++){
for( …

Excerpt — the full answer is on the round page.

▶ R124 · Dijkstra's shortest path over weighted terrainauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#000}canvas{border:1px solid #666}#i{position:absolute;top:10px;color:#fff;font:11px monospace}</style></head><body><div id="i"></div><canvas id="c"></canvas><script>const W=40,H=40,S=15,c=document.getElementById('c'),i=document.getElementById('i'),x=c.getContext('2d');c.width=W*S;c.height=H*S;let g,d,p,s,t,q,o;function init(){g=Array(W*H).fill().map(()=>Math.random()*9+1);d=Array(W*H).fill(Infinity);p=Array(W*H).fill(-1);s=Math.floor(Math.random()*W*H);t=Math.floor(Math.random()*W*H);while(t===s)t=Math.floor(Math.random()*W*H);d[s]=0;q=[s];o=new Set();}function step(){if(o.has(t))return 0;let m=-1,v=Infinity;for(let e of q)if(!o.has(e)&&d[e]<v){m=e;v=d[e];}if(m<0)return 0;q=q.filter(e=>e!==m);o.add(m);const cx=m%W,cy=m/W|0;for(let dx=-1;dx< …

Excerpt — the full answer is on the round page.

▶ R125 · Voronoi diagram growing by multi-source flood fillauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#000}</style></head><body><canvas id="c"></canvas><script>const c=document.getElementById('c'),x=c.getContext('2d'),W=200,H=150,S=3;c.width=W*S;c.height=H*S;let g,s,q;function i(){g=new Uint32Array(W*H);s=[];for(let j=0;j<10;j++){const a=Math.random()*W|0,b=Math.random()*H|0,col=Math.random()*16777215|0;s.push([a,b,col]);g[b*W+a]=(col+1)|0}q=[];for(let j=0;j<s.length;j++)q.push([s[j][0],s[j][1],j])}function t(){let n=[];for(let i=0;i<q.length;i++){const[a,b,j]=q[i];for(const[dx,dy]of[[1,0],[0,1],[-1,0],[0,-1]]){const na=a+dx,nb=b+dy,idx=nb*W+na;if(na>=0&&na<W&&nb>=0&&nb<H&&!g[idx]){g[idx]=(s[j][2]+1)|0;n.push([na,nb,j])}}}q=n}function d(){for(let i=0;i<W*H;i++){if(g[i]){const a=(i%W)*S,b=(i/W|0)*S;x.fillStyle='#'+('000000'+(g[i]-1).toString(16)).slice(-6);x.fillR …

Excerpt — the full answer is on the round page.

▶ R126 · Bubble sort sweeping bars into orderauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Bubble Sort</title><style>body{margin:0;display:flex;align-items:center;justify-content:center;height:100vh;background:#000;font-family:monospace}canvas{background:#000}div{position:absolute;top:10px;color:#0f0}</style></head><body><div>0</div><canvas id="c"></canvas><script>const c=document.getElementById('c'),x=c.getContext('2d'),d=document.querySelector('div');c.width=1200;c.height=600;let n=80,a=[],i=0,j=0,cnt=0;function s(){if(i>=n-1){a=[];for(let k=0;k<n;k++)a.push(Math.random());i=0;j=0;cnt=0;return}if(j>=n-1-i){i++;j=0;return}if(a[j]>a[j+1]){[a[j],a[j+1]]=[a[j+1],a[j]]}j++;cnt++}function p(){x.fillStyle='#000';x.fillRect(0,0,1200,600);for(let k=0;k<n;k++){x.fillStyle=k>n-1-i?'#0f0':(k===j||k===j+1)?'#f00':'#0ff';x.fillRect(k*15,600-a[k]*600,14,a[k]*600)}d.innerHTML=cnt}function r(){for(let m=0;m<5;m++)s();p();requestAnimatio …

Excerpt — the full answer is on the round page.

▶ R127 · Quicksort partitioning around glowing pivotsauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#222}canvas{background:#111;border:2px solid #fff}#s{position:absolute;top:20px;color:#fff;font:20px monospace}</style></head><body><div id="s">Swaps: 0</div><canvas id="c"width=800 height=400></canvas><script>const c=document.getElementById('c'),x=c.getContext('2d'),n=80;let a=[],sw=0,st=[],pv=-1,pl=-1,pr=-1;function init(){a=Array.from({length:n},()=>Math.random()*400|0);sw=0;st=[{l:0,r:n-1}];pv=-1}function part(l,r){pv=l;pl=l;pr=r;let p=a[l],i=l+1,j=r;while(i<=j){if(a[i]<=p)i++;else if(a[j]>p)j--;else{[a[i],a[j]]=[a[j],a[i]];sw++}}[a[l],a[j]]=[a[j],a[l]];sw++;return j}function step(){if(!st.length)return init();let q=st.pop();if(q.l<q.r){let k=part(q.l,q.r);st.push({l:q.l,r:k-1},{l:k+1,r:q.r})}}function d(){x.fillStyle='#111';x.fillRect(0,0,800,400);const w=10 …

Excerpt — the full answer is on the round page.

▶ R128 · Merge sort weaving runs togetherauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#1a1a1a}canvas{border:1px solid #ccc}</style></head><body><canvas id="c"></canvas><script>
const c=document.getElementById('c'),x=c.getContext('2d');c.width=1000;c.height=600;
let a=[],p=0,r=1,i=0,l=-1,m=-1,h=-1;
function init(){a=[];for(let j=0;j<80;j++)a.push(Math.random()*500+50);p=0;r=1;i=0;l=m=h=-1;}
function merge(s,e,f){let t=[],si=s,ei=e+1;while(si<=e&&ei<=f)t.push(a[si]<=a[ei]?a[si++]:a[ei++]);while(si<=e)t.push(a[si++]);while(ei<=f)t.push(a[ei++]);for(let j=0;j<t.length;j++)a[s+j]=t[j];}
function step(){if(i+r>=a.length){if(r*2>=a.length)init();else{r*=2;i=0;p=0;l=m=h=-1;}return;}let s=i,e=i+r-1,f=Math.min(i+r*2-1,a.length-1);l=s;m=e;h=f;merge(s,e,f);i+=r*2;p++;}
function draw(){x.fillStyle='#1a1a1a';x.fillRect(0,0,1000,600);for(let j=0;j<a.length;j++){ …

Excerpt — the full answer is on the round page.

▶ R129 · Heap sort sifting the maximum to the backauthor reference Open round →
<!DOCTYPE html>
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Heap Sort</title><style>body{margin:0;display:flex;align-items:center;justify-content:center;height:100vh;background:#1a1a1a;font-family:monospace}canvas{border:1px solid #666}</style></head><body><canvas id="c" width="800" height="500"></canvas><script>const c=document.getElementById('c');const ctx=c.getContext('2d');const n=80;let h=[],swaps=0,phase='build',heapSize=0,swapIdx=-1,steps=0;function setup(){h=[];for(let i=0;i<n;i++)h.push(Math.random());swaps=0;phase='build';heapSize=n;swapIdx=-1;steps=0;}function sift(i,s){while(true){let l=2*i+1,r=2*i+2,m=i;if(l<s&&h[l]>h[m])m=l;if(r<s&&h[r]>h[m])m=r;if(m===i)break;swapIdx=i*100+m;[h[i],h[m]]=[h[m],h[i]];swaps++;i=m;}}function step(){if(phase==='build'){for(let k=0;k<5;k++){if(steps>=n/2)break;let i=Math.floor(n/2)-1-steps;sift(i,n …

Excerpt — the full answer is on the round page.

▶ R130 · Radix sort ordering by one digit at a timeauthor reference Open round →
<!DOCTYPE html><html><head><style>*{margin:0}body{background:#000;display:flex;justify-content:center;align-items:center;height:100vh;font-family:monospace;color:#fff;overflow:hidden}canvas{border:1px solid #fff}#info{position:absolute;top:15px;left:15px;font-size:16px}</style></head><body><div id="info"></div><canvas></canvas><script>
const canvas=document.querySelector('canvas'),ctx=canvas.getContext('2d'),info=document.querySelector('#info');
canvas.width=960;canvas.height=480;
const BARS=80,colors=['#f44','#f84','#fd4','#4f4','#44f','#b4f','#f4b','#4ff','#8cf','#ccc'];
let arr=[],pos=[],npos=[],digt=0,pass=0,prog=0;

function dig(n,d){return Math.floor(n/Math.pow(10,d))%10}

function sort(){
  if(digt>2){
    arr=Array.from({length:BARS},()=>Math.floor(Math.random()*999));
    pos=Array.from({length:BARS},(_,i)=>i);
    digt=0;pass=0;prog=0;
    sort();
    return;
  }
  const cnt=Ar …

Excerpt — the full answer is on the round page.

▶ R131 · Weekday riddle from two cluesauthor reference Open round →
Sunday

The day after tomorrow is two days before Thursday, which means it is Tuesday. If day after tomorrow is Tuesday, then today must be Sunday. This can be verified by counting forward: Sunday + 1 day = Monday, Sunday + 2 days = Tuesday, and Tuesday is indeed two days before Thursday.
▶ R132 · Fermi estimate: a lifetime of drinking waterauthor reference Open round →
Assumptions:
- Average adult drinks 2.5 liters of water daily
- Adult lifespan: 18-75 years = 57 years of adult drinking
- Calculation: 2.5 L/day × 365 days/year × 57 years = 52,012.5 liters

52,000 liters
▶ R133 · Three friends, three petsauthor reference Open round →
Ana owns the parrot, Ben owns the cat, and Cleo owns the dog.

Ana is allergic to animal fur, so she cannot own the cat or dog—she must own the parrot. Ben's pet cannot fly, which rules out the parrot (already Ana's), leaving the cat or dog for Ben. However, the dog's owner is older than Ben, meaning Ben cannot own the dog (he cannot be older than himself); therefore, Ben owns the cat. By elimination, Cleo owns the dog.
▶ R134 · Smallest number from three remaindersauthor reference Open round →
A positive integer leaves remainder 1 when divided by 3, remainder 2 when divided by 5, and remainder 3 when divided by 7. What is the smallest such number? Show your reasoning briefly (no code).

ANSWER: 52

REASONING:

We need to find the smallest positive integer n satisfying:
- n ≡ 1 (mod 3)
- n ≡ 2 (mod 5)
- n ≡ 3 (mod 7)

From the first condition: n = 3k + 1 for some integer k.

Substitute into the second condition:
3k + 1 ≡ 2 (mod 5)
3k ≡ 1 (mod 5)

The multiplicative inverse of 3 modulo 5 is 2 (since 3 × 2 = 6 ≡ 1 mod 5), so:
k ≡ 2 (mod 5), meaning k = 5j + 2

Substituting back: n = 3(5j + 2) + 1 = 15j + 7

Now apply the third condition:
15j + 7 ≡ 3 (mod 7)
15j ≡ -4 ≡ 3 (mod 7)

Since 15 ≡ 1 (mod 7), we have j ≡ 3 (mod 7), so j = 7m + 3

Substituting: n = 15(7m + 3) + 7 = 105m + 52

The smallest positive solution is n = 52 (when m = 0).

VERIFICATION:
- 52 = 3 × 17 + 1 ✓ (remaind …

Excerpt — the full answer is on the round page.

▶ R135 · Conditional dice probabilityauthor reference Open round →
2/11

Given at least one die shows 4, there are 11 equally likely outcomes: (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (1,4), (2,4), (3,4), (5,4), (6,4). Of these, exactly two sum to 9: (4,5) and (5,4). Therefore, the probability is 2/11.
▶ R136 · Double pendulum tracing a chaotic pathauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000}#t{position:absolute;top:10px;left:10px;color:#0f0;font:18px monospace}</style></head><body><div id="t">0s</div><canvas id="c"></canvas><script>const c=document.getElementById('c'),x=c.getContext('2d');c.width=innerWidth;c.height=innerHeight;let trail=[],tm=0;const L=150,g=9.81;let s=[0,0,0,0];function init(){s=[(Math.random()-.5)*3.14,0,(Math.random()-.5)*3.14,0];trail=[];tm=0}function f(s){let[a,w,b,v]=s,D=b-a,sd=Math.sin(D),cd=Math.cos(D);let den=(3-Math.cos(2*D))*L;let dw=(-3*g*Math.sin(a)-g*Math.sin(b-2*a)-2*sd*(v*v*L+w*w*L*cd))/(2*den);let dv=(2*sd*(w*w*2*L+2*g*Math.cos(a)+v*v*L*cd))/(2*L*den);return[w,dw,v,dv]}function rk4(s,dt){let k1=f(s),s1=s.map((v,i)=>v+k1[i]*dt/2),k2=f(s1),s2=s.map((v,i)=>v+k2[i]*dt/2),k3=f(s2),s3=s.map((v,i)=>v+k3[i]*dt),k4=f(s3);return s.map((v,i)=>v+(k1[i]+2*k2[i]+2*k3[i …

Excerpt — the full answer is on the round page.

▶ R137 · Cloth mesh hanging and rippling in the windauthor reference Open round →
```html
<!DOCTYPE html><html><head><meta charset=utf-8><style>body{margin:0;overflow:hidden;background:#000}#w{position:absolute;top:10px;left:10px;color:#fff;font:12px monospace}</style><body><canvas id=c></canvas><div id=w></div><script>const c=document.getElementById('c'),x=c.getContext('2d'),w=document.getElementById('w'),cols=15,rows=10;c.width=innerWidth;c.height=innerHeight;let p=[],k=[],t=0;const init=()=>{p=[];k=[];t=0;const s=c.width/(cols-1);for(let y=0;y<rows;y++)for(let i=0;i<cols;i++){const px=c.width/2-(cols-1)*s/2+i*s,py=50+y*s;p.push({x:px,y:py,px,py,a:y<1})}for(let y=0;y<rows;y++)for(let i=0;i<cols;i++){const ix=y*cols+i;if(i<cols-1){const ix2=ix+1,dx=p[ix2].x-p[ix].x,dy=p[ix2].y-p[ix].y;k.push({p1:ix,p2:ix2,r:Math.hypot(dx,dy)})}if(y<rows-1){const ix2=(y+1)*cols+i,dx=p[ix2].x-p[ix].x,dy=p[ix2].y-p[ix].y;k.push({p1:ix,p2:ix2,r:Math.hypot(dx,dy)})}if(i<cols-1&&y<rows-1){ …

Excerpt — the full answer is on the round page.

▶ R138 · Two-source wave interference patternauthor reference Open round →
```html
<!DOCTYPE html><html><head><style>body{margin:0;background:#000}#d{position:fixed;color:#fff;font:11px monospace}</style></head><body><canvas id=c></canvas><div id=d></div><script>const c=document.getElementById('c'),x=c.getContext('2d'),d=document.getElementById('d');c.width=innerWidth;c.height=innerHeight;let t=0;(function a(){const w=c.width,h=c.height,I=x.createImageData(w,h),p=I.data,cx=w/2,cy=h/2,s=Math.sin(t/1e3)*100+150,k=.1,f=.05;for(let y=0;y<h;y++)for(let i=0;i<w;i++){const r1=Math.hypot(i-cx+s/2,y-cy),r2=Math.hypot(i-cx-s/2,y-cy),u=Math.sin(k*r1-f*t),v=Math.sin(k*r2-f*t),g=(u+v+2)/4*255,j=(y*w+i)*4;p[j]=p[j+1]=p[j+2]=g|0;p[j+3]=255}x.putImageData(I,0,0);d.innerHTML=`Distance: ${s|0}`;t++;requestAnimationFrame(a)})()
</script></body></html>
```
▶ R139 · Small n-body system orbiting a central starauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>N-Body System</title>
<style>
body{margin:0;background:#000;display:flex;align-items:center;justify-content:center;height:100vh;font-family:monospace}
canvas{display:block;border:1px solid #333}
#info{position:absolute;top:10px;color:#0f0}
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<div id="info">Bodies: 0</div>
<script>
const canvas=document.getElementById('c');
const ctx=canvas.getContext('2d');
const G=45,dt=0.01,substeps=3;

class Body{
constructor(x,y,vx,vy,m,color){
this.x=x;this.y=y;this.vx=vx;this.vy=vy;this.m=m;this.color=color;
this.ax=0;this.ay=0;this.trail=[];
}
update(){
this.vx+=this.ax*dt;this.vy+=this.ay*dt;
this.x+=this.vx*dt;this.y+=this.vy*dt;
this.trail.push([this.x,this.y]);
if(this.trail.length>25)this.trail.shift();
this.ax=0;this.ay=0;
}
draw(){
const r=Math.sqrt(this.m)*0.6 …

Excerpt — the full answer is on the round page.

▶ R140 · Water sloshing in a tilting containerauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}#c{border:1px solid #fff}#i{position:absolute;top:10px;color:#fff;font:9pt monospace}</style></head><body><canvas id=c width=600 height=400></canvas><div id=i>Tilt: 0°</div><script>
const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');let p=[],t=0;const n=200,g=.3,r=.5,h=.05,f=.98,cX=50,cY=50,cW=500,cH=300;function init(){p=[];for(let j=0;j<n;j++)p.push({x:cX+cW*.4+Math.random()*cW*.2,y:cY+cH*.3+Math.random()*cH*.3,vx:0,vy:0})}function upd(){t++;const tl=Math.sin(t*.01)*30,tr=tl*Math.PI/180,gx=Math.sin(tr)*g,gy=Math.cos(tr)*g;for(let j=0;j<n;j++){const q=p[j];q.vx*=f;q.vy*=f;q.vx+=gx;q.vy+=gy;for(let k=j+1;k<n;k++){const s=p[k],dx=s.x-q.x,dy=s.y-q.y,d=Math.sqrt(dx*dx+dy*dy),m=8;if(d<m&&d>.1){const a=Math.atan2(dy,dx),fr=(m …

Excerpt — the full answer is on the round page.

▶ R141 · Idiom-dense German into natural Englishauthor reference Open round →
That was a complete disaster — we're left looking foolish, but we're not about to give up.
▶ R142 · Register shift: casual complaint into formalauthor reference Open round →
Dear Sir/Madam,

I am writing to lodge a formal complaint regarding the blender I purchased from your company. Unfortunately, the product ceased functioning after only two days of use, exhibiting sparks during operation. This indicates a significant product defect.

I formally request either a full refund or an immediate replacement unit. I trust this matter will be resolved at your earliest convenience.

Thank you for your prompt attention to this matter.

Yours sincerely
▶ R143 · Bureaucratic German into plain Englishauthor reference Open round →
To claim the benefit, you must submit a fully completed application by the deadline. Otherwise, you forfeit your right to it.
▶ R144 · English apology into idiomatic Sie-Germanauthor reference Open round →
Da haben wir daneben gegriffen — ohne Beschönigung. Aber wir werden es wiedergutmachen, und das kostet Sie keinen Cent.
▶ R145 · False-friend minefield German into Englishauthor reference Open round →
We might have to postpone the current appointment; this is a sensitive topic, and I don't want to spread poison.
▶ R146 · Repair broken JSON (4 precise errors)author reference Open round →
{
  "name": "Alex Weber",
  "age": 34,
  "email": "alex@example.com",
  "active": true,
  "tags": ["admin", "beta"],
  "signupYear": 2024,
  "address": {
    "street": "Hauptstr. 5",
    "city": "Berlin",
    "zip": "10115",
    "country": "Germany"
  }
}
▶ R147 · CSV with embedded comma to JSON arrayauthor reference Open round →
[
  {
    "id": 1,
    "name": "Anna Berg",
    "notes": "Prefers email, not phone",
    "amount": 120.50
  },
  {
    "id": 2,
    "name": "Tom Klein",
    "notes": "Standard customer",
    "amount": 75.00
  },
  {
    "id": 3,
    "name": "Lena Fuchs",
    "notes": "Called twice, resolved",
    "amount": 200.00
  },
  {
    "id": 4,
    "name": "Max Otto",
    "notes": "VIP customer",
    "amount": 50.00
  }
]
▶ R148 · Table QA: sum, filter, max over order dataauthor reference Open round →
1. 241.47
2. 1001, 1003, 1006
3. 1005, 268.50
▶ R149 · Extract meeting invite into a fixed JSON schemaauthor reference Open round →
{
  "title": "Q3 Roadmap Kickoff",
  "date": "2026-08-18",
  "time": "10:30",
  "location": "Conference Room B, Berlin office (3rd floor)",
  "attendees": ["Sarah", "Tom", "Priya"]
}
▶ R150 · Diff two near-identical config blocksauthor reference Open round →
timeout: 30 -> 45
debug: false -> true
max_connections: 100 -> 150
▶ R151 · Binary search tree growing node by nodeauthor reference Open round →
<html><head><style>*{margin:0;padding:0}canvas{display:block}</style></head><body><canvas id=c></canvas><div id=i style=position:absolute;top:10px;left:10px;font-family:monospace></div><script>let c=document.getElementById('c'),x=c.getContext('2d'),w=c.width=800,h=c.height=600,r=null,v=[],p=[],q=[],n=0,f=0,s=0,t=0,m=15+Math.random()*6|0,z=0;class K{constructor(a){this.v=a;this.l=this.r=null}}function I(a){let b=r,g;while(b)g=b,b=a<b.v?b.l:b.r;(a<g.v?g.l=new K(a):g.r=new K(a));v.push(a);n++}function B(){r=new K(Math.random()*100|0);v=[r.v];p=[];q=[];s=f=t=z=0;n=1}function L(a,b,c,d){if(!a)return;a.x=b;a.y=c;L(a.l,b-d,c+40,d/2);L(a.r,b+d,c+40,d/2)}function E(a){if(!a)return;if(a.l){x.strokeStyle='#999';x.lineWidth=2;x.beginPath();x.moveTo(a.x,a.y);x.lineTo(a.l.x,a.l.y);x.stroke()}if(a.r){x.strokeStyle='#999';x.lineWidth=2;x.beginPath();x.moveTo(a.x,a.y);x.lineTo(a.r.x,a.r.y);x.stroke()}E(a …

Excerpt — the full answer is on the round page.

▶ R152 · Hash table with visible collision chainsauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Hash Table</title><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#1a1a1a}canvas{background:#000;border:1px solid #444}#i{position:absolute;top:10px;left:10px;color:#0f0;font-size:12px;font-family:monospace}</style></head><body><div id="i"></div><canvas id="c"></canvas><script>const c=document.getElementById('c'),t=c.getContext('2d');c.width=800;c.height=400;const B=12,W=c.width/B,H=300,Y=50;let h=Array(B).fill(null).map(()=>[]),cnt=0,tot=0;const hash=k=>k%B,clr=l=>l===0?'#0f0':l<4?'#ff0':'#f00';function d(){t.fillStyle='#000';t.fillRect(0,0,c.width,c.height);for(let i=0;i<B;i++){const bx=i*W,col=clr(h[i].length);t.strokeStyle=col;t.lineWidth=2;t.strokeRect(bx+4,Y,W-8,H);const k=h[i];for(let j=0;j<k.length;j++){const by=Y+10+j*22;t.fillStyle=col;t.fillRect(bx+W/2-18,by,36,18);t.fil …

Excerpt — the full answer is on the round page.

▶ R153 · Binary min-heap with bubble-up and sink-downauthor reference Open round →
<!DOCTYPE html><html><body style="margin:0;background:#333;display:flex;justify-content:center;align-items:center;height:100vh"><canvas id="c" width="800" height="600" style="background:#fff"></canvas><div id="i" style="position:absolute;top:10px;left:10px;color:#fff;font:14px Arial;font-weight:bold"></div><script>
const c=document.getElementById('c'),g=c.getContext('2d'),i=document.getElementById('i');let h=[],ins=0,ext=0,p='i',a=-1,x=-1;
function pos(n){const d=Math.log2(n+1)|0,s=(1<<d)-1;return{x:100+(n-s)*(600/(1<<d)),y:50+d*75}}
function dr(){g.fillStyle='#fff';g.fillRect(0,0,800,600);for(let n=1;n<h.length;n++){const pi=(n-1)>>1,cp=pos(n),pp=pos(pi);g.strokeStyle='#999';g.beginPath();g.moveTo(pp.x,pp.y);g.lineTo(cp.x,cp.y);g.stroke()}for(let n=0;n<h.length;n++){const po=pos(n);g.fillStyle=n===a?'#f00':n===x?'#ff0':'#0f0';g.beginPath();g.arc(po.x,po.y,20,0,6.28);g.fill();g.fillStyle …

Excerpt — the full answer is on the round page.

▶ R154 · Ring buffer with producer and consumer at different ratesauthor reference Open round →
<!DOCTYPE html><html><head><title>Ring Buffer</title><style>body{margin:0;height:100vh;display:flex;justify-content:center;align-items:center;background:#1a1a1a}canvas{display:block}#i{position:absolute;top:20px;color:white}</style></head><body><canvas id="c"></canvas><div id="i">Fill: <span id="f">0</span>/18</div><script>const c=document.getElementById('c');const x=c.getContext('2d');c.width=800;c.height=800;(function(){let n=18,z=40,r=200,p=0,q=0,ps=0.02+Math.random()*0.03,qs=0.015+Math.random()*0.025,w=0;function frame(){p=(p+ps)%n;q=(q+qs)%n;let d=(p-q+n)%n;let fl=Math.round(d);if(fl>=n-1&&d<1)w=30;x.fillStyle='#1a1a1a';x.fillRect(0,0,800,800);let cx=400,cy=400;if(w>0){x.fillStyle=`rgba(255,0,255,${w/30*0.4})`;x.fillRect(0,0,800,800);w--}for(let i=0;i<n;i++){let a=(i/n)*Math.PI*2-Math.PI/2,px=cx+Math.cos(a)*r,py=cy+Math.sin(a)*r,filled=((i-Math.floor(q)+n)%n)<fl,col=filled?(fl<6?'#0 …

Excerpt — the full answer is on the round page.

▶ R155 · Linked list with animated pointer relinkingauthor reference Open round →
<!DOCTYPE html><html><head><title>Linked List</title><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}canvas{background:#111;border:1px solid #333}#i{color:#0f0;position:fixed;top:10px;left:10px;font-size:12px;font-family:monospace}</style></head><body><div id="i"></div><canvas id="c"></canvas><script>const c=document.getElementById('c'),x=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=500;const nW=40,nH=30,gap=55,maxL=18;let nodes=[],opT=0;function init(){nodes=[];for(let j=0;j<5;j++)nodes.push({id:j,x:50+j*gap,y:150,tx:0,ty:0,del:0});opT=0}function lay(){let px=50,py=100;const pr=11;for(let j=0;j<nodes.length;j++){if(j>0&&j%pr===0){py+=80;px=50}nodes[j].tx=px;nodes[j].ty=py;px+=gap}}function drwArr(f,t){const sx=f.x+nW/2,sy=f.y+nH/2,ex=t.x+nW/2,ey=t.y+nH/2;x.strokeStyle='#0f0';x.lineWidth=2;x.beginPath();x. …

Excerpt — the full answer is on the round page.

▶ R156 · Invent 3 product names + taglines for a fictional object (no superlatives)author reference Open round →
1. StandSeal — Seal snacks. Stand bags upright.
2. ClipFresh — One clip seals bags tight.
3. FreshLock — Airtight seal, no more tipping.
▶ R157 · Rewrite the same product text for two different audiences, facts unchangedauthor reference Open round →
(a) Teenagers: The AquaGlow bottle is the ultimate 750 ml hydration companion that keeps your drinks ice-cold for 12 hours straight. Built from tough BPA-free plastic with a built-in straw for effortless sipping, it's basically indestructible. Toss it in the dishwasher and pick from 4 colors to match your vibe.

(b) Seniors: The AquaGlow bottle holds 750 ml of liquid and maintains cold temperatures for up to 12 hours. It is constructed from safe BPA-free plastic and features a convenient built-in straw. The bottle is dishwasher-safe for easy cleaning and comes in 4 different colors to choose from.
▶ R158 · 5 email subject lines under 50 chars, no clickbait, no ALL-CAPSauthor reference Open round →
1. Winter Jackets: 20% Off This Week
2. Your Feedback Matters—Quick Survey
3. Easy Returns: 60 Days, No Questions
4. Shop Warm, Save Big—20% Off Jackets
5. New Perk: Free Returns for 60 Days
▶ R159 · Micro-story: exactly 50 words (±5) with 3 mandatory elementsauthor reference Open round →
She held the red umbrella as rain poured down. The train whistle faded—she'd missed it. But standing there, soaked and alone, she realized the missed departure was a lighthouse moment. The wrong path illuminated what mattered. Sometimes losing your way reveals where you belong.
▶ R160 · Critique a generic slogan in 2 sentences + give 2 better alternativesauthor reference Open round →
"Quality You Can Trust" is entirely generic and could describe virtually any product from any industry—insurance, furniture, appliances—with zero connection to what actually differentiates this brand. The slogan completely ignores the product's unique value proposition: solar power technology and its specific use case for outdoor adventures where traditional charging is unavailable.

1. Solar Charged. Trail Tested.
2. Hike Longer on Sunlight Alone.
▶ R161 · Selection sort vs shell sort racing side by sideauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;background:#000;display:flex;justify-content:center;align-items:center;height:100vh}</style></head><body><canvas id="c"></canvas><script>
const c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=400;const n=25,w=400;let a,b,s,h;function sh(arr){for(let i=arr.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[arr[i],arr[j]]=[arr[j],arr[i]];}}function I(){a=Array.from({length:n},(_,i)=>i+1);sh(a);b=[...a];s={p:0,s:0,m:0,c:[],d:0,n:0};h={g:12,i:0,c:[],d:0,n:0};}function SS(){if(s.d)return;for(let k=0;k<5;k++){if(s.p>=n){s.d=1;break;}if(s.s<n){s.m=a[s.s]<a[s.m]?s.s:s.m;s.c=[s.p,s.s];s.n++;s.s++;}else{[a[s.p],a[s.m]]=[a[s.m],a[s.p]];s.p++;s.s=s.p;s.m=s.p;s.c=[];}}}function SH(){if(h.d)return;for(let k=0;k<5;k++){if(h.g===0){h.d=1;break;}if(h.i>=n){h.g=Math.floor(h.g/2);h.i=h.g;}if(h.i<n&&h.g>0){let j=h.i-h.g;if(j>=0 …

Excerpt — the full answer is on the round page.

▶ R162 · Breadth-first search flooding a random grid mazeauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#000}</style></head><body><canvas id="c"></canvas><script>const c=document.getElementById('c'),x=c.getContext('2d'),W=20,H=15,S=30;c.width=W*S;c.height=H*S;let g,d,p,f,v,st,pa,pi;const nm=()=>{g=Array(H).fill().map(()=>Array(W).fill(0));for(let i=0;i<H*W*0.25;i++){let r=~~(Math.random()*H),q=~~(Math.random()*W);if(!(r===0&&q===0||r===H-1&&q===W-1))g[r][q]=1;}d=Array(H).fill().map(()=>Array(W).fill(-1));p=Array(H).fill().map(()=>Array(W).fill(null));f=[[0,0]];d[0][0]=0;v=1;st='f'};const bf=()=>{let n=[];for(let[r,q]of f){for(let[dr,dq]of[[0,1],[1,0],[0,-1],[-1,0]]){let nr=r+dr,nq=q+dq;if(nr>=0&&nr<H&&nq>=0&&nq<W&&!g[nr][nq]&&d[nr][nq]===-1){d[nr][nq]=d[r][q]+1;p[nr][nq]=[r,q];n.push([nr,nq]);v++}}}f=n;if(!n.length&&d[H-1][W-1]===-1){nm();retu …

Excerpt — the full answer is on the round page.

▶ R163 · Prim's algorithm growing a minimum spanning treeauthor reference Open round →
<!DOCTYPE html><html><style>body{margin:0;padding:10px;background:#000;color:#fff;font-family:monospace}canvas{border:1px solid #666;background:#111;margin-right:10px}</style><body><div style=display:flex><canvas id=c width=600 height=600></canvas><div style=display:inline-block><canvas id=g width=200 height=200></canvas><br><span id=t></span></div></div><script>const c=document.getElementById('c'),x=c.getContext('2d'),g=document.getElementById('g'),y=g.getContext('2d');let n=[],e=[],t=[],d=[],w=[],s=0;function i(){n=[];for(let a=0;a<22;a++)n.push({x:Math.random()*600,y:Math.random()*600});e=[];for(let a=0;a<22;a++)for(let b=a+1;b<22;b++){const p=n[a].x-n[b].x,q=n[a].y-n[b].y,r=Math.sqrt(p*p+q*q);if(r<150)e.push({a,b,d:r});}e.sort((a,b)=>a.d-b.d);t=[Math.floor(Math.random()*22)];d=[];w=[0];s=0;}function h(){if(t.length===22)return;const a=new Set(t);let b=null;d=[];for(let c of e){if(a.h …

Excerpt — the full answer is on the round page.

▶ R164 · Boids flocking with separation, alignment, cohesion and a predatorauthor reference Open round →
<!DOCTYPE html><html><head><style>body{margin:0;background:#000}#d{position:fixed;top:10px;left:10px;color:#fff;font:14px monospace}</style></head><body><canvas id="c"></canvas><div id="d"></div><script>const c=document.getElementById('c'),x=c.getContext('2d'),w=c.width=innerWidth,h=c.height=innerHeight,d=document.getElementById('d');class B{constructor(){this.x=Math.random()*w;this.y=Math.random()*h;this.vx=(Math.random()-.5)*2;this.vy=(Math.random()-.5)*2}update(bs,p){let s={x:0,y:0},a={x:0,y:0},o={x:0,y:0},n=0;for(let b of bs){if(b!==this){let dx=b.x-this.x,dy=b.y-this.y,r=Math.hypot(dx,dy);r<50&&(s.x-=dx,s.y-=dy);r<100&&(a.x+=b.vx,a.y+=b.vy,o.x+=b.x,o.y+=b.y,n++)}}if(n){a.x/=n;a.y/=n;o.x/=n;o.y/=n;this.vx+=a.x*.01+s.x*.1+(o.x-this.x)*.001;this.vy+=a.y*.01+s.y*.1+(o.y-this.y)*.001}let r=Math.hypot(p.x-this.x,p.y-this.y);r<80&&(this.vx+=(this.x-p.x)/r*.2,this.vy+=(this.y-p.y)/r*.2);let …

Excerpt — the full answer is on the round page.

▶ R165 · Recursive backtracker carving a maze, then solving itauthor reference Open round →
<!DOCTYPE html><html><head><title>Maze</title><style>body{margin:0;background:#000}canvas{display:block}</style></head><body><canvas id="c"></canvas><script>const CX=25,RX=18,CS=32;let c=document.getElementById('c'),x=c.getContext('2d');c.width=800;c.height=576;let g=[],st=[],cur,cv=0,md='g',wnd,stp=0,fin=0;function ini(){g=[];for(let r=0;r<RX;r++){g[r]=[];for(let c=0;c<CX;c++)g[r][c]={v:0,w:[1,1,1,1]}}st=[];cv=0;let r=Math.floor(Math.random()*RX),c=Math.floor(Math.random()*CX);cur=g[r][c];cur.v=1;cv=1;md='g';stp=0}function gen(){let u=[];[[0,-1],[0,1],[-1,0],[1,0]].forEach((d,i)=>{let nr=cur.r+d[0],nc=cur.c+d[1];if(nr>=0&&nr<RX&&nc>=0&&nc<CX&&!g[nr][nc].v)u.push([g[nr][nc],i])});if(u.length){let[nt,d]=u[Math.floor(Math.random()*u.length)];cur.w[d]=0;nt.w[[1,0,3,2][d]]=0;nt.v=1;st.push(cur);cur=nt;cv++}else if(st.length)cur=st.pop();else{md='s';wnd={r:0,c:0}}}function slv(){let mv=0;[[0, …

Excerpt — the full answer is on the round page.

▶ R166 · Faithful 3-sentence summary of a chaotic meeting transcriptauthor reference Open round →
The team decided to move the weekly status update from Friday afternoon to Monday morning starting next week and to adopt Priya's new five-label ticketing system. Priya will update the shared labeling guide document by Wednesday, and Tom will send out the updated calendar invite reflecting the Monday change by end of day Friday. The office plant budget discussion was pushed to the next meeting with no decision made today.
▶ R167 · One-sentence TL;DR under 25 wordsauthor reference Open round →
Legacy /v1/reports API shuts down September 30, 2026; upgrade to /v3/reports plus enjoy new Dark Mode, Dashboards, and Scheduled Exports.
▶ R168 · Extract action items as a checklistauthor reference Open round →
1. Maria -- finalize homepage copy and send to Ben for review -- Thursday
2. Ben -- review homepage copy -- Friday
3. Chen -- fix contact form bug -- Monday
4. Maria -- chase client on logo color confirmation -- today
5. Ben -- send privacy policy draft to legal -- next Wednesday
▶ R169 · Neutral summary of a biased product rantauthor reference Open round →
The blender leaks liquid from the base seal when filled past the halfway line. The 10-speed dial does not function as labeled, with speeds 4 through 7 producing identical results. The motor automatically shuts off after approximately 90 seconds of continuous use.
▶ R170 · Compress a how-to into exactly 5 numbered stepsauthor reference Open round →
1. Mix 100g whole wheat flour + 100g room-temperature water, loosely cover, 24 hours.
2. Discard half, feed with 100g flour + 100g water daily for 5 more days.
3. By day 7, look for bubbles and tangy smell.
4. Wait until it doubles within 4-6 hours after feeding.
5. Your sourdough starter is now active and ready to use.
▶ R171 · Fireworks bursting into fading sparksauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Fireworks</title><style>body{margin:0;overflow:hidden;background:#001}canvas{display:block}#cnt{position:fixed;top:10px;left:10px;color:#fff;font-family:monospace;font-size:14px}</style></head><body><canvas id="c"></canvas><div id="cnt">0</div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),cnt=document.getElementById('cnt');c.width=innerWidth;c.height=innerHeight;let p=[],t=0;const col=['#f00','#0f0','#00f','#ff0','#f0f','#0ff','#f80','#f08'];function rocket(){const x=Math.random()*c.width,y=c.height,vx=(Math.random()-0.5)*1.5,vy=-Math.random()*6-4;p.push({x,y,vx,vy,life:1,tp:0,tl:[],sz:2});}function boom(px,py){const n=Math.floor(Math.random()*40+40),cl=col[Math.floor(Math.random()*8)];for(let i=0;i<n;i++){const a=Math.random()*6.28,s=Math.random()*3.5+1;p.push …

Excerpt — the full answer is on the round page.

▶ R172 · Raindrops sliding down a window paneauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<title>Rain on Window</title>
<style>
body{margin:0;overflow:hidden;background:#1a1a1a}
canvas{display:block}
#counter{position:absolute;top:10px;left:10px;color:#ddd;font-family:sans-serif;font-size:14px;z-index:10}
</style>
</head>
<body>
<canvas id="c"></canvas>
<div id="counter">Droplets: 0</div>
<script>
const canvas=document.getElementById('c');
const ctx=canvas.getContext('2d');
const counter=document.getElementById('counter');
canvas.width=window.innerWidth;
canvas.height=window.innerHeight;

class Drop{
  constructor(x,y){
    this.x=x;
    this.y=y;
    this.size=Math.random()*2+0.5;
    this.moving=false;
    this.vx=(Math.random()-0.5)*0.4;
    this.vy=0;
    this.trail=[];
    this.life=1;
  }
  update(){
    this.size+=0.04;
    if(!this.moving&&this.size>4.5)this.moving=true;
    if(this.moving){
      this.vy+=0.25;
      this.vx+=(Math.rando …

Excerpt — the full answer is on the round page.

▶ R173 · Metaball lava lamp with heating and cooling blobsauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Metaball Lava Lamp</title><style>body{margin:0;overflow:hidden;background:#1a1a1a}canvas{display:block;background:#222}</style></head><body><canvas id="c"></canvas><div style="position:absolute;top:10px;left:10px;color:#fff;font:12px monospace">Blobs: <span id="cnt">0</span></div><script>const cv=document.getElementById('c'),ctx=cv.getContext('2d'),w=cv.width=400,h=cv.height=600;let blobs=[];const lampW=120,lampH=400,lampX=w/2-lampW/2,lampY=h-lampH;function createBlob(){return{x:lampX+lampW/2+Math.random()*40-20,y:lampY+lampH-Math.random()*80,r:12+Math.random()*8,vx:(Math.random()-0.5)*0.5,vy:0,temp:Math.random()*0.5+0.5}}function resetBlobs(){blobs=[];for(let i=0;i<5+Math.floor(Math.random()*4);i++)blobs.push(createBlob())}resetBlobs();function drawLamp(){ctx.strokeStyle='rgba(200,200,200,0.4)';ctx.lineWidth=3;ctx.beginPath();ctx.r …

Excerpt — the full answer is on the round page.

▶ R174 · Recursive fractal tree growing branch by branchauthor reference Open round →
<!DOCTYPE html><html><head><meta charset="UTF-8"><style>body{margin:0;padding:0;background:#1a1a1a;display:flex;justify-content:center;align-items:center;height:100vh;font-family:Arial}canvas{background:#0d0d0d}#info{position:absolute;top:10px;left:10px;color:#0f0;font-size:14px}</style></head><body><div id="info">Branches: <span id="count">0</span></div><canvas id="canvas"></canvas><script>const c=document.getElementById('canvas'),ctx=c.getContext('2d');c.width=800;c.height=600;let branchCount=0,time=0,tree=[],phase='grow';function genTree(x,y,a,l,d,t){if(d<0||l<2)return;const x2=x+Math.cos(a)*l,y2=y+Math.sin(a)*l;tree.push({x,y,x2,y2,d,t,drawn:0});const da=.3+Math.random()*.4,dl=l*.65+Math.random()*.15;genTree(x2,y2,a-da,dl,d-1,t+1);genTree(x2,y2,a+da,dl,d-1,t+1)}function draw(){ctx.fillStyle='#0d0d0d';ctx.fillRect(0,0,c.width,c.height);if(phase==='grow'){let done=true;for(let b of tre …

Excerpt — the full answer is on the round page.

▶ R175 · Noise flowfield painting additive particle trailsauthor reference Open round →
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Flowfield</title>
<style>body{margin:0;overflow:hidden;background:#000}canvas{display:block}</style>
</head>
<body>
<canvas id="c"></canvas>
<div id="info" style="position:absolute;top:10px;left:10px;color:#0f0;font-family:monospace">Particles: 0</div>
<script>
const c=document.getElementById('c'),ctx=c.getContext('2d'),info=document.getElementById('info');
c.width=window.innerWidth;c.height=window.innerHeight;
function noise(x,y,seed=0){const n=(Math.sin(x*12.9898+y*78.233+seed)*43758.5453)%1;return n;}
function simplex(x,y,t,scale=50){const i=Math.floor(x/scale),j=Math.floor(y/scale),f=(x%scale)/scale,g=(y%scale)/scale;
const n00=noise(i,j,t),n10=noise(i+1,j,t),n01=noise(i,j+1,t),n11=noise(i+1,j+1,t);
const u=f*f*(3-2*f),v=g*g*(3-2*g);
const nx0=n00*(1-u)+n10 …

Excerpt — the full answer is on the round page.

▶ R176 · Fix exactly the errors, change nothing elseauthor reference Open round →
On Monday morning, the small archive opened its new reading room to local students. The room has six desks, two lamps, and a shelf for returned notebooks. Before the first group arrived, Mara checked the sign-in sheet and placed pencils beside each chair. She noticed that one window was stuck, but the hallway was quiet and the heater worked well. At nine o'clock, twelve students entered the archive, greeted the staff, and began comparing old town maps. Their teacher asked them to write short notes about every map they handled. One student found a drawing of the river bridge, and another matched it to a photograph from 1912. By noon, the class had labeled the boxes, cleaned the tables, and thanked Mara for her help. The visit ended on time, and the archive stayed open for regular visitors after lunch.
▶ R177 · Make the numbers consistentauthor reference Open round →
Workshop attendance report:

The registration desk recorded 18 participants: 7 from North Hall, 6 from East Studio, and 5 from River Annex. The header currently says 18 participants attended.

The event ran on Wednesday, March 4, 2026, and the same paragraph later calls it Wednesday. The room booking confirmation and the posted schedule both list Wednesday, March 4, 2026.

For the feedback survey, 15 of the 18 participants submitted forms. The draft summary says this equals 83%, and 15 out of 18 is 83% when rounded to the nearest whole percent.
▶ R178 · Remove redundancy without losing factsauthor reference Open round →
The neighborhood mobile clinic opens April 8 at the Maple Community Center on Maple Street. Operating hours are Wednesdays from 10 a.m. to 4 p.m., with this schedule repeating weekly. The clinic provides free blood pressure checks, vaccinations, and brief medical consultations at no cost. Residents can book appointments by phone or schedule in person at the center. Spanish and Vietnamese interpreters will be available during all clinic hours to assist visitors.
▶ R179 · Unify tense and perspectiveauthor reference Open round →
At dawn, I stepped onto the station platform and checked the timetable. I noticed the last train number blinking on the board before the screen went dark. I waited beside the vending machine, but I kept looking toward the empty tracks. The loudspeaker crackled, and I heard a short apology for the delay. Then I walked to the ticket office, where the clerk handed over a paper voucher. I folded the voucher into my notebook and was thinking about the missed connection. I finally boarded the replacement bus, and I sat near the back window. As the bus left town, I watched the station lights disappear behind the rain.
▶ R180 · Fix the broken referencesauthor reference Open round →
Maintenance note for the demo room:

The tablet is stored in the blue cabinet, and it must be charged before each session.
The projector was tested after lunch; it should remain unplugged overnight.

Setup steps:
1. Unlock the cabinet.
2. Place the tablet on the stand.
3. Start the room timer.

149 of these entries are author references from blind rounds — this model answered the same prompt outside the blind field, so they are not counted in the statistics above.