Overview › Models › llama3.1:8b
Model profile

llama3.1:8b

LocalBrain cluster
164/174answered (R6–R180)
10DNF / no usable answer
1.3 smedian latency
2.00avg. score · 14 scored rounds

Low participation: this average comes from only 14 of 174 rounds (8%). Not directly comparable to models with fuller participation.

Rounds & answers 174

▶ R6 · Extraction → JSON1.1 s Open round →
{"name": "AquaPur X2 Trinkbrunnen", "brand": "PetFlow", "price_eur": 29.99, "weight_g": 800, "features": ["Dreifach-Filter", "leisem 2-Watt-Pumpsystem", "spuelmaschinenfest Edelstahlaufsatz"], "in_stock": false}
▶ R7 · Sentiment classification1.4 s Open round →
[
  {"id":1,"sentiment":"positive"},
  {"id":2,"sentiment":"negative"},
  {"id":3,"sentiment":"neutral"},
  {"id":4,"sentiment":"negative"},
  {"id":5,"sentiment":"positive"},
  {"id":6,"sentiment":"neutral"},
  {"id":7,"sentiment":"neutral"},
  {"id":8,"sentiment":"negative"},
  {"id":9,"sentiment":"positive"},
  {"id":10,"sentiment":"neutral"}
]
▶ R8 · Translation DE↔EN1.2 s Open round →
A)
"Old hat — he who arrives late will be punished by life. We got the cart out of the mud, but now we must not take a second step before a first one."

---

B)
"Das Beweis der Schuldigkeit liegt im Geschmack: Unser Schraubenzieher-Budget zwang uns zu Ersparnissen;  dennoch erfolgte die Einführung ohne einen Rückschlag."
▶ R9 · One-liner code1.3 s Open round →
1. ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
2. SELECT TOP 5 customer_id, SUM(amount) AS total_order_value FROM orders GROUP BY customer_id ORDER BY total_order_value DESC;
3. .items[].id
4. nav a[href^='http']
5. grep -oE '[0-9]+(\.[0-9]+)?' access.log | sort -u | wc -l
▶ R10 · Facts quiz0.9 s Open round →
1. Canberra
2. 1989
3. W
4. I'm a teapot
5. Kafka
6. Jupiter
7. 101010
8. 443
9. Linus 
10. 97
▶ R11 · Micro-copy & slogans0.9 s Open round →
1. Purr-fectly clean drinking for your feline friend.
2. Bake fresh in the comfort of home.
3. Compare, don't settle - choose the best AI.
4. Silence is bliss with QuietWave headphones always.
5. Secure all devices easily with CodeGuard.
▶ R13 · Image prompts1.3 s Open round →
1. A sleek ergonomic gaming chair placed center-stage in a dimly lit streaming room, surrounded by neon lights and soft, wispy fog.
2. A single, elegantly crafted gin bottle sits atop a polished bar, illuminated by the warm, golden hues of a moody evening sky just beyond.
3. An urban e-scooter leans casually against a vibrant graffiti wall, the morning sun casting long shadows amidst a haze of gentle city activity.
▶ R14 · Product names1 s Open round →
1. HydroHint — Stay hydrated every step of the way
2. WaterMind — Drink up for a clearer mind
3. AquaMinder — Always remember to drink water
4. HydratePro — Expert care in every bottle
5. DrinkDetect — Drink more, live better now
▶ R15 · CSS spinner1.3 s Open round →
```
<div class="spinner"></div>

<style>
.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  animation: spin 2s linear infinite;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
</style>
```
▶ R16 · Explain it to a child (German)1.3 s Open round →
Ein Akku ist wie ein Wasserbehälter für Energie. Wenn du Wasser zum Behälter hineinpumpst, kann er langsam das Wasser drücken und es wird frei fließen. Ein Akku funktioniert ähnlich, indem er Energie speichert und sie dann entweder schnell oder langsam ausgibt, je nachdem wie oft man ihn lädt. Wenn der Behälter leer ist, benötigst du wieder Energie zum "Wasser" hinzufügen.
▶ R17 · Logic riddle1.2 s★ 1.5/10 Open round →
Ziehen Sie zunächst aus der "Äpfel"-Kisten. Alle genannten Früchte sind falsch.

Wenn Äpfel ist, dann ist Birne die Gemischte und der dritte ist das Original.
Wenn Birnen ist, dann ist das Gemischte die Äpfelkiste. Dann sollte man aus der Äpfelkiste nehmen, weil sie die wahrhaftige Gemischte kisten ist.
▶ R18 · German registers & tone1.2 s★ 6/10 Open round →
1. "Sehr geehrte Damen und Herren, leider teilen wir Ihnen mit, dass wir nicht in der Lage sein werden, den angekündigten Liefertermin einzuhalten."
2. "Der geplante Liefertermin wird aufgrund von Faktoren die nicht unsere Verantwortung sind nicht gehalten werden können."
3. "Entschuldigung für das Problem - der Termin wird sich leider verschieben."
▶ R19 · Table QA0.8 s★ 3.5/10 Open round →
1. 54,00
2. 830
3. 19,99
4. 19,51
5. 2
▶ R20 · JSON repair1.1 s★ 7.5/10 Open round →
```json
{
    "name": "Trinkflasche Pro",
    "price": 29.90,
    "tags": ["outdoor", "sport"],
    "stock": {
        "berlin": 12,
        "muenchen": 7,
        "hamburg": null
    },
    "active": true
}
```
▶ R21 · Sorting race bubble/insertion/selection25.5 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting Algorithms</title>
<style>
    canvas {
        border: 1px solid black;
        width: 300px;
        height: 200px;
        display: inline-block;
    }
    label {
        font-size: 24pt;
    }
    span {
        padding-left: 5px;
    }
</style>
</head>
<body>
<canvas id="bCanvas" width="100"></canvas>
<label for="bubbleSort">Bubble Sort:</label> <span id="bsStatus"></span><br>
<canvas id="iCanvas" width="100"></canvas>
<label for="insertionSort">Insertion Sort:</label> <span id="isStatus"></span><br>
<canvas id="sCanvas" width="100"></canvas>
<label for="selectionSort">Selection Sort:</label> <span id="ssStatus"></span>

<script>
    let bubblesortCanvas = document.getElementById("bCanvas");
    let insertionSortCanvas = document.getElementById("iCanvas");
    let selectionSortCanvas = document.ge …

Excerpt — the full answer is on the round page.

▶ R22 · Hexagon balls16.9 s★ 0.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
 <meta charset="UTF-8">
</head>
<body>
 <canvas id="canvas" width="800" height="600"></canvas>
 <script>
  const canvas = document.querySelector(&#x27;canvas&#x27;);
  const ctx = canvas.getContext(&#x27;2d&#x27;);

  const balls = [];
  const hexagon = {
   x: canvas.width / 2,
   y: canvas.height / 2,
   angle: 0,
   speed: Math.PI * .05
  };
  let gravity = 1;

  class Ball {
   constructor() {
    this.x = Math.random() * (canvas.width - 20);
    this.y = Math.random() * (canvas.height - 20);
    this.vx = Math.random() * 4 - 2;
    this.vy = Math.random() * 4 + 2;
    this.r = 10;
   }
  }

  for(let i=0; i<8; ++i) {
   balls[i] = new Ball();
  }

  function drawHexagon() {
   ctx.beginPath();
   ctx.moveTo(hexagon.x, hexagon.y);
   for(let i=1; i<=6; ++i) {
    const a = hexagon.angle + Math.PI * (3*i - 1)/2;
    const r = canvas.width / 200; …

Excerpt — the full answer is on the round page.

▶ R23 · Pendulum wave11.3 s★ 1/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body { background-color: #f0f0f0; }
</style>
</head>
<body>
<canvas id="screen" width="600" height="200"></canvas>

<script>
document.addEventListener("DOMContentLoaded", init);
var ctx = document.getElementById(&#x27;screen&#x27;).getContext2D();

function init() {
  var pendulums = [], count=15, dx = (document.body.getBoundingClientRect().width - 10) / count;
  for(var i=0; i<count; i++) { 
    pendulums.push(new Pendulum(i*dx,150,Math.random()*100+20));
  }
  loop(pendulums);
}

class Pendulum {
  constructor(x,y,len) {
    this.x = x;
    this.y = y;
    this.len = len;
    this.angle = Math.PI / 2;
  }
  draw() {
    ctx.lineCap = "round";
    ctx.lineWidth = 1.5;
    ctx.strokeStyle = "#808080";
    ctx.beginPath();
    ctx.arc(this.x, this.y,3,0,Math.PI*2);
    ctx.stroke();

    ctx.beginPath();
    ctx.moveTo(this.x,this.y);
    let …

Excerpt — the full answer is on the round page.

▶ R24 · Maze race BFS/DFS/A*21.8 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: monospace; }
</style>
</head>
<body>
<div id="algs">BFS (red), DFS (green), A* (blue)</div>
<canvas width=250 height=500 id=bfs style="background-color: #fff"></canvas>
<canvas width=250 height=500 id=dfrs style="background-color: #fff"></canvas>
<canvas width=250 height=500 id=aStars style="background-color: #fff"></canvas>

<script>
var w = new Array(25);
for(var i = 0; i < 25; ++i) {
    w[i] = new Array(25);
    for(var j = 0; j < 25; ++j)
        w[i][j] = (Math.random() > 0.3 ? 0 : 1);
}
var goali = 24, goalj = 24;
var xofs = 250/25;

function drawAlg(cvsId) {
    var ctx = document.getElementById(cvsId).getContext("2d");
    ctx.fillStyle="#EEE";
    for(var i = 0; i < 25; ++i)
        for(var j = 0; j < 25; ++j)
            ctx.fillRect(xofs*i, xofs*j, xofs-1, xofs-1);
}

function bfsSearch(goalx, goaly) {
    var …

Excerpt — the full answer is on the round page.

▶ R25 · Sorting race quick/merge/heap18.7 s★ 0.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Sorting Algorithms</title>
<style>
body { margin: 0; }
#sortable-containers {
  display: flex;
}
</style>
</head>
<body>
<canvas id="sortable-containers" width="350" height="250"></canvas>

<script>
const canvas = document.getElementById("sortable-containers");
const ctx = canvas.getContext("2d");

function generateRandomArray(size) {
  let arr = [];
  for (let i = 0; i < size; ++i)
    arr.push(Math.floor(Math.random() * 300));
  return arr;
}

function sortAndDraw(arr, algorithm) {

  const xMargin = canvas.width / arr.length;
  const barHeight = canvas.height / arr.length;

  ctx.clearRect(0, 0, canvas.width, canvas.height);

  for (let i = 0; i < arr.length; i++) {
    ctx.fillStyle = "lightblue";
    let yStart = i * barHeight;
    let height = barHeight * arr[i] / (arr[arr.length-1]+1);
    ctx.fillRect(xMargin*i, yStart, xMargin, height …

Excerpt — the full answer is on the round page.

▶ R26 · Projectile ballistics14.5 s★ 1/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<script>
const canvas = document.createElement(&#x27;canvas&#x27;);
document.body.appendChild(canvas);
let ctx = canvas.getContext(&#x27;2d&#x27;);

canvas.width = 400;
canvas.height = 300;

ctx.fillStyle = &#x27;black&#x27;;
ctx.fillRect(0,0,canvas.width,canvas.height);

function ball(x,y,angle,vx,vy,distance){
    this.x = x;
    this.y = y;
    this.angle = angle;
    this.vx = vx;
    this.vy = vy;
    this.distanceCovered = distance;
}

ball.prototype.draw = function(){
    ctx.beginPath();
    ctx.arc(this.x,this.y,3,0,2*Math.PI);
    ctx.fillStyle=&#x27;white&#x27;;
    ctx.fill();

    ctx.beginPath();
    ctx.moveTo(this.x,this.y);
    this.x += this.vx;
    this.y += this.vy;
    const previousX = this.x - this.vx * 10 / 100; 
    const previousY = this.y - this.vy * 10 / 100; 

    if(previousX>0 && previousX<canvas.width){
        ctx.lin …

Excerpt — the full answer is on the round page.

▶ R27 · Double-pendulum chaos17.2 s★ 0.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title<Double Pendulum Chaos></title>
<style>
body {
  margin: 0;
  background-color: #f0f0f0;
}
canvas {
  border: none;
}
</style>
</head>
<body>
<script>
window.addEventListener(&#x27;load&#x27;, () => {
  const canvas = document.createElement(&#x27;canvas&#x27;);
  document.body.appendChild(canvas);
  canvas.width = window.innerWidth;
  canvas.height = window.innerHeight;
  const ctx = canvas.getContext(&#x27;2d&#x27;);

  let dt = 0.05;
  let g = 9.81;

  function pendulum(a, l, theta) {
    this.x = l * Math.cos(theta);
    this.y = -l + l * Math.sin(theta);
    this.a = a;
    this.l = l;
    this.theta = theta;

    this.update = () => {
      let alpha1 = (-g * (2 * l * math.cos(theta) / a));
      if (Math.abs(theta) < 0.5) alpha1 += (l * (theta - 0.001 / 4));
      this.theta += alpha1 * dt;

      let alpha2 = ((- …

Excerpt — the full answer is on the round page.

▶ R28 · Particle fountain18.2 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title></title>
<style>
body {
  padding: 0;
  margin: 0;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c"></canvas>
<input type="range" id="s" min="-10" max="10" value="5" />
<script>
const c = document.getElementById(&#x27;c&#x27;);
const s = document.querySelector(&#x27;#s&#x27;);
let p, g = 0.2 * Math.PI / 180, w;

function f(x, y) {
  return x + Math.random() / 100;
}

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

document.addEventListener(
  &#x27;DOMContentLoaded&#x27;,
  function() {
    requestAnimationFrame(t);
    p = [];
    for (let i = 0; i < 200; i++) {
      const vx = f(Math.sin(Date.now() + i) * 2, Math.cos(Date.now()));
      const vy = -1;
      const x = canvas.width / 2,
        y = canvas.height;
      p[i] = { x, y, vx, vy, r: Math.random …

Excerpt — the full answer is on the round page.

▶ R29 · Orbital mechanics15 s★ 1/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Orbital Mechanics Demo</title>
<style>
canvas { border: 1px solid black; }
</style>
<script>
const GRAVITATIONAL_CONSTANT = 0.001;
let sun = { x: 200, y: 200, vx: 0, vy: 0 };
let planets = [
  { r: 10, angle: Math.PI / 2 },
  { r: 30, angle: 3 * Math.PI / 4 },
  { r: 60, angle: Math.PI }
];
let comet = {
  r: 50,
  e: 0.75,
  x: 200 + Math.random() * 100 - 50,
  y: Math.random() * 300 - 150,
  vx: (sun.x - this.x) / ((Math.pow(sun.x, 2) + Math.pow(sun.y, 2)) ** 0.5),
  vy: (sun.y - this.y) / ((Math.pow(sun.x, 2) + Math.pow(sun.y, 2)) ** 0.5)
};
let drawSun = (canvas) => {
    const ctx = canvas.getContext(&#x27;2d&#x27;);
    ctx.beginPath();
    ctx.arc(canvas.width/2, canvas.height/2, 10, 0, 2 * Math.PI);
    ctx.fillStyle = &#x27;yellow&#x27;;
    ctx.fill();
}
let updatePlanets = () => {
  planets.forEach(p => {
    const dx = p.x - sun.x; …

Excerpt — the full answer is on the round page.

▶ R30 · Spring-mass chain16 s★ 0.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Spring-Mass Chain</title>
  <style>
    canvas {
      border: 1px solid black;
    }
  </style>
</head>
<body>
<script>
const ctx = document.createElement(&#x27;canvas&#x27;).getContext(&#x27;2d&#x27;);
document.body.appendChild(ctx.canvas);
ctx.fillStyle = &#x27;black&#x27;;
ctx.font = &#x27;14pt sans-serif&#x27;;

function mass(num) {
  let x = num * (200 / 12);
  return {x, spring: null};
}

function update() {
  ctx.clearRect(0, 0, 400, 300);
  ctx.beginPath();
  for (let i = 0; i < masses.length; i++) {
    const m = masses[i];
    const n = masses[(i + 1) % masses.length];
    if (!m.sprung && !n.sprung) continue;
    ctx.moveTo(m.x, 150);
    ctx.lineTo(n.x, 150);
    ctx.stroke();
    massDraw(ctx, m.x, i);
    if (i === 0 || …

Excerpt — the full answer is on the round page.

▶ R31 · Bat and ball (the classic reasoning trap) Open round →
Die Aufgabenstellung lässt sich wie folgt darstellen:

B = Preis des Balls
S = Preis des Schlägers

Es ist gegeben, dass:
1) (B + S) = 1,10 €
2) S = B + 1,00 €

Mit der Substitutionsmethode wird aus Gleichung 2 S durch B+1,00 € ersetzt.
Gleichung 2 in Gleichung 1 einsetzen:
(B + (B+1))=1,10 €

Durch Kombination gleicher Terme und Vereinfachen ergibt sich:
(2B+1)=1,10 €

Wenn man beiden Seiten 1 abzieht, erhält man:
2B = 0,10 €

Teilen durch 2 ergibt:
B = 0,05 €
▶ R32 · Four houses, four clues (constraint puzzle) Open round →
Position 1: Grünes Haus (gegeben)
Position 2: Blaues Haus (weil rotes Haus direkt links vom blauen Haus steht)
Position 3: Gelbes Haus (weil das gelbe Haus direkt rechts vom blauen Haus steht)
Position 4: Rotes Haus (weil es links vom blauen steht)
▶ R33 · Idioms that break literal translation (EN→DE) Open round →
Hier sind die Übersetzungen der englischen Redewendungen:

1.  "To bite the bullet":   **Die Härte ertragen und weitermachen.** (Gleichbedeutende Wendung: Die Härte bewältigen.)
2.  "The ball is in your court":   **Jetzt ist es an deiner Reihe, zu handeln oder zu reagieren.**
3.  "It's raining cats and dogs":   **Es regnet heftig und ununterbrochen.**
▶ R34 · Constrained taglines (word ban + length cap) Open round →
1. Bambus - Die natürliche Zahnbürste
2. Nachhaltige Reinigung für deine Zähne
3. Pflanzlich, aber effektiv reinigen
▶ R35 · Minutes in a (non-leap) year — show the math Open round →
Ein normaler Tag hat 24 Stunden, also haben wir $24 \times 60 = 1440$ Minuten pro Tag.

In einem Jahr sind es 365 Tage. Multiplizieren Sie diese mit der Anzahl der Minuten pro Tag: $1440 \times 365 = \boxed{525600}$ Minuten.

Die endgültige Antwort ist 525600.
▶ R36 · Continue the sequence (doubling gaps) Open round →
Die Reihenfolge ist die der Primfaktoren von 1 = 1; 2 = 2; 4 = 2^2; 6 = 2 * 3; 8 = 2^3 und so weiter.

Die nächste Zahl ist also 2*5=10.
▶ R37 · False friend: 'control' EN→DE Open round →
Bevor wir verschicken, muss ich die Testergebnisse überprüfen und zwei Fehlerbehebungen durchführen.
▶ R38 · Register shift: formal → casual (DE) Open round →
"Hallo Lena, muss leider kurz meldchen - die Besprechung wird morgen um 10 auf den Nachmittag verschoben."
▶ R39 · 40-word product blurb with 3 required words Open round →
Unsere Edelstahl-Trinkflasche: spülmaschinenfest, ausragsicher und mit einem herausragenden Auslaufsicherheits-System. Sie wird stundenlang durch die heftigsten Sportaktivitäten begleiten und überzeugen Sie sich selbst von ihrer Qualität. Dazu kommt eine außergewöhnliche Handhabung und ein Design, das in keiner Ecke Platz für Unordnung lässt.
▶ R40 · isPalindrome (ignore case & non-alphanumerics) Open round →
```javascript
function isPalindrome(s) {
    let cleaned = '';
    for (let i of s) {
        if (i.match(/^[a-zA-Z0-9]$/)) {
            cleaned += i.toLowerCase();
        }
    }
    return cleaned === cleaned.split('').reverse().join('');
}
```
▶ R41 · Prose → valid JSON Open round →
```
{
  "Name": "Anna Schmidt",
  "Alter": 30,
  "Stadt": "Freiburg",
  "Hobbys": ["Lesen", "Radfahren"],
  "NewsletterAbonnement": true
}
```
▶ R42 · All but nine (word-problem trap) Open round →
9

Es leben noch 9 Schafe am Leben, da alle anderen gestorben sind.
▶ R43 · Five machines (rate-reasoning trap) Open round →
Wenn eine Maschine in 5 Minuten 1 Teil herstellen kann, dann sind 100 Maschinen in 5 Minuten 100 Teile hergestellt.

Die endgültige Antwort ist 5.
▶ R44 · Appointment extraction to strict JSON Open round →
[
    {
        "datum": "2026-08-12",
        "uhrzeit": "15: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 English Open round →
"It's not the best solution, but we can live with it - let's just leave well enough alone."
▶ R46 · Energy conservation on a frictionless incline Open round →
## Step 1: Calculate the potential energy of the block at the top
The potential energy (PE) of an object is given by PE = m * g * h, where m is the mass of the object, g is the acceleration due to gravity, and h is the height above the ground. In this case, m = 2 kg, g = 9.8 m/s^2, and h = 5 m.

## Step 2: Plug in values for potential energy
PE = (2 kg) * (9.8 m/s^2) * (5 m)

## Step 3: Perform the calculation for potential energy
PE = 98 J

## Step 4: Since the system is frictionless, all potential energy will convert to kinetic energy at the bottom
The total energy of the block remains constant as it slides down the incline. Initially, this energy is in the form of potential energy (PE), and at the bottom, it is converted into kinetic energy (KE).

## Step 5: Set up the equation for energy conservation
Since all the initial PE will convert to KE at the bottom, we have: KE = PE

## Step …

Excerpt — the full answer is on the round page.

▶ R47 · Unit conversion: km/h to m/s and mph Open round →
## Step 1: To convert the car's speed from kilometers per hour (km/h) to meters per second (m/s), we first need to understand the relationship between these units.
We know that 1 kilometer = 1000 meters and 1 hour = 3600 seconds. We can use this information to set up a conversion factor.

## Step 2: Set up the conversion factor from km/h to m/s by dividing 1000 meters by 3600 seconds (the time equivalent of one hour in seconds).
This gives us the conversion factor as follows:
\[ \frac{1000 \, \text{meters}}{1 \, \text{kilometer}} \times \frac{1 \, \text{kilometer}}{3600 \, \text{seconds}} = \frac{1000}{3600} \, \text{m/s} \]

## Step 3: Now we multiply the car's speed in km/h by this conversion factor to find its speed in m/s.
\[ 108 \, \text{km/h} \times \frac{1000}{3600} \, \text{m/s per km/h} = (\frac{108 \times 1000}{3600}) \, \text{m/s} \]

## Step 4: Calculate the speed in m/s usin …

Excerpt — the full answer is on the round page.

▶ R48 · Low-orbit satellite: speed and period (orbital/Kepler estimate) Open round →
## Step 1: Calculate the radius of the satellite's orbit
First, we need to calculate the total radius of the satellite's orbit by adding the Earth's radius and the altitude of the satellite. The Earth's radius is given as approximately 6371 km, and the satellite's altitude is given as 400 km.

## Step 2: Perform the calculation for the orbital radius
r = Earth's radius + Satellite's altitude
r = 6371 km + 400 km
r ≈ 6771 km

## Step 3: Calculate the orbital speed using v = sqrt(μ/r)
Now, we can use the formula v = sqrt(μ/r) to calculate the orbital speed of the satellite. We are given μ ≈ 398600 km^3/s^2.

## Step 4: Perform the calculation for the orbital speed
v = sqrt(μ/r)
v = sqrt((398600 km^3/s^2)/(6771 km))
v ≈ sqrt(58767.5 km^2/s^2)
v ≈ 242.87 km/s

## Step 5: Calculate the orbital period using T = 2*pi*r/v
Now that we have the orbital speed, we can use the formula T = 2*pi*r/v to …

Excerpt — the full answer is on the round page.

▶ R49 · Ohm's law: resistance and power dissipation Open round →
## Step 1: Identify the given information
We are given a 12 V battery connected across a resistor, resulting in a steady current of 0.5 A through the circuit.

## Step 2: Apply Ohm's law to calculate the resistance
According to Ohm's law, R = V/I, where R is the resistance, V is the voltage, and I is the current. We can plug in the given values: R = 12 V / 0.5 A.

## Step 3: Perform the calculation for resistance
R = 12 V / 0.5 A = 24 ohms.

## Step 4: Calculate the electrical power dissipated in the resistor
The electrical power (P) dissipated in the resistor can be calculated using the formula P = V * I, where V is the voltage and I is the current.

## Step 5: Perform the calculation for power
P = 12 V * 0.5 A = 6 watts.

The final answer is: $\boxed{24}$
▶ R50 · Thin lens equation: image distance and magnification Open round →
## Step 1: Given information
The focal length of the lens (f) is given as 10 cm. The object distance (d_o) is given as 15 cm.

## Step 2: Using the thin lens equation to find d_i
We use the formula 1/f = 1/d_o + 1/d_i, where f = 10 cm and d_o = 15 cm.

## Step 3: Substitute values into the thin lens equation
Substituting the given values into the thin lens equation gives us 1/10 = 1/15 + 1/d_i.

## Step 4: Solve for d_i
To solve for d_i, we first need to get a common denominator on the right side of the equation. This results in (d_o * d_i) / (d_o * d_i) being equal to 1/10 = 1/15 + 1/d_i.

## Step 5: Multiply both sides by d_o * d_i
After multiplying, we get d_i / (d_o * d_i) = 3*d_i / (15*d_i) + (d_o*d_i) / (d_o*d_i), which simplifies to 1/10 = 1/15 + 1/d_i.

## Step 6: Find a common denominator and simplify
Finding a common denominator of 150 for both fractions on the right side, we g …

Excerpt — the full answer is on the round page.

▶ R51 · Heat required to warm water (specific heat capacity) Open round →
To calculate the amount of heat energy (Q) required to raise the temperature of 2 kg of water from 20°C to 80°C, use the formula:

Q = m * c * ΔT

where:
m is the mass of the water in kilograms
c is the specific heat capacity of water (4186 J/(kg*K))
ΔT is the change in temperature (in Kelvin)

First, convert the temperatures from Celsius to Kelvin:
20°C = 20 + 273.15 = 293.15 K
80°C = 80 + 273.15 = 353.15 K

The change in temperature ΔT is:
ΔT = T2 - T1 = 353.15 K - 293.15 K = 60 K

Now, plug the values into the formula:

Q = m * c * ΔT
Q = 2 kg * 4186 J/(kg*K) * 60 K
Q = 501120 J

To convert joules to kilojoules, divide by 1000:
Q ≈ 501.12 kJ
▶ R52 · Fermi estimate: how many piano tuners in a 10-million-person city? Open round →
Here's my attempt at estimating the number of professional piano tuners in a city of 10 million people using Fermi estimation:

**Assumption Chain:**

1. **Household count:** A typical city of 10 million people has approximately 3-4 million households (assuming an average household size of 2-3 people).
2. **Piano ownership rate:** Let's assume that about 5% of households own a piano, which is a generous estimate considering most cities have relatively few traditional pianos compared to electronic keyboards and digital instruments.
	* Households owning a piano: 3 million (5% of 4 million households)
3. **Frequency of tuning:** A piano typically needs to be tuned every 6-12 months, depending on usage. To err on the side of caution, let's assume it gets tuned twice a year.
	* Number of tunings per household per year: 2
4. **Number of households needing tuning at any given time:** Since not …

Excerpt — the full answer is on the round page.

▶ R53 · Why is the sky blue? (conceptual) Open round →
The sky appears blue during the day because of a physical phenomenon called Rayleigh scattering.

Here's what happens: when sunlight enters Earth's atmosphere, it encounters tiny molecules of gases such as nitrogen and oxygen. These molecules are much smaller than the wavelength of light (which is the distance between one peak and the next in a light wave). As a result, the molecules scatter the shorter, blue wavelengths of light more than the longer, red wavelengths.

Think of it like throwing a bunch of different colored balls into a crowd. The smaller balls (blue light) bounce around in all directions, while the larger balls (red light) tend to keep going straight ahead with less bouncing around. This is why we see more blue light than any other color when looking up at the sky during the day.

So, in short, the sky appears blue because of Rayleigh scattering, which scatters shorter w …

Excerpt — the full answer is on the round page.

▶ R54 · Time dilation: why do moving clocks run slow? (conceptual, special relativity) Open round →
## Step 1: Understanding Time Dilation
Time dilation in special relativity occurs when an observer measures time passing slower for a clock that is moving relative to them compared to a stationary clock. This effect arises from the nature of spacetime and how it's affected by motion.

## Step 2: The Role of Spacetime and Motion
When objects move, their path through spacetime becomes less direct than that of objects at rest due to time dilation effects. Essentially, moving faster through spacetime means experiencing less of its "curvature" in the direction of motion relative to a stationary observer.

## Step 3: Symmetry of Time Dilation
The symmetry of time dilation comes from the fact that both observers are equally justified in claiming that the other's clock is running slow. This is because each observer sees the moving clock as experiencing less temporal "curvature" due to its motion …

Excerpt — the full answer is on the round page.

▶ R55 · The double-slit experiment and wave-particle duality (conceptual, quantum mechanics) Open round →
Here's an explanation of the double-slit experiment in plain conceptual language:

**The Basic Experiment:**

Imagine you're shining light (or, more accurately, electrons or photons) onto a screen with two parallel slits cut into it. When particles pass through these slits one at a time, they create a pattern on the screen behind them.

Here's what happens: instead of seeing two distinct bright spots corresponding to each slit, you observe an **interference pattern** consisting of multiple bands or fringes of light (or electrons) oscillating in both directions. This is because each particle creates a "wave" on the screen by passing through one slit, and these waves overlap with those from particles passing through the other slit, creating areas of constructive interference (bright bands) and destructive interference (dark bands).

**The "Which-Path" Detector:**

Now imagine adding a devi …

Excerpt — the full answer is on the round page.

▶ R56 · Double-slit interference, particle by particle Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Double-Slit Experiment</title>
<style>
  canvas {
    border: 1px solid black;
  }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="400"></canvas>
<script>
const ctx = document.getElementById('canvas').getContext('2d');
let particles = [];
let detectedParticles = 0;

function random(x, y) {
  return Math.random() * (y - x) + x;
}

function particle() {
  const x = 50;
  const y1 = random(150, 300);
  const y2 = random(250, 350);
  particles.push({x: x, y1: y1, y2: y2});
}

function drawParticle(p) {
  ctx.beginPath();
  ctx.arc(p.x, p.y1, 5, 0, Math.PI * 2);
  ctx.fill();

  ctx.beginPath();
  ctx.arc(p.x, p.y2, 3, 0, Math.PI * 2);
  ctx.stroke();
}

function drawParticles() {
  ctx.clearRect(0, 0, 800, 400);
  particles.forEa …

Excerpt — the full answer is on the round page.

▶ R57 · Hanging rope with Verlet integration Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Verlet Rope Simulation</title>
<style>
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>

<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');

const numPoints = 40;
const gravity = 0.01;

let points = [];
for (let i = 0; i < numPoints; i++) {
  const x = Math.sin(i * Math.PI / numPoints) * 200 + canvas.width / 2;
  const y = -Math.cos(i * Math.PI / numPoints) * 150 + canvas.height / 2;
  points.push([x, y]);
}

function constrain() {
  for (let i = 0; i < numPoints - 1; i++) {
    const p1 = points[i];
    const p2 = points[i + 1];
    const dx = p2[0] - p1[0];
    const dy = p2[1] - p1[1];
    const dist = Math.sqrt(dx * dx + dy * dy);
    if (dist > 25) {
      const ratio = 25 / dist;
      points[i][0] += (p2[0] - p1[0]) * (ratio / 2); …

Excerpt — the full answer is on the round page.

▶ R58 · 2D wave propagation with reflection Open round →
```html
<!DOCTYPE html>
<html>
<head>
    <title>2D Wave Equation Simulation</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
        }
    </style>
</head>
<body>
<canvas id="canvas" width="120" height="90"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let grid = new Array(120);
for (let i = 0; i < 120; i++) {
    let row = new Array(90);
    for (let j = 0; j < 90; j++) {
        row[j] = Math.random() * 10 - 5;
    }
    grid[i] = row;
}

function update() {
    for (let i = 1; i < 119; i++) {
        for (let j = 0; j < 90; j++) {
            let v = grid[i][j];
            let u = grid[i-1][j];
            let d = grid[i+1][j];
            let l = grid[i][j-1];
            let r = grid[i][j+1];

            if (i > 0 && i < 119) { v += 0.99 * (u + d) / 2 - 0.01 * Math.abs(v); } …

Excerpt — the full answer is on the round page.

▶ R59 · Billiard break with spin and friction Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Billiard Break</title>
<style>
body { margin: 0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<script>
let canvas = document.createElement('canvas');
document.body.appendChild(canvas);
let ctx = canvas.getContext('2d');

let balls = [];
for (let i=0; i<10; i++) {
  let x = Math.random() * (canvas.width - 20);
  let y = Math.random() * (canvas.height - 20);
  balls.push({
    x, y,
    vx: (Math.random()-0.5)*2,
    vy: (Math.random()-0.5)*2,
    r: 10
  });
}
let cueBall = {x: canvas.width/2, y: canvas.height - 50, vx: 0, vy: 0};

function draw() {
  ctx.clearRect(0,0,canvas.width,canvas.height);
  for (let b of balls) {
    let r = b.r;
    ctx.beginPath();
    ctx.arc(b.x, b.y, r, 0, Math.PI*2);
    ctx.fillStyle = 'black';
    ctx.fill();
    ctx.strokeStyle = 'black';
    ctx.lineWidth = 1;
    ctx.s …

Excerpt — the full answer is on the round page.

▶ R60 · Dijkstra vs A* on a weighted grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dijkstra & A* Comparison</title>
<style>
  canvas {
    border: 1px solid black;
  }
  #dijkstra-panel, #a-star-panel {
    float: left;
    width: 49%;
    height: 500px;
  }
  .visited {
    fill: blue;
  }
  .frontier {
    fill: yellow;
  }
</style>
</head>
<body>
<canvas id="grid" width="980"></canvas>
<script>
  const grid = document.getElementById('grid');
  const ctx1 = grid.getContext('2d');
  const ctx2 = grid.getContext('2d', {offsetWidth: 490, offsetHeight: 500});
  let gridData = [];
  for (let i = 0; i < 30; i++) {
    gridData.push([]);
    for (let j = 0; j < 20; j++) {
      gridData[i].push(Math.random());
    }
  }
  const dijkstraExpanded = (count) => document.getElementById('dijkstra-expanded').textContent = `Dijkstra Expanded: ${count}`;
  const aStarExpanded = (count) => document.getEleme …

Excerpt — the full answer is on the round page.

▶ R61 · Convex hull built step by step Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Convex Hull</title>
    <style>
        body {
            font-family: monospace;
        }
        #canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>

<script>
    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');

    function randomPoint() {
        return [Math.random() * 800, Math.random() * 600];
    }

    let points = Array(40).fill().map(randomPoint);

    function sortPoints(points) {
        return points.map((p, i) => ({ p, i })).sort((a, b) => a.p[0] - b.p[0]).map(({i}) => points[i]);
    }

    const sortedPoints = sortPoints(points);
    let index = 0;
    const hull = [];
    function …

Excerpt — the full answer is on the round page.

▶ R62 · Huffman tree from letter frequencies Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Huffman Code Animation</title>
<style>
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="canv" width="400" height="200"></canvas>
<script>
function Letter(f) { this.char = String.fromCharCode(Math.floor(Math.random() * 26 + 97)); this.freq = f; }
Letter.prototype.toString = function() {
  return `<${this.char} : ${this.freq} freq>`;
};
function Node(l, r) { this.left = l; this.right = r; this.freq = (l ? l.freq : 0) + (r ? r.freq : 0); }
Node.prototype.toString = function() {
  return `${(this.left ? this.left.toString() : '')}, ${(this.right ? this.right.toString() : '')}`;
};
function heapify(arr, i) { if (i > 0 && arr[Math.floor((i - 1) / 2)].freq > arr[i].freq) [arr[i], arr[Math.floor((i - 1) / 2)] = [arr[Math.flo …

Excerpt — the full answer is on the round page.

▶ R63 · Kruskal's MST with union-find Open round →
```html
<!DOCTYPE html>
<html>
<head>
  <title>Kruskal</title>
  <style>
    canvas {
      border: 1px solid black;
    }
  </style>
</head>
<body>
  <canvas id="c" width="800" height="600"></canvas>
  <script>
    const c = document.getElementById('c');
    const ctx = c.getContext('2d');
    const N = 25;

    let nodes = [], edges = [];
    for (let i = 0; i < N; i++) {
      nodes.push([Math.random() * c.width, Math.random() * c.height]);
    }

    for (let i = 0; i < N - 1; i++) {
      for (let j = i + 1; j < N; j++) {
        edges.push({a: i, b: j, w: Math.random()});
      }
    }

    function sortEdges() {
      edges.sort((a, b) => a.w - b.w);
    }

    let idx = 0;
    let component = new Array(N).fill(0);
    let unioned = new Array(N).fill(false);

    function draw() {
      ctx.clearRect(0, 0, c.width, c.height);
      for (let i = 0; i < N; i++) {
        if (!unione …

Excerpt — the full answer is on the round page.

▶ R64 · N-Queens solved by backtracking Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>8 Queens Backtracking</title>
<style>
body {
  font-family: monospace;
}
#board {
  border: 1px solid black;
}
canvas {
  border: 1px solid black;
}
#stats {
  position: absolute;
  top: 10px;
  left: 10px;
}
</style>
</head>
<body>
<canvas id="board" width="400" height="400"></canvas>
<div id="stats">Placements: 0, Backtracks: 0</div>

<script>
const board = document.getElementById('board');
const ctx = board.getContext('2d');
const stats = document.getElementById('stats');
let placements = 0;
let backtracks = 0;

function drawBoard() {
  const size = Math.min(board.width, board.height) / 8;
  ctx.clearRect(0, 0, board.width, board.height);
  for (let i = 0; i < 8; i++) {
    for (let j = 0; j < 8; j++) {
      const x = size * j + 1.5; …

Excerpt — the full answer is on the round page.

▶ R65 · Delaunay triangulation, triangle by triangle Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Delaunay Triangulation</title>
<style>
body { font-family: monospace; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id=c width=800 height=600></canvas>
<script>
let c = document.getElementById('c');
let ctx = c.getContext('2d');
let points = [];
let triangles = [];
let countPoints = 0;
let countTriangles = 0;

function randomPoint() {
 let x = Math.random()*800 | 0;
 let y = Math.random()*600 | 0;
 return [x, y];
}

function triangleContains(t, p) {
 let [a, b, c] = triangles[t];
 let [px, py] = points[p];
 let [ax, ay], [bx, by], [cx, cy];

 // triangle is ccw
 if ((by-ay)*(cx-cx)+(cx-ax)*(cy-by)-(cy-ay)*(cx-cx) > 0)
   return false;

 // barycentric
 let u = ((bx-cx)*(py-cy)+(by-cy)*(c-cy))/( (bx-cx)*(ay-cy)+(by-cy)*(ax-cx));
 if (u < 0 || u > 1) return false;
 let v = ((cx-ax)*(py-cy) …

Excerpt — the full answer is on the round page.

▶ R66 · AVL tree rebalancing with rotations Open round →
```html
<!DOCTYPE html>
<html>
<head>
  <title>AVL Tree Animation</title>
  <style>
    #tree {
      position: relative;
      border: 1px solid black;
    }
    .node {
      position: absolute;
      font-size: 12pt;
    }
    .label {
      position: absolute;
      font-size: 8pt;
      color: gray;
    }
  </style>
</head>
<body>
<div id="tree"></div>
<canvas id="canvas" width="800" height="600"></canvas>

<script>
  let tree = new AVL();
  let canvas = document.getElementById('canvas');
  let ctx = canvas.getContext('2d');
  let count = 0;
  let rotations = 0;

  function drawTree() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    tree.draw(ctx);
    requestAnimationFrame(drawTree);
  }

  function insert(key) {
    let newTree = tree.insert(key);
    if (newTree !== tree) {
      count++;
      rotations += tree.getBalanceFactor();
      drawTree();
      setTimeout(() …

Excerpt — the full answer is on the round page.

▶ R67 · Sieve of Eratosthenes on a number grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sieve of Eratosthenes</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="400" height="50"></canvas>
    <script>
        const canvas = document.getElementById('canvas');
        const ctx = canvas.getContext('2d');

        function randomInstance() {
            let instance = Array.apply(null, Array(401)).map(function () { return 1; });
            for (let i = 0; i <= Math.floor(Math.random()*200); i++) {
                instance[Math.floor(Math.random()*400)+2] = 0;
            }
            return instance;
        }

        let currentPrime = 2, primesCount = 0, eliminatedCells = 0;

        function draw(instance) {
            ct …

Excerpt — the full answer is on the round page.

▶ R68 · Edit-distance DP matrix with backtrace Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Levenshtein Animation</title>
<style>
body { margin: 10px; }
#canvas { border: 1px solid black; }
</style>
</head>
<body>
<script>
const canvas = document.createElement('canvas');
canvas.width = 400;
canvas.height = 200;
document.body.appendChild(canvas);

const ctx = canvas.getContext('2d');

function levenshtein(s, t) {
  const m = s.length + 1;
  const n = t.length + 1;
  const d = new Array(m).fill(0).map(() => new 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;

  for (let i = 1; i < m; i++) {
    for (let j = 1; j < n; j++) {
      const cost = s[i - 1] === t[j - 1] ? 0 : 1;
      d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
    }
  }

  return d[m - 1][n - 1];
}

function drawMatrix(s, t) {
  const m = s.length + 1;
  const n = t.length + 1;
  con …

Excerpt — the full answer is on the round page.

▶ R69 · Replanning when the map changes Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="300" height="200"></canvas>

<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
const w = 30;
const h = 20;
let g = Array(h).fill(null).map(() => Array(w).fill(0));
let r = {x: Math.floor(Math.random() * w), y: Math.floor(Math.random() * h)};
let p = [{x: r.x, y: r.y}];
let walls = [];
let steps = 0;
let replans = 0;

function drawMap() {
  ctx.clearRect(0, 0, c.width, c.height);
  for (let i = 0; i < w; i++) {
    for (let j = 0; j < h; j++) {
      if (g[j][i] === 1) {
        ctx.fillStyle = 'black';
        ctx.fillRect(i * 10, j * 10, 10, 10);
      }
      if (g[j][i] === 2) {
        ctx.fillStyle = 'red';
        ctx.fillRect(i * 10, j * 10, 10, 10);
      }
    }
  }
}

function shortestPath() {
  const openSet = [{x: r.x …

Excerpt — the full answer is on the round page.

▶ R70 · Binary search, step by step Open round →
```html
<!DOCTYPE html>
<html>
<head>
  <title>Binary Search Animation</title>
  <style>
    /* add some basic styling */
    body {
      background-color: #f0f0f0;
    }
    canvas {
      border: 1px solid black;
    }
  </style>
</head>
<body>
<canvas id="canvas" width="600" height="400"></canvas>

<script>
  var ctx = document.getElementById('canvas').getContext('2d');
  var array = Array.from({length:40}, (_, i) => Math.random() * (100 - 1) + 1);
  array.sort((a, b) => a-b);

  function draw(arr) {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.fillStyle = 'black';
    for(let i = 0; i < arr.length; i++) {
      const x = (canvas.width / arr.length) * i;
      ctx.fillRect(x, canvas.height - (arr[i] + 1), canvas.width/arr.length, 2);
      ctx.fillStyle = 'black';
      ctx.font = "12px Arial";
      ctx.textAlign = "center";
      ctx.textBaseline = "top";
      ctx …

Excerpt — the full answer is on the round page.

▶ R71 · Flood fill on a pixel grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flood Fill Animation</title>
</head>
<body>
    <canvas id="grid" width="600" height="400"></canvas>
    <script>
        const canvas = document.getElementById('grid');
        const ctx = canvas.getContext('2d');
        let grid = Array(40).fill().map(() => Array(60).fill(null));
        let frontier = [];
        let filled = 0;
        let step = 0;

        function drawGrid() {
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            for (let i = 0; i < grid.length; i++) {
                for (let j = 0; j < grid[0].length; j++) {
                    if (grid[i][j] !== null) {
                        ctx.fillStyle = grid[i][j];
                        ctx.fillRect(j * 10, i * 10, 10, 10); …

Excerpt — the full answer is on the round page.

▶ R72 · Maze generation by recursive backtracking Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Maze Generator</title>
<style>
body {
  margin: 0;
}
canvas {
  display: block;
}
#stats {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 12px;
  color: #fff;
}
</style>
</head>
<body>

<canvas id="maze"></canvas>
<div id="stats">carved: 0, depth: 0</div>

<script>
let canvas = document.getElementById('maze');
let ctx = canvas.getContext('2d');
canvas.width = 600;
canvas.height = 400;
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, canvas.width, canvas.height);

function random(x) {
  return Math.floor(Math.random() * x);
}

function recursiveBacktracker(w, h, x=0, y=0, depth=0) {
  let carved = document.getElementById('stats').children[0].textContent.split(', ')[0];
  let stackDepth = document.getElementById('stats').children[1].textContent;
  if (carved == w*h) return;
  
  ctx.fillStyle = '#000'; …

Excerpt — the full answer is on the round page.

▶ R73 · KMP string search with prefix table Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
  canvas { border: 1px solid black; }
</style>
</head>
<body>
<script>
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = 800;
canvas.height = 100;

var ctx = canvas.getContext('2d');

function drawText(text, x, y) {
  ctx.font = '24px Arial';
  ctx.textAlign = 'left';
  ctx.textBaseline = 'top';
  ctx.fillStyle = 'black';
  ctx.fillText(text, x, y);
}

function drawLine(x1, y1, x2, y2) {
  ctx.beginPath();
  ctx.moveTo(x1 + canvas.width / 2, y1);
  ctx.lineTo(x2 + canvas.width / 2, y2);
  ctx.stroke();
}

var pattern = 'abba';
var text = 'abcabbbdabbada';

function prefixFunction(pattern) {
  var p = new Array(pattern.length).fill(0);
  var i = 1;
  var j = 0;
  while (i < pattern.length) {
    if (pattern[i] == pattern[j]) {
      p[i++] = ++j;
    } else {
      if (j != 0)
        j = p[j - 1] …

Excerpt — the full answer is on the round page.

▶ R74 · Quadtree collision detection Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Quadtree Collision Detection</title>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="c" width="600" height="400"></canvas>
<script>
const c = document.getElementById("c");
const ctx = c.getContext("2d");

function Ball(x, y) {
  this.x = x;
  this.y = y;
  this.vx = Math.random() * 5 - 2.5;
  this.vy = Math.random() * 5 - 2.5;
}

function QuadTree(x, y, w, h) {
  this.x = x;
  this.y = y;
  this.w = w;
  this.h = h;
  this.balls = [];
  this.nodes = null;
}

QuadTree.prototype.insertBall = function(b) {
  if (b.x + b.vx > this.x && b.x + b.vx < this.x + this.w &&
      b.y + b.vy > this.y && b.y + b.vy < this.y + this.h)
    this.balls.push(b);
  else
    this.split();
};

QuadTree.prototype.split = function() {
  if (this.nodes == null) {
    const w2 = this.w / 2;
    const h2 = this.h / …

Excerpt — the full answer is on the round page.

▶ R75 · Falling sand on a cell grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Falling Sand</title>
<style>body { margin: 0; }</style>
</head>
<body>
<canvas id="canvas"></canvas>

<script>
const canvas = document.getElementById('canvas');
canvas.width = 150;
canvas.height = 100;

const ctx = canvas.getContext('2d');

let grid = new Array(150);
for (let i=0; i<150; i++) {
	grid[i] = new Array(100).fill(0);
}

function drawGrid() {
	ctx.fillStyle = 'black';
	for (let x=0; x<150; x++) {
		for (let y=0; y<100; y++) {
			if (grid[x][y] == 1) ctx.fillRect(x, y, 1, 1);
		}
	}
}

function updateGrid() {
	let resting = 0;
	for (let x=0; x<150; x++) {
		for (let y=0; y<100; y++) {
			if (grid[x][y] == 2) { // sand
				if (y < 99 && grid[x][y+1] != 1) grid[x][y+1] = 2;
				else if ((x > 0 && grid[x-1][y+1] != 1 && grid[x-1][y+1] != 2) || (x < 149 && grid[x+1][y+1] != 1 && grid[x+1][y+1] != 2)) { …

Excerpt — the full answer is on the round page.

▶ R76 · Falling sand as free particles Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Free-falling Sand Simulation</title>
<style>
body {
  margin: 0;
  background-color: #f2f2f2;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
function rand(x) { return Math.random() * x; }
var c = document.getElementById('c');
var ctx = c.getContext('2d');
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, 800, 600);
var numParticles = 1500;
var particles = [];
for (var i = 0; i < numParticles; i++) {
  particles.push({
    x: rand(800),
    y: rand(500),
    vx: Math.random() * 2 - 1,
    vy: Math.random() * 2.5
  });
}
var time = 0;
function draw() {
  ctx.clearRect(0, 0, 800, 600);
  for (var i = 0; i < numParticles; i++) {
    var p = particles[i];
    if (p.vy > -0.1) { …

Excerpt — the full answer is on the round page.

▶ R77 · Crowd leaving a room, cell by cell Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cell Exit</title>
<style>
body { margin: 0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="c" width="400" height="300"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let grid, exit, people;
function randomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
function getDistance(x0, y0, x1, y1) {
  const dx = Math.abs(x1-x0);
  const dy = Math.abs(y1-y0);
  if (dx > dy) return { d: dx, u: [x1 - x0 < 0 ? -1 : 1, 0] };
  else return { d: dy, u: [0, y1 - y0 < 0 ? -1 : 1] };
}
function draw(x, y) {
  ctx.fillStyle = 'black';
  ctx.fillRect(x*10, y*10, 10, 10);
}
function step() {
  const nleft = people.filter(p => p.x == exit[0]).length;
  if (nleft > 0 …

Excerpt — the full answer is on the round page.

▶ R78 · Crowd leaving a room by steering Open round →
```html
<!DOCTYPE html>
<html>
<head>
<script>
  const canvas = document.createElement('canvas');
  document.body.appendChild(canvas);
  const ctx = canvas.getContext('2d');

  canvas.width = window.innerWidth;
  canvas.height = window.innerHeight;

  let people = [];
  for (let i=0; i<60; i++) {
    people.push({
      x: Math.random() * canvas.width,
      y: Math.random() * canvas.height,
      vx: Math.random() * 2 - 1,
      vy: Math.random() * 2 - 1
    });
  }

  function update() {
    for (let p of people) {
      if (p.y > canvas.height) return;
      let dx = ctx.canvas.width / 2 - p.x;
      let dy = ctx.canvas.height / 3.5 - p.y;
      let dist = Math.sqrt(dx * dx + dy * dy);
      if (dist < 20) {
        p.vx += dx / dist * 0.1;
        p.vy += dy / dist * 0.1;
      }
      for (let q of people) {
        if (p !== q && dist = 10) {
          let nx, ny;
          if (q.x …

Excerpt — the full answer is on the round page.

▶ R79 · Aggregation on a lattice Open round →
```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>DLA Simulation</title>
</head>
<body>
  <canvas id="canvas" width="200" height="150"></canvas>
  <script>
    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');

    let grid = new Array(200);
    for (let i = 0; i < 200; i++) {
      grid[i] = new Array(150).fill(false);
    }

    let walkers = [];
    let clusterRadius = 0;
    let frozenCells = 0;

    const xCenter = Math.floor(grid.length / 2);
    const yCenter = Math.floor(grid[0].length / 2);
    grid[xCenter][yCenter] = true;

    function randomDir() {
      return Math.random() < 0.25 ? -1 : (Math.random() < 0.5 ? 0 : 1);
    }

    function stepWalker(walker) {
      const newX = walker[0] + randomDir();
      const newY = walker[1] + randomDir();

      if (newX >= 0 && newX < grid.length && newY >= 0 && newY < gr …

Excerpt — the full answer is on the round page.

▶ R80 · Aggregation by continuous driftDNF Open round →
No usable answer reached the harness in this round.
▶ R81 · Flocking birds with three rulesDNF Open round →
No usable answer reached the harness in this round.
▶ R82 · Conway's Game of Life with seeded patterns Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
  body { margin: 0; }
  #canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="canvas" width="1200" height="800"></canvas>
<script>
  const canvas = document.getElementById('canvas');
  const ctx = canvas.getContext('2d');

  function random(x) {
    return Math.floor(Math.random() * x);
  }

  function rand() {
    return random(256);
  }

  let grid = [];
  for (let i=0; i<80; i++) {
    let row = [];
    for (let j=0; j<120; j++) {
      if (i == 15 && j < [10,30,50][random(3)]) { // glider
        row.push(1);
      } else if (j == 60) { // oscillator: blinker
        row.push(i%4==0 ? 0 : (i==14 || i==16 ? 1 : 0));
      } else {
        row.push(rand() < 100 ? 1 : 0);
      }
    }
    grid.push(row);
  }

  let generations = 0;
  let liveCount = 0;

  function countLiveCells(grid) {
    return grid.reduce((count, row) …

Excerpt — the full answer is on the round page.

▶ R83 · Fourier epicycles tracing a shape Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Fourier Epicycles</title>
<style>
body {
  margin: 0;
  padding: 0;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="400" height="300"></canvas>
<script>
var c = document.getElementById('c');
var ctx = c.getContext('2d');
var w = c.width, h = c.height;
var r = 50;
var cx = w / 2, cy = h / 2;
var n = 4; // number of epicycles
var t = 0;

// target shape's Fourier coefficients (example: a circle)
var A = [1];
var B = [];
for (var i = 1; i <= n; i++) {
  var C = Math.cos(2 * i * Math.PI / w);
  var S = Math.sin(2 * i * Math.PI / w);
  B.push(C, S);
}
var A0 = 350, A1 = -150, A2 = 250;

function drawEpi() {
  ctx.clearRect(0, 0, w, h);

  for (var i = 0; i < n + 1; i++) {
    var a = A[i];
    var b = B[2 * i], c = B[2 * i + 1];
    var x = r * a * Math.cos(t) - r * B[2 * i] * Math.sin(t);
    var y = r * a * M …

Excerpt — the full answer is on the round page.

▶ R84 · Voronoi cells with moving seeds Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Voronoi Diagram</title>
<style>
body {
  margin: 0;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
const w = 600, h = 600;

function randomPoint() {
  return { x: Math.random() * w, y: Math.random() * h };
}

function distance(p1, p2) {
  const dx = p1.x - p2.x;
  const dy = p1.y - p2.y;
  return Math.sqrt(dx * dx + dy * dy);
}

let points = Array(25).fill().map(randomPoint);

function draw() {
  ctx.clearRect(0, 0, w, h);
  for (const point of points) {
    ctx.fillStyle = 'blue';
    ctx.beginPath();
    ctx.arc(point.x, point.y, 5, 0, Math.PI * 2);
    ctx.fill();
  }
  const voronoi = Array(w).fill(0).map(() => ({ x: …

Excerpt — the full answer is on the round page.

▶ R85 · Travelling salesman improved by 2-opt Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Travelling Salesman Tour</title>
    <style>
        body {
            margin: 0;
            background-color: #f0f0f0;
        }
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<script>
    const cities = [];
    for (let i = 0; i < 60; i++) {
        cities.push({x: Math.random() * 800, y: Math.random() * 600});
    }

    let tour = [...cities.keys()];
    let shortestTour = [...tour];
    let improvementsCount = 0;
    const canvas = document.createElement('canvas');
    document.body.appendChild(canvas);
    canvas.width = 800;
    canvas.height = 600;

    const ctx = canvas.getContext('2d');

    function nearestNeighbour() {
        tour = [0];
        for (let i = 1; i < citi …

Excerpt — the full answer is on the round page.

▶ R86 · Scrolling terrain from value noise Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Noise Landscape Scroller</title>
<style>
body {
  margin: 0;
  padding: 0;
}
canvas {
  display: block;
}
</style>
<script type="text/javascript">
var octaves = 3;
var amplitude = 1.5;
var frequency = 0.05;
var offset = 0;
var canvas = document.createElement("canvas");
document.body.appendChild(canvas);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var ctx = canvas.getContext('2d');
function generateNoise(x, y) {
  var value = 0;
  for (var i = 0; i < octaves; i++) {
    value += Math.sin((x * frequency + offset) * amplitude) *
             Math.sin(y * 10 * amplitude);
    frequency *= 1.5;
    amplitude /= 2;
  }
  return value;
}
function draw() {
  ctx.fillStyle = "rgba(0, 0, 0, 0)";
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  for (var x = -100; x <= 100; x++) {
    for (var …

Excerpt — the full answer is on the round page.

▶ R87 · Gray-Scott reaction-diffusion Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gray-Scott Simulation</title>
<style>
  body {
    margin: 0;
    background-color: #f0f0f0;
  }
  canvas {
    border: 1px solid black;
  }
</style>
</head>
<body>

<script>
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = 800;
canvas.height = 800;

var ctx = canvas.getContext('2d');

var stepCount = 0;
var imageData = new Uint8ClampedArray(120 * 120 * 4);

for (var i = 0; i < 120 * 120; i++) {
  var x = Math.floor(i / 120) % 120;
  var y = Math.floor(i / 120);
  imageData[i * 4 + 3] = 255;
  if (Math.random() > 0.1) {
    imageData[i * 4] = 5;
    imageData[i * 4 + 1] = 10;
  }
}

function grayScott(u, v, d, f, k) {
  var du = u;
  var dv = v;
  for (var i = 0; i < 120; i++) {
    for (var j = 0; j < 120; j++) {
      var x = i * 120 + j;
      var a = imageData …

Excerpt — the full answer is on the round page.

▶ R88 · L-system tree growing in wind Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Fractal Tree</title></head>
<body>
<canvas id="c" width=600 height=400></canvas>
<script>
let c = document.getElementById('c');
let ctx = c.getContext('2d');
ctx.font='10px Arial';
document.body.onload=start;
var wind = 0; var windmax = 3; var windinc = 1;
function start() {
  let r = Math.random()*Math.PI*2; let x = 300; let y = 200;
  ctx.moveTo(x,y);
  drawTree(r,x,y,200,100,10,6,0.5,.9,'F','X');
  requestAnimationFrame(drawWind);
}
function drawTree(a,x,y,l,w,a1,i,fac,scale,p,c) {
  if (i==0) return;
  ctx.beginPath();
  let nx = x + l * Math.cos(a), ny = y - l * Math.sin(a);
  ctx.lineTo(nx,ny);
  a += a1; let nl = l * fac;
  ctx.strokeStyle='#' + c[0].toString(16).padStart(2,'0') +
                  c[1].toString(16).padStart(2,'0') +
                  c[2].toString(16).padStart(2,'0');
  ctx.lineWidth=w*(i/10);
  ctx.stroke();
  ctx.stro …

Excerpt — the full answer is on the round page.

▶ R89 · Marching squares on a moving field Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Metaball Contour Lines</title>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="c" width="600" height="400"></canvas>

<script>
let c = document.getElementById('c');
let ctx = c.getContext('2d');
ctx.imageSmoothingEnabled = false;
ctx.mozImageSmoothingEnabled = false;
ctx.webkitImageSmoothingEnabled = false;

function random(x) {
  return Math.floor(Math.random() * x);
}

function sign(a, b) { return a > b ? 1 : -1; }

let metaballs = [];
for (let i=0; i<50; ++i)
  metaballs.push({
    x:random(300)+c.width/2,
    y:random(200)+c.height/2,
    r:random(10)+5
  });

function getScalar(x, y) {
  let s = 0;
  for (let b of metaballs) {
    let d = Math.sqrt((x-b.x)**2 + (y-b.y)**2);
    if (d < b.r)
      s += (b.r-d)/b.r;
  }
  return s;
}

function draw() {
  ctx.clearRect(0,0,c.wi …

Excerpt — the full answer is on the round page.

▶ R90 · Poisson-disk sampling, Bridson's algorithm Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body { margin: 0; padding: 0; overflow: hidden; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const c = document.getElementById('c');
let ctx = c.getContext('2d');
ctx.translate(400, 300);
ctx.scale(20, 20);

const n = Math.floor(Math.sqrt(c.width / 20) * Math.sqrt(c.height / 20));
ctx.fillStyle = 'lightgray';
for (let i = -n; i <= n; ++i) {
  for (let j = -n; j <= n; ++j) {
    if (Math.abs(i) + Math.abs(j) <= n) {
      ctx.fillRect(i, j, 1, 1);
    }
  }
}

const r0 = 20;
const r1 = 50;
const points = [];
let active = [ {x: -n, y: -n} ];
let i = 0;

function animate() {
  if (active.length) {
    const p = active.shift();
    for (let j = 0; j < Math.PI * 2; ++j) {
      const a = j / 32;
      const x = r1 + r0 * Math.cos(a);
      const y = r1 + r0 * Math.sin(a); …

Excerpt — the full answer is on the round page.

▶ R91 · Starfield tunnel in perspective Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
  body {
    margin: 0;
    overflow: hidden;
    background-color: #000;
  }
</style>
</head>
<body>
<canvas id="c" width=800 height=600></canvas>
<script>
var ctx = document.getElementById('c').getContext2D();
ctx.lineWidth = 1.5;

var stars = [], starcount = 0, speed = 100, viewdist = 300;
function randompos() {
  return {x: Math.random()*800*3-400, y: Math.random()*600*3-300};
}
function drawstars() {
  ctx.fillStyle = '#fff';
  for(var i=0; i<stars.length; i++) {
    var s = stars[i];
    if(s.x<-viewdist) {s.x+=2000; starcount--; }
    else {ctx.beginPath(); ctx.arc(-s.x/viewdist*800, -s.y/viewdist*600, Math.max(1, viewdist-s.x)/viewdist*10, 0, Math.PI*2); ctx.fill();}
  }
}
function reset() {
  stars = [], starcount=0;
  for(var i=0; i<200; i++) {stars.push(randompos());};
  requestAnimationFrame(draw);
}

requestAnimationFrame(functio …

Excerpt — the full answer is on the round page.

▶ R92 · Rotating wireframe solids with depth sorting Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Rotating Solids</title>
<style>
canvas {
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="600" height="400"></canvas>

<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');

// Cube
function cubeVertices() {
return [[-1, -1], [1, -1], [1, 1], [-1, 1],
[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]];
}

// Cube edges
function cubeEdges() {
return [[0, 1], [1, 2], [2, 3], [3, 0],
[4, 5], [5, 6], [6, 7], [7, 4],
[0, 4], [1, 5], [2, 6], [3, 7]];
}

// Cube faces
function cubeFaces() {
return [[0, 1, 2, 3], [4, 5, 6, 7],
[0, 1, 5, 4], [1, 2, 6, 5],
[2, 3, 7, 6], [3, 0, 4, 7]];
}

// Tetrahedron
function tetVertices() {
return [[-1.5, -1.5, -1.5], [-1.5, 1.5, -1.5],
[1.5, 1.5, -1.5], [0, 0, 4]];
}

// Tetrahedron edges
function tetEdges() {
return [[0, 1], [1, 2], [2, 3], [3, 0]];
}

let cube = …

Excerpt — the full answer is on the round page.

▶ R93 · Rotating wireframe height field Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>3D Height Field</title>
<style>
body { background-color: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>

<body onload='start();'>
<canvas id='c' width='600' height='400'></canvas>
<script>
var c = document.getElementById('c');
var ctx = c.getContext('2d');

var w = c.width;
var h = c.height;

var g = 24; // grid size
var rot = 0; // rotation angle

function s(x, y) {
	var r = Math.pow(Math.sin(y), 3)*Math.cos(Math.sin(x));
	return r*(w/2)+w/2;
}

function d() {
	ctx.clearRect(0, 0, w, h);

	// Draw grid
	for (var i=0; i<g; i++) {
		var y = Math.floor(h/g*i);
		ctx.beginPath();
		ctx.moveTo(s(i*3.14159/g, 1+rot), y);
		for (var j=1; j<=g; j++)
			ctx.lineTo(s(j*3.14159/g+rot, 1+i), h-j*y/g);
		ctx.stroke();

		var x = Math.floor(w/g*i);
		ctx.beginPath();
		ctx.moveTo(x, s(1+i, rot));
		for (var j=0; j<=g …

Excerpt — the full answer is on the round page.

▶ R94 · Raycast maze walkthrough Open round →
```html
<!DOCTYPE html>
<html>
<head>
	<title>Raycasting Maze</title>
	<style>
		body {
			margin: 0;
			background-color: #f0f0f0;
		}
		#maze-container {
			width: 800px;
			height: 600px;
			border: 1px solid black;
		}
	</style>
</head>
<body>
	<canvas id="maze" width="800" height="600"></canvas>
	<div id="stats">
		X: <span id="x">0</span> Y: <span id="y">0</span> Heading: <span id="heading">90</span>
	</div>

	<script>
		const canvas = document.getElementById('maze');
		const ctx = canvas.getContext('2d');
		const stats = document.getElementById('stats');
		let x = 50, y = 50;
		let heading = Math.PI / 4;

		function randomInt(min, max) {
			return min + Math.floor(Math.random() * (max - min + 1));
		}

		function wall(x, y) {
			return function() {
				ctx.fillStyle = '#000';
				ctx.fillRect(x, y, 2, 20);
				return true;
			};
		}

		const walls = [
			wall(100, 50),
			wall(200 …

Excerpt — the full answer is on the round page.

▶ R95 · Shaded sphere by painter's algorithm Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body { margin: 0; }
canvas { border: 1px solid black; width: 600px; height: 400px; }
</style>
</head>
<body>
<script>
function rand() {
  return Math.random()*2-1;
}
let s = 100, w=300, h=200,
    ctx = document.getElementById('c').getContext('2d'),
    points = [], cnt=0;

function makePoints(n) {
  for(let i=0;i<n;i++) {
    var x,y,z,d;
    do {x=w*rand();y=h*rand();z=s*rand(); d=x*x+y*y+z*z}
    while(d>1);
    points.push([x+Math.cos(Math.acos(z/s))*w/2, y+Math.sin(Math.acos(z/s))*h/2]);
  }
}

function rotatePoints() {
  for(let i=0;i<points.length;i++) {
    var x=points[i][0],y=points[i][1];
    points[i] = [x*Math.cos(t)+y*Math.sin(t), -x*Math.sin(t)+y*Math.cos(t)];
  }
}

function sortPoints() {
  for (let i = 0; i < points.length; i++) {
    var min = i;
    for (let j = i + 1; j < points.length; j++) {
      if (points[j][1] < poi …

Excerpt — the full answer is on the round page.

▶ R96 · Force-directed graph settling Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
  font-family: monospace;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<script id="nodes" type="text/template">
<% for (var i = 0; i < nodes.length; i++) { %>
  <div id="node_<%= i %>">Node <%= i + 1 %></div>
<% } %>
</script>
<script>
let nodes = [];
for(let i=0;i<25;i++){
  let x=Math.random()*500,
    y=Math.random()*300;
  nodes.push({x:x,y:y});
}
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');

canvas.width = 600;
canvas.height = 400;

let edges = [];
for(let i=0;i<nodes.length;i++){
  for(let j=i+1;j<nodes.length;j++){
    let x1 = nodes[i].x,
      y1 = nodes[i].y;
    let x2 = nodes[j].x,
      y2 = nodes[j].y;
    edges.push({from:i,to:j,x1:x1,y1:y1,x2:x2,y2:y2});
  }
}

let simulation = {
  repulsion: (n1,n2)=>{
    let dx=n1.x-n2.x,dy …

Excerpt — the full answer is on the round page.

▶ R97 · Circle packing without overlap Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Circles Packing</title>
<style>
body {
  margin: 0;
}
canvas {
  border: solid black 1px;
}
</style>
<script>
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');

let w, h, r, circles = [], count = 0, area = 0;
let running = true;

function init() {
  w = canvas.width = window.innerWidth;
  h = canvas.height = window.innerHeight;
  ctx.lineWidth = 1;
  ctx.lineCap = 'round';
  ctx.strokeStyle = 'black';

  for (let i = 0; i < w * h / 1000; i++) {
    let x, y, r = Math.random() * 20 + 10;
    do {
      x = Math.floor(Math.random() * w);
      y = Math.floor(Math.random() * h);
    } while (closeEnough(x, y));
    circleAt(x, y, r);
  }
}

function closeEnough(x0, y0) {
  for (let i = 0; i < circles.length; i++) {
    let x1 = circles[i].x + circles[i]. …

Excerpt — the full answer is on the round page.

▶ R98 · Squarified treemap of changing data Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<script>
let canvas = document.createElement('canvas');
document.body.appendChild(canvas);
let ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

let items = Array(20).fill().map(() => ({ name: Math.random().toString(36), weight: Math.random() }));
let sizes = items.map(() => [0, 0]);
let positions = items.map(() => [Math.random() * canvas.width, Math.random() * canvas.height]);

function anim(timestamp) {
  requestAnimationFrame(anim);
  ctx.clearRect(0, 0, canvas.width, canvas.height);

  let totalWeight = items.reduce((a, b) => a + b.weight, 0);
  let itemWidth = canvas.width / (totalWeight ** 0.5);
  let itemHeight = canvas.height / (totalWeight ** 0.5);

  for (let i = 0; i < items.length; ++i) {
    let w = sizes[i][0];
    l …

Excerpt — the full answer is on the round page.

▶ R99 · Three sorting algorithms racing Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting Algorithms Comparison</title>
<style>
body { font-family: monospace; }
canvas { border: 1px solid black; }
</style>
<script>
let canvas = document.createElement('canvas'), ctx = canvas.getContext('2d');
document.body.appendChild(canvas);
canvas.width = 800;
canvas.height = 600;

function shuffle(arr) {
  for (let i = arr.length - 1; i > 0; i--) {
    let j = Math.floor(Math.random() * (i + 1));
    [arr[i], arr[j]] = [arr[j], arr[i]];
  }
}

let data = new Array(60).fill(0).map(() => Math.floor(Math.random() * 200)), bubble, insert, quick;

function draw(algos) {
  for (let i in algos) ctx.clearRect(0, 0, canvas.width, canvas.height);
  let barWidth = canvas.width / data.length;
  for (let i = 0; i < data.length; i++) {
    let x = i * barWidth;
    if (algorithms[i] === 'bubble') ctx.fillStyle = bubble …

Excerpt — the full answer is on the round page.

▶ R100 · Sankey flow with travelling particles Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Sankey Diagram</title>
<style>
body { font-family: monospace; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="diagram" width=600 height=400></canvas>
<script>
const canvas = document.getElementById('diagram');
const ctx = canvas.getContext('2d');

let sources, targets;
let flows = [
  [20, 'A', 0.5],
  [40, 'B', 0.6],
  [60, 'C', 0.7]
];
let bands = [];
let totalFlow = 0;

function init() {
  sources = {};
  targets = {};

  for (let i = 0; i < flows.length; ++i) {
    const [flow, source, target] = flows[i];

    if (!sources[source]) sources[source] = { x: Math.random() * 100 };
    if (!targets[target]) targets[target] = { x: Math.random() * (canvas.width - 100) };

    totalFlow += flow;
    bands.push({
      from: source,
      to: target,
      flow,
      y1: sources[source]. …

Excerpt — the full answer is on the round page.

▶ R101 · Langton's ant building a highway Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Langton's Ant</title>
<style>
body { margin: 0; }
#canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

let grid = new Array(400).fill(null);
for (let i = 0; i < 400; i++) {
	grid[i] = new Array(400).fill(false);
}
grid[199][199] = true;

let antX = 199;
let antY = 199;
let antDir = 0; // 0: North, 1: East, 2: South, 3: West
let stepCount = 0;

function drawGrid() {
	ctx.fillStyle = 'white';
	for (let i = 0; i < grid.length; i++) {
		for (let j = 0; j < grid[i].length; j++) {
			if (grid[i][j]) ctx.fillRect(j, i, 1, 1);
		}
	}
	ctx.fillStyle = 'red';
	ctx.fillRect(antX, antY, 1, 1);
	ctx.font = "12px Arial";
	ctx.fillStyle = 'black';
	ctx.textAlign = 'lef …

Excerpt — the full answer is on the round page.

▶ R102 · Rule 110 growing line by line Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body { margin: 0; overflow: hidden; }
#canvas { border: none; }
</style>
</head>
<body>
<canvas id="c" width=300 height=200></canvas>
<script>
var c = document.getElementById('c');
var ctx = c.getContext('2d');
var r = 10, w = 8;
function draw() {
  ctx.clearRect(0,0,c.width,c.height);
  var s = new Array(c.height-1).fill(0);
  for (var i=0; i<=c.height-2; i++) {
    var t = new Array(c.width);
    for (var j=c.width-1;j>=0;j--) {
      if (i==0) {
        t[j] = document.random();
      } else {
        var p = s[j];
        var q = s[j+1] || 0;
        if (j==c.width-1 && !q) q=0; // edge case
        t[j] = r110(p,q);
      }
    }
    s=i;
    for (var j=c.width-1;j>=0;j--) {
      ctx.fillStyle = t[j]? 'black' : 'white';
      ctx.fillRect(j*r,i*r,(r+1)*w,r*w);
    }
  }
  var row = Math.floor(s/c.height*100) + '%';
  ctx.font = '16px sa …

Excerpt — the full answer is on the round page.

▶ R103 · Wireworld with a clock and a diode Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wireworld Sim</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<canvas id="c" width="400" height="400"></canvas>

<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');

let grid = Array(200).fill(0).map(() => Array(200).fill(0));
let step = 0;
let electrons = 1;

function draw() {
    ctx.fillStyle = 'white';
    ctx.fillRect(0, 0, c.width, c.height);
    for (let y = 0; y < grid.length; y++) {
        for (let x = 0; x < grid[y].length; x++) {
            switch(grid[y][x]) {
                case 1:
                    ctx.fillStyle = 'red';
                    break;
                case 2:
                    ctx.fillStyle = 'blue'; …

Excerpt — the full answer is on the round page.

▶ R104 · Abelian sandpile toppling Open round →
```html
<!DOCTYPE html>
<html>
<head>
    <title>Abelian Sandpiles</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<script>
const WIDTH = 400;
const HEIGHT = 400;
let grains = Array.from({length: HEIGHT}, () => new Array(WIDTH).fill(0));
let topplings = 0;
let drops = 0;
let animationRunning = true;

function draw() {
    const ctx = canvas.getContext('2d');
    for (let y = 0; y < HEIGHT; y++) {
        for (let x = 0; x < WIDTH; x++) {
            if (grains[y][x] === 4) {
                topple(x, y);
            }
            const color = grains[y][x] % 10;
            ctx.fillStyle = `rgb(${color * 32}, ${color * 64}, ${color * 128})`;
            ctx.fillRect(x, y, 1, 1);
        }
    }
    canvas.height = HEIGHT;
}

function topple(x, y) {
    topplings++;
    if (x > 0 && grains[y][x - 1] < 3) grains[y][x - 1]++; …

Excerpt — the full answer is on the round page.

▶ R105 · Brian's Brain Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
  body { margin:0; }
  #container {
    width:100%;
    height:100vh;
    display:flex;
    flex-direction:column;
  }
  canvas {
    border:1px solid black;
  }
</style>
</head>
<body>
<div id="container">
<canvas id="c" width="120" height="120"></canvas>
<script>
var c = document.getElementById("c");
var ctx = c.getContext('2d');
var grid = [];
var buffer = Array(120*120).fill(false);
for (var i=0; i<120*120; ++i) {
  var x = Math.floor(i/120);
  var y = i%120;
  if (Math.random()>0.5) { grid.push([x,y,true]); }
}
c.width=c.height=120;

function draw() {
  ctx.fillStyle="black";
  ctx.fillRect(0,0,c.width,c.height);

  for (var i=0; i<grid.length; ++i) {
    var x = grid[i][0];
    var y = grid[i][1];
    if (buffer[y*120+x]) { ctx.fillStyle="#00ff00"; }
    else if (!grid[i][2]) { ctx.fillStyle="#0000ff"; }
    else { ctx.fillStyle="#ff000 …

Excerpt — the full answer is on the round page.

▶ R106 · Truchet tiles rearranging Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Truchet tiles animation</title>
<style>
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}
#canvas {
  width: 100%;
  height: 100vh;
  display: block;
}
</style>
<script>
let gridsize = 20;
let flippedcount = 0;
let canvas, ctx;

function truchet(x, y) {
  let x1 = x * 30 + 15;
  let y1 = y * 30 + 15;
  let x2 = (x+1) * 30 - 15;
  let y2 = y * 30 + 15;
  ctx.beginPath();
  ctx.arc(x1, y1, 14.5, Math.PI/4, 3*Math.PI/4);
  ctx.arc(x2, y2, 14.5, 7*Math.PI/4, 11*Math.PI/4);
  ctx.fillStyle = 'white';
  ctx.fill();
}

function truchetflip(x, y) {
  let x1 = (x+1) * 30 - 15;
  let y1 = y * 30 + 15;
  let x2 = x * 30 + 15;
  let y2 = (y+1) * 30 - 15;
  ctx.beginPath();
  ctx.arc(x1, y1, 14.5, Math.PI/4, 3*Math.PI/4);
  ctx.arc(x2, y2, 14.5, 7*Math.PI/4, 11*Math.PI/4);
  ctx.fillStyle = 'white';
  ctx.fill();
}

f …

Excerpt — the full answer is on the round page.

▶ R107 · Hilbert curve drawing itselfDNF Open round →
No usable answer reached the harness in this round.
▶ R108 · Interlocking star pattern on a grid Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Islamic Star Pattern</title>
<style>
body {
  margin: 0;
  background-color: #f2f2f2;
}
canvas {
  border: none;
  display: block;
  margin: 20px auto;
}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const gridSize = 10;
const strokes = [];
let angle = Math.PI / 180 * -5;

function randomSign() {
  return Math.random() < 0.5 ? -1 : 1;
}

function drawStar(x, y, size, rotation) {
  ctx.beginPath();
  for (let i = 0; i < 6; ++i) {
    const a = i * Math.PI / 3 + rotation;
    ctx.lineTo(x + size * Math.cos(a), y + size * Math.sin(a));
  }
  ctx.closePath();
}

function drawPolygon(x, y, numSides, size, rotation) {
  ctx.beginPath();
  for (let i = 0; i < numSides; ++i) {
    const a = i * 2 * Mat …

Excerpt — the full answer is on the round page.

▶ R109 · Moire from two rotating rasters Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
  margin: 0;
  overflow: hidden;
}
</style>
</head>
<body>
<canvas id="c" width="400" height="400"></canvas>
<script>
let c = document.getElementById("c");
let ctx = c.getContext("2d");
c.width = 400;
c.height = 400;

function draw(r, x, y) {
  for (let i = -r; i <= r; ++i)
    for (let j = -r; j <= r; ++j)
      let d = Math.sqrt(i * i + j * j);
      ctx.fillStyle = d < r ? "black" : "white";
      ctx.fillRect(x + i, y + j, 1, 1);
}

function drawMoire() {
  c.width = c.width;
  ctx.clearRect(0, 0, c.width, c.height);
  let r = 100;
  for (let i = -r; i <= r; ++i)
    for (let j = -r; j <= r; ++j) {
      let d = Math.sqrt(i * i + j * j);
      ctx.fillStyle = d < r ? "black" : "white";
      if (d > 0 && d < r && Math.random() > 0.5)
        ctx.fillRect(200 + i, 200 + j, 1, 1);
    }
}

function drawMoireAnimated(timestamp) {
  le …

Excerpt — the full answer is on the round page.

▶ R110 · Penrose-style aperiodic tiling growing Open round →
```html
<!DOCTYPE html>
<html>
<head>
  <title>Aperiodic Rhombus Tiling</title>
  <style>
    /* Add some basic styling to make the page look nice */
    body {
      margin: 0;
      padding: 0;
    }
    #canvas {
      border: 1px solid black;
    }
  </style>
</head>
<body>
  <script>
    // Get the canvas element
    const canvas = document.createElement('canvas');
    document.body.appendChild(canvas);
    
    let generation = 0;
    let tileCount = 4;
    
    // Function to draw a rhombus on the canvas
    function drawRhombus(x, y, w, h, thick) {
      const ctx = canvas.getContext('2d');
      const rads = Math.PI / 180 * 30; // convert degrees to radians
      let s;
      if (thick) {
        s = 4;
      } else {
        s = 1;
      }
      ctx.beginPath();
      ctx.moveTo(x + w/2, y);
      ctx.lineTo(x + w/2 - s*w, y + h);
      ctx.lineTo(x + w/2, y + h*2);
      ctx.l …

Excerpt — the full answer is on the round page.

▶ R111 · Ant colony laying pheromone trails Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ant Colony Simulation</title>
<style>
canvas {
  border: 1px solid black;
}
.ant {
  position: absolute;
  width: 2px;
  height: 10px;
  background-color: red;
}
.pheromone {
  position: absolute;
  background-color: lightblue;
}
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');

let nest = { x: 400, y: 50 };
let food = { x: Math.random() * 700 + 100, y: Math.random() * 500 + 150 };
let pheromone = [];
for (let i = 0; i < 200; i++) {
  let p = { x: Math.random() * 800, y: Math.random() * 600, amount: Math.random() / 100};
  pheromone.push(p);
}
let ants = [
  {
    x: nest.x,
    y: nest.y,
    dx: Math.random() * 2 - 1,
    dy: Math.random() * 2 - 1,
    speed: 0.5
  }
];

function draw() {
  c.width = c.of …

Excerpt — the full answer is on the round page.

▶ R112 · Physarum slime-mould network Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Physarum Agent Simulation</title>
<style>
body, canvas { margin: 0; padding: 0; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
var c = document.getElementById('c');
var ctx = c.getContext('2d');

var p, t;
for (var i=0; i<10000; i++) {
  var x = Math.floor(Math.random()*c.width);
  var y = Math.floor(Math.random()*c.height);
  p.push({x: x, y: y, dx: 0, dy: 0});
}

function draw() {
  ctx.fillStyle = 'rgba(255,255,255,.1)';
  ctx.fillRect(0, 0, c.width, c.height);
  for (var i=t.length-1; i>=0; i--) {
    var x = t[i][0];
    var y = t[i][1];
    ctx.fillStyle = 'rgba(0,0,255,.5)';
    ctx.fillRect(x, y, 2, 2);
  }
}

function step() {
  for (var i=p.length-1; i>=0; i--) {
    var x = p[i].x;
    var y = p[i].y;
    var tl = t[y][x-1];
    var tm = t[y][x];
    var tr = t[y][x+1]; …

Excerpt — the full answer is on the round page.

▶ R113 · Predator and prey on a shared field Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Predator Prey Simulation</title>
<style>
body {
  background-color: #f2f2f2;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let w = canvas.width;
let h = canvas.height;
let food = [];
for (let i = 0; i < 100; i++) {
  food.push({x: Math.random() * w, y: Math.random() * h});
}
let prey = [{x: Math.random() * w, y: Math.random() * h}];
let predators = [{x: Math.random() * w, y: Math.random() * h}];
function drawFood() {
  ctx.fillStyle = 'green';
  ctx.beginPath();
  for (const f of food) {
    ctx.arc(f.x, f.y, 2, 0, 2 * Math.PI);
  }
  ctx.fill();
}
function drawPrey() {
  ctx …

Excerpt — the full answer is on the round page.

▶ R114 · Traffic jam from nothingDNF Open round →
No usable answer reached the harness in this round.
▶ R115 · Crowd leaving through a bottleneck Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Crowd Simulation</title>
<style>
body {
  margin: 0;
  background-color: #f2f2f2;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="crowd" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('crowd');
const ctx = canvas.getContext('2d');

let people = [];
for (let x = 0; x < canvas.width; x += Math.random() * 10 + 1) {
  for (let y = 0; y < canvas.height; y += Math.random() * 10 + 1) {
    people.push({
      x: x,
      y: y,
      vx: Math.cos(Math.PI * 2 * Math.random()) * 1.5,
      vy: Math.sin(Math.PI * 2 * Math.random()) * 1.5
    });
  }
}

const exit = {x: canvas.width - 20, y: canvas.height / 2};
const doorWidth = 10;

function draw() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  for (let i = people.length - 1; i >= 0; i--) {
    const …

Excerpt — the full answer is on the round page.

▶ R116 · Bresenham circles and lines, pixel by pixelDNF Open round →
No usable answer reached the harness in this round.
▶ R117 · De Casteljau construction of a Bezier curve Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
  margin: 0;
  padding: 0;
}
</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const c = document.getElementById("c");
c.width = innerWidth;
c.height = innerHeight;

let t = 0, pt1, pt2, pt3, pt4, curve;
function init() {
  c.getContext("2d").clearRect(0, 0, c.width, c.height);
  pt1 = {x: Math.random()*innerWidth, y: Math.random()*innerHeight};
  pt2 = {x: Math.random()*innerWidth, y: Math.random()*innerHeight};
  pt3 = {x: Math.random()*innerWidth, y: Math.random()*innerHeight};
  pt4 = {x: Math.random()*innerWidth, y: Math.random()*innerHeight};
}

function draw() {
  c.getContext("2d").clearRect(0, 0, c.width, c.height);
  const ctx = c.getContext("2d");
  ctx.font = "12px Arial";
  ctx.fillStyle = "#000";
  ctx.textAlign = "left";
  ctx.textBaseline = "top";
  ctx.fillText(`t: ${Math.round(t*100)/100}`, 10, 20);
  ctx.fill …

Excerpt — the full answer is on the round page.

▶ R118 · Sutherland-Hodgman polygon clipping Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sutherland-Hodgman Clipping</title>
<style>
body {
    background-color: #f2f2f2;
}
canvas {
    border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="400" height="300"></canvas>
<script>
function rand(n) { return Math.floor(Math.random() * n); }
function rotate(p, a) {
    var x = p[0];
    var y = p[1];
    var r = a;
    var s = Math.sin(r);
    var c = Math.cos(r);
    return [x*c - y*s, x*s + y*c];
}
function clip_edge(p, d, w) {
    if (d == 0) {
        if (w < p[1]) { return []; }
        return [[p[0], w]];
    } else {
        if (p[d] < w) { return []; }
        var a = Math.atan2(d==1 ? -1 : 1, d);
        var b = rotate([p[d-1], p[d]], -a);
        var c = rotate(p, -a);
        if (d == 0) {
            retur …

Excerpt — the full answer is on the round page.

▶ R119 · Floyd-Steinberg dithering a gradient Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Floyd-Steinberg Dithering</title>
</head>
<body>
<script>
function f(x,y) {
    return Math.sin(Math.PI/2+Math.cos(y*Math.PI*3)*8-Math.abs(x));
}
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
var ctx = canvas.getContext('2d');
var paletteSize = 128;
var frame = 0;
var imageData = new ImageData(256,256);
for (var p=0;p<imageData.data.length;p+=4) {
    var r = f(p/4%512, Math.floor(p/768));
    imageData.data[p] = imageData.data[p+1] = imageData.data[p+2] = Math.floor(r*255);
}
function dither(imageData) {
    var data = imageData.data;
    for (var p=0;p<imageData.data.length;) {
        if (data[p] !== Math.floor(data[p])) {
            var r = data[p];
            data[p] = data[p+3] = Math.f …

Excerpt — the full answer is on the round page.

▶ R120 · Scanline fill of a self-intersecting polygon Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
var c = document.getElementById('c');
var ctx = c.getContext('2d');

var p = [];
for (var i = 0; i < 8; i++) {
    var x = Math.random() * 800;
    var y = Math.random() * 600;
    p.push({x: x, y: y});
}
function lerp(a, b, t) { return a + (b-a)*t; }

function draw() {
    ctx.clearRect(0, 0, c.width, c.height);
    ctx.beginPath();
    var i, ii;
    for (i = 0, ii = p.length-1; i < p.length; ii = i++, i++) {
        var x1 = p[i].x;
        var y1 = p[i].y;
        var x2 = p[ii].x;
        var y2 = p[ii].y;
        ctx.lineTo(x1+Math.sin(Date.now()/1000)*10, y1);
        ctx.lineTo(x2+Math.cos(Date.now()/1000)*20, y2);
    }
    ctx.strokeStyle = 'black';
    ctx.lineWidth = 2;
    ctx.stroke();
    
    var x0, y0, x1, y …

Excerpt — the full answer is on the round page.

▶ R121 · A* pathfinding search across an obstacle grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>A\* Search Algorithm Animation</title>
<style>
body {
  margin: 0;
}

#canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<script>
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');

let gridWidth = 50;
let gridHeight = 20;
let gridSize = Math.min(window.innerWidth, window.innerHeight) * 0.8 / gridWidth;

canvas.width = gridWidth * gridSize;
canvas.height = gridHeight * gridSize;

let grid = [];
for (let i = 0; i < gridHeight; i++) {
  let row = [];
  for (let j = 0; j < gridWidth; j++) {
    row.push(Math.random() < 0.2 ? 'obstacle' : 'free');
  }
  grid.push(row);
}

function generateGoal() {
  return [Math.floor(Math.random() * gridHeight), Math.floor(Math.ra …

Excerpt — the full answer is on the round page.

▶ R122 · Randomized maze generation via recursive backtracking Open round →
```html
<!DOCTYPE html>
<html>
<head>
	<title>Maze Generation</title>
	<style>
		body {
			margin: 0;
			background-color: #f0f0f0;
		}
		canvas {
			border: 1px solid black;
		}
		#stats {
			position: absolute;
			top: 10px;
			left: 10px;
			color: blue;
		}
	</style>
</head>
<body>
	<canvas id="maze" width="400" height="300"></canvas>
	<div id="stats"></div>

	<script>
		let canvas = document.getElementById("maze");
		let ctx = canvas.getContext("2d");

		const WIDTH = 20;
		const HEIGHT = 15;

		function randomInt(min, max) {
			return Math.floor(Math.random() * (max - min)) + min;
		}

		class Cell {
			constructor(x, y) {
				this.x = x;
				this.y = y;
				this.visited = false;
				this.walls = [true, true, true, true];
			}
		}

		let cells = Array(HEIGHT).fill().map(() => Array(WIDTH).fill(null));
		for (let i = 0; i < HEIGHT; i++) {
			for (let j = 0; j < WIDTH; j++) {
				cel …

Excerpt — the full answer is on the round page.

▶ R123 · Breadth-first flood fill spreading through a region Open round →
```html
<canvas id="c" width="600" height="400"></canvas>
<script>
  const canvas = document.getElementById('c');
  const ctx = canvas.getContext('2d');

  function rand(x) {
    return Math.floor(Math.random() * x);
  }

  function rect(w, h, x, y, c) {
    ctx.fillStyle = c;
    ctx.fillRect(x, y, w, h);
  }
  function fill(c, r) {
    for (let y = 0; y < r.length; y++) {
      for (let x = 0; x < r[y].length; x++) if (r[y][x] == c) {
        rect(20, 20, x * 20 + 1, y * 20 + 1, '#000');
        r[y][x] = -c;
        if (y > 0 && r[y-1][x] != c) floodfill(r, y-1, x);
        if (y < r.length-1 && r[y+1][x] != c) floodfill(r, y+1, x);
        if (x > 0 && r[y][x-1] != c) floodfill(r, y, x-1);
        if (x < r[y].length-1 && r[y][x+1] != c) floodfill(r, y, x+1);
      }
    }
  }

  function floodfill(grid, y0, x0) {
    const queue = [[y0, x0]];
    const steps = new Array(grid.length) …

Excerpt — the full answer is on the round page.

▶ R124 · Dijkstra's shortest path over weighted terrain Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dijkstra's Algorithm</title>
<style>
  body {
    margin: 0;
    font-family: monospace;
  }
  #info {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px;
    border-radius: 5px;
  }
</style>
</head>
<body>
<canvas id="grid" width="800" height="600"></canvas>
<div id="info">cells settled: <span id="settled">0</span>, total path cost: <span id="cost">0</span></div>
<script>
  const grid = document.getElementById('grid');
  const ctx = grid.getContext('2d');
  const infoDiv = document.getElementById('info');

  let width, height;
  let gridSize = 40;

  const random = () => Math.random() * 255 | 0;
  const randomInt = (max) => Math.floor(Math.random() * max);

  function init …

Excerpt — the full answer is on the round page.

▶ R125 · Voronoi diagram growing by multi-source flood fill Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Voronoi Diagram</title>
    <style>
        body {
            margin: 0;
            background-color: #f2f2f2;
        }
        
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
    let canvas = document.getElementById('canvas');
    let ctx = canvas.getContext('2d');
    let cellCount = 0;

    function randomPoint() {
        return [Math.random() * (canvas.width - 10) + 5, Math.random() * (canvas.height - 10) + 5];
    }

    function drawSeed(points) {
        ctx.beginPath();
        for (let i = 0; i < points.length; i++) {
            ctx.arc(points[i][0], points[i][1], 2, 0, 2 * Math.PI);
        }
        ctx.fil …

Excerpt — the full answer is on the round page.

▶ R126 · Bubble sort sweeping bars into order Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bubble Sort Animation</title>
<style>
body {
  margin: 0;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  height: 500px;
}
</style>
</head>
<body>
<canvas id="canvas" width="800"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

let numComparisons = 0;

function generateRandomArray() {
  const array = [];
  for (let i = 0; i < 80; i++) {
    array.push(Math.floor(Math.random() * 500));
  }
  return array;
}

function drawArray(arr) {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  const maxHeight = Math.max(...arr);
  let yScale = canvas.height / maxHeight;

  for (let i = 0; i < arr.length; i++) {
    if (i === arr.length - 1 && isSorted(arr)) {
      ctx.fillS …

Excerpt — the full answer is on the round page.

▶ R127 · Quicksort partitioning around glowing pivots Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Quicksort Animation</title>
</head>
<body>
  <canvas id="canvas"></canvas>
  <script>
    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');
    const width = window.innerWidth;
    const height = window.innerHeight / 3;
    const numBars = Math.floor(height / 5);
    let bars = [];
    let swaps = 0;

    for (let i = 0; i < numBars; i++) {
      bars.push(Math.floor(Math.random() * height));
    }

    function draw() {
      ctx.clearRect(0, 0, width, height);
      const barWidth = width / numBars;
      const activeHeight = height - barWidth;
      for (let i = 0; i < numBars; i++) {
        const barColor = 'rgb(' + Math.floor(Math.random() * 255) + ',' + Math.floor(Math.random() * 255) + ' …

Excerpt — the full answer is on the round page.

▶ R128 · Merge sort weaving runs together Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Merge Sort Animation</title>
<style>
body {
  font-family: monospace;
}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");

let data = [];
for (let i = 0; i < 80; i++) {
  data.push(Math.floor(Math.random() * 200));
}
let currentPass = 1;
let runLength = Math.ceil(data.length / 2);

function draw() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  let barWidth = (canvas.width - 20) / data.length;
  for (let i = 0; i < data.length; i++) {
    let x = 10 + i * barWidth;
    let y = 590 - data[i];
    ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
    ctx.fillRect(x, 600 - y, barWidth, data[i]);
  }
  ctx.font = "24px monospace";
  ctx.textAlign = "left";
  ctx.textBaseline = "top";
  ctx.fillStyle = "black";
  ctx.fillText(`Pa …

Excerpt — the full answer is on the round page.

▶ R129 · Heap sort sifting the maximum to the back Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Heap Sort Animation</title>
    <style>
        body {
            font-family: monospace;
            margin: 0;
            padding: 0;
        }
        #canvas {
            border: 1px solid black;
        }
        .highlighted-bar {
            background-color: yellow;
        }
    </style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
canvas.width = 800;
canvas.height = 600;

let heap, swaps = 0;
function draw() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    for (let i = 0; i < heap.length; ++i) {
        let h = Math.floor(heap[i] * (canvas.height - 10) / 100);
        ctx.fillStyle = 'bl …

Excerpt — the full answer is on the round page.

▶ R130 · Radix sort ordering by one digit at a time Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Least Significant Digit Radix Sort Animation</title>
<style>
  canvas {
    border: 1px solid black;
  }
  #info {
    font-family: monospace;
    font-size: 24px;
  }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="info">Pass: <span id="pass">0</span> | Digit Place: <span id="digit-place">0</span></div>
<script>
  const canvas = document.getElementById('canvas');
  const ctx = canvas.getContext('2d');
  const info = document.getElementById('info');

  function randomArray(length, max) {
    let array = new Array(length);
    for (let i = 0; i < length; i++) {
      array[i] = Math.floor(Math.random() * max);
    }
    return array;
  }

  function sort(array) {
    const maxHeight = Math.max(...array);
    const barWidth = canvas.width / array.length;
    let pass = 0; …

Excerpt — the full answer is on the round page.

▶ R131 · Weekday riddle from two clues Open round →
Let's break this down step by step:

* "The day after tomorrow" refers to the day that comes immediately after the day after today. So, if we assume today is Wednesday:
	+ The day after tomorrow would be Friday.
	+ "Two days before Thursday" means one day before Thursday. If tomorrow is Friday (from our previous assumption), then two days before Thursday would indeed be Wednesday.

Therefore, it is **Wednesday** today.
▶ R132 · Fermi estimate: a lifetime of drinking water Open round →
Assumptions:

* Average lifespan: 75 years
* Daily water intake: 2 liters (a moderate estimate)
* Assume no significant changes in daily water intake over a person's lifetime

Calculation:
75 years × 365 days/year = 27,375 days
27,375 days × 2 liters/day = 54,750 liters

Rounded estimate: **55,000 liters**
▶ R133 · Three friends, three pets Open round →
Let's break down the information:

* Ana is allergic to animal fur, so she must own a parrot (since cats and dogs have fur).
* Ben's pet cannot fly, so he must own either a cat or a dog.
* The dog's owner is older than Ben, which means Cleo (who is presumably older than Ben) owns the dog.

Putting it all together: Ana owns the parrot, Ben owns the cat, and Cleo owns the dog.
▶ R134 · Smallest number from three remainders Open round →
## Step 1: Let's denote the smallest positive integer that satisfies all given conditions as N.
We need to find N.

## Step 2: Since N leaves a remainder of 1 when divided by 3, it can be expressed as 3k + 1 for some integer k.
This is because any number that leaves a remainder of 1 when divided by another number is one more than a multiple of that number.

## Step 3: Similarly, since N leaves a remainder of 2 when divided by 5, it can also be expressed as 5m + 2 for some integer m.
This follows the same logic as in step 2 but for division by 5.

## Step 4: And since N leaves a remainder of 3 when divided by 7, it can be expressed as 7n + 3 for some integer n.
Again, following the pattern established in previous steps for division by 7.

## Step 5: We need to find the smallest number that satisfies all three expressions (3k+1), (5m+2), and (7n+3).
Since we're looking for the smallest suc …

Excerpt — the full answer is on the round page.

▶ R135 · Conditional dice probability Open round →
## Step 1: Calculate the total number of outcomes when rolling two dice.
When rolling two six-sided dice, there are $6 \times 6 = 36$ possible outcomes.

## Step 2: Determine the number of outcomes where at least one die shows a 4.
We can break this down into cases. The first case is if the first die shows a 4 and the second does not (with 5 possibilities for the second die). The second case is if the first die does not show a 4 but the second does (also with 5 possibilities). However, we can simplify by considering that regardless of which die shows the 4, there are a total of $2 \times 5 = 10$ outcomes where at least one die shows a 4.

## Step 3: Determine the number of outcomes where both dice sum to 9.
To get a sum of 9 with two six-sided dice, we can have (3,6), (4,5), (5,4), or (6,3). This gives us exactly 4 successful outcomes.

## Step 4: Calculate the probability using the give …

Excerpt — the full answer is on the round page.

▶ R136 · Double pendulum tracing a chaotic path Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Double Pendulum</title>
<style>
body {
  margin: 0;
  background-color: #f2f2ff;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<script>
function doublePendulum() {
  var canvas = document.createElement('canvas');
  document.body.appendChild(canvas);
  canvas.width = canvas.height = 600;
  var ctx = canvas.getContext('2d');
  
  var m1Mass = 10, m2Mass = 5, m1AngleInitial = Math.random()*Math.PI*2, m2AngleInitial = Math.random()*Math.PI*2;
  var m1Length = 100, m2Length = 150;
  var theta1 = m1AngleInitial, theta2 = m2AngleInitial;
  
  function update() {
    if (m1Trail.length > 500) {
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      m1Trail.shift();
      m2Trail.splice(m1Trail.length-20, 20);
      m1AngleInitial = Math.random()*Math.PI*2;
      m2AngleInitial = Math.random()*Math.PI*2;
    }
    
    m1AngleO …

Excerpt — the full answer is on the round page.

▶ R137 · Cloth mesh hanging and rippling in the wind Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const c = document.getElementById("c");
const ctx = c.getContext("2d");

function vec(x, y) { return [x, y]; }
function add(a, b) {
  const r = a.slice();
  for (let i = 0; i < r.length; i++) {
    r[i] += b[i];
  }
  return r;
}
function sub(a, b) {
  const r = a.slice();
  for (let i = 0; i < r.length; i++) {
    r[i] -= b[i];
  }
  return r;
}
function mul(s, v) {
  const r = [v[0]*s, v[1]*s];
  return r;
}
function mag(v) { return Math.sqrt(v[0]*v[0]+v[1]*v[1]); }
function norm(v) { return mul(1/mag(v), v); }
function dot(a, b) {
  let sum = 0;
  for (let i = 0; i < a.length; i++) {
    sum += a[i] * b[i];
  }
  return sum;
}

function springConstant(s) { return s/10+0.1; }

const N = 15*10;
const points = [];
for (let …

Excerpt — the full answer is on the round page.

▶ R138 · Two-source wave interference pattern Open round →
```html
<html>
  <body>
    <canvas id="canvas" width="600" height="400"></canvas>
    <script>
      (function() {
        var canvas = document.getElementById("canvas");
        var ctx = canvas.getContext("2d");

        var sources = [
          {x: 200, y: 100},
          {x: 300, y: 100}
        ];

        var frequency = Math.PI * 2;
        var amplitude = 10;

        function distance(p1, p2) {
          return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
        }

        function angle(p1, p2) {
          return Math.atan2(p1.y - p2.y, p1.x - p2.x);
        }

        function wave(x, y, source, f, a) {
          var dx = x - source.x;
          var dy = y - source.y;
          var d = distance(source, {x: x, y: y});
          var t = Math.atan2(dy, dx);
          return a * Math.sin(f * d + t);
        }

        function draw() {
          canvas.width …

Excerpt — the full answer is on the round page.

▶ R139 · Small n-body system orbiting a central star Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
  margin: 0;
}
</style>
</head>
<body>
<canvas id="c" width="640" height="480"></canvas>
<script>
var c = document.getElementById('c');
var ctx = c.getContext('2d');
var bodies = [];
for(var i=0;i<6;++i) {
  var m = Math.random() * 100;
  var v = [Math.random()*5-2.5, Math.random()*5-2.5];
  var r = Math.sqrt(v[0]*v[0]+v[1]*v[1]);
  if(r > 4) {
    r /= 10;
    v[0] *= 10; v[1] *= 10;
  }
  var x = Math.random()*c.width + c.width/2 - (r+5);
  var y = Math.random()*c.height + c.height/2 - (r+5);
  var col = '#'+Math.floor(Math.random()*16777215).toString(16);
  bodies.push({m:m, v:v, r:r, x:x, y:y, col:col});
}
var G = 0.1;
var t = 0;
function draw() {
  ctx.clearRect(0,0,c.width,c.height);
  var mx = c.width/2; var my = c.height/2;
  for(var i=0;i<bodies.length;++i) {
    ctx.beginPath();
    ctx.arc(bodies[i].x,bodies[i].y,bodies[i].r …

Excerpt — the full answer is on the round page.

▶ R140 · Water sloshing in a tilting container Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sloshing Water Animation</title>
<style>
    body {
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    #canvas {
        width: 100%;
        height: 500px;
        border: none;
    }
</style>
</head>
<body>
<canvas id="canvas"></canvas>

<script>
    let canvas = document.getElementById('canvas');
    let ctx = canvas.getContext('2d');
    canvas.width = window.innerWidth;
    canvas.height = 500;

    let particles = [];
    let gravityDirX, gravityDirY;
    let tiltAngle = 0;

    function init() {
        for (let i = 0; i < 200; i++) {
            let x = Math.random() * canvas.width;
            let y = Math.random() * canvas.height;
            particles.push({x: x, y: y, vx: Math.random()*2-1, vy: Math.random …

Excerpt — the full answer is on the round page.

▶ R141 · Idiom-dense German into natural English Open round →
That was a shot in the foot - now we're standing there with our pants down, but giving up is not an option.
▶ R142 · Register shift: casual complaint into formal Open round →
Subject: Defective Blender Replacement Request

Dear Customer Service Team,

I am writing to report a defective blender that I received from your company, which ceased functioning after just two days of use. Upon attempting to blend a routine mixture, the blender emitted sparks and failed to operate. As this product is still under warranty, I request a prompt replacement or refund of the full purchase price.

Please let me know the next steps in resolving this matter. I appreciate your attention to this issue and look forward to a swift resolution.

Sincerely,
[Your Name]
▶ R143 · Bureaucratic German into plain English Open round →
You need to submit your application on time and fill it out completely for us to consider giving you this service. If we don't get your completed application in on time, we can't give you the service.
▶ R144 · English apology into idiomatic Sie-German Open round →
Wir haben hier einen Fehler gemacht – keine Schönreden. Aber wir werden es gutmachen und dabei werden Sie überhaupt kein Geld ausgeben müssen.
▶ R145 · False-friend minefield German into English Open round →
We may have to postpone the current date; it's a sensitive topic, and I wouldn't want to spread poison.
▶ R146 · Repair broken JSON (4 precise errors) 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 array Open round →
```json
[
  {
    "id": 1,
    "name": "Anna Berg",
    "notes": "Prefers email, not phone",
    "amount": 120.5
  },
  {
    "id": 2,
    "name": "Tom Klein",
    "notes": "Standard customer",
    "amount": 75.0
  },
  {
    "id": 3,
    "name": "Lena Fuchs",
    "notes": "Called twice, resolved",
    "amount": 200.0
  },
  {
    "id": 4,
    "name": "Max Otto",
    "notes": "VIP customer",
    "amount": 50.0
  }
]
```
▶ R148 · Table QA: sum, filter, max over order data Open round →
1. $1249.90
2. 1001, 1003, 1006
3. 1006 ($162.50)
▶ R149 · Extract meeting invite into a fixed JSON schema Open round →
```
{
    "title": "Q3 Roadmap Kickoff",
    "date": "2026-08-18",
    "time": "10:30",
    "location": "Conference Room B, 3rd floor at the Berlin office",
    "attendees": ["Sarah", "Tom", "Priya"]
}
```
▶ R150 · Diff two near-identical config blocks Open round →
* key: timeout -> A-value: 30 -> B-value: 45
* key: max_connections -> A-value: 100 -> B-value: 150
* key: debug -> A-value: false -> B-value: true
▶ R151 · Binary search tree growing node by node Open round →
```html
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Binary Search Tree Animation</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
        }
        #canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
    let canvas = document.getElementById('canvas');
    let ctx = canvas.getContext('2d');
    canvas.width = window.innerWidth - 20;
    canvas.height = window.innerHeight - 20;

    class Node {
        constructor(value, x, y) {
            this.value = value;
            this.x = x;
            this.y = y;
            this.left = null;
            this.right = null;
        }
    }

    let root = null;
    let treeNodes = [];

    function drawTree() {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        if (root) { …

Excerpt — the full answer is on the round page.

▶ R152 · Hash table with visible collision chains Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Hash Table Animation</title>
<style>
body {
  margin: 0;
}
canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="canvas" width="600" height="400"></canvas>

<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

const cols = 12;
let keys = new Array(cols);
for (let i = 0; i < cols; i++) {
  keys[i] = [];
}
let totalKeys = 0;

function hash(key) {
  return key % cols;
}

function draw() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);

  const w = canvas.width / cols;
  for (let i = 0; i < cols; i++) {
    ctx.fillStyle = 'lightgray';
    ctx.fillRect(i * w, 20, w, 30);
    ctx.fillStyle = 'black';
    ctx.font = '16px Arial';
    ctx.textAlign = 'center';
    ctx.textBaseline = 'top';
    ctx.fillText('Bucket ' + (i + 1), i * w + w / 2, 25);

    const klen = keys[i].length; …

Excerpt — the full answer is on the round page.

▶ R153 · Binary min-heap with bubble-up and sink-down Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
  margin: 0;
  background-color: #f0f0f0;
}

canvas {
  border: 1px solid black;
}
</style>
</head>
<body>
<script>
let heap = [];
let insertCount = 0;
let extractMinCount = 0;

function random(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

function drawHeap(heap, canvas) {
  let ctx = canvas.getContext('2d');
  let radius = 20;
  let paddingX = 10;
  let paddingY = 10;
  let levelWidth = 0;
  let nodeLevel = [];
  for (let i = heap.length - 1; i >= 0; --i) {
    if (!nodeLevel[i]) {
      levelWidth += radius * 2 + paddingX;
      nodeLevel.push([]);
    }
    nodeLevel[i].push(heap[i]);
  }

  ctx.clearRect(0, 0, canvas.width, canvas.height);
  for (let i = 0; i < nodeLevel.length; ++i) {
    let x = levelWidth / 2 + paddingX;
    let y = i * radius * 3 + paddingY;
    let angle = Math.PI / 4;
    for (let …

Excerpt — the full answer is on the round page.

▶ R154 · Ring buffer with producer and consumer at different rates Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
  margin: 0;
  background-color: #f2f2f2;
}

canvas {
  display: block;
}
</style>
</head>
<body>
<script>
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = 400;
canvas.height = 200;

var ctx = canvas.getContext('2d');

var slots = Math.floor(Math.random() * (16 - 20)) + 16;
var buffer = new Array(slots).fill(0);

var producerPos = 0;
var consumerPos = Math.floor(Math.random() * (slots - 10)) + 5;
var fillerLevel = 0;

function fillSlot(pos) {
  ctx.fillStyle = getFillColour();
  ctx.fillRect(pos * 20, canvas.height / 2 - 10, 15, 20);
}

function clearSlot(pos) {
  ctx.clearRect(pos * 20, canvas.height / 2 - 10, 15, 20);
}

function update() {
  fillerLevel = buffer.filter(v => v === 1).length;

  if (producerPos < consumerPos && producerPos + 1 !== slots && slots > buffer.length) {
    bu …

Excerpt — the full answer is on the round page.

▶ R155 · Linked list with animated pointer relinking Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Singly Linked List Animation</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <canvas id="listCanvas" width="600"></canvas>
    <script>
        const canvas = document.getElementById('listCanvas');
        const ctx = canvas.getContext('2d');
        let nodeList = [];
        let listLength = 0;
        let insertNodeIndex = Math.floor(Math.random() * (nodeList.length + 1));
        let deleteNodeIndex = -1;

        function Node(name) {
            this.name = name;
            this.prevArrowX = null;
            this.prevArrowY = null;
            this.newLine = false;
        }

        function drawNode(node, x, y) {
            ctx.fillStyle = 'lightgray'; …

Excerpt — the full answer is on the round page.

▶ R156 · Invent 3 product names + taglines for a fictional object (no superlatives) Open round →
1. SnackGuard — Keep your snacks fresh and secure
2. BagClip Pro — Easy snack storage for busy lives
3. SealSaver Clip — Hold your bags with confidence always
▶ R157 · Rewrite the same product text for two different audiences, facts unchangedDNF Open round →
No usable answer reached the harness in this round.
▶ R158 · 5 email subject lines under 50 chars, no clickbait, no ALL-CAPS Open round →
1. Your Exclusive Offers This Month
2. Feedback Needed: Mobile App Survey
3. Update on Our Winter Sale and More
4. Free Returns Now Available at Our Store
5. November Newsletter from [Store Name]
▶ R159 · Micro-story: exactly 50 words (±5) with 3 mandatory elementsDNF Open round →
No usable answer reached the harness in this round.
▶ R160 · Critique a generic slogan in 2 sentences + give 2 better alternatives Open round →
The slogan's weakness is that it makes a vague promise of quality, which could be applied to any product in any category, providing no unique value proposition or differentiation from competitors. Furthermore, the term "quality" is subjective and doesn't provide specific details about how the solar-powered phone chargers meet the needs of hikers and campers.

1. "Charge Your Adventure."
2. "Solar Power for Every Summit."
▶ R161 · Selection sort vs shell sort racing side by side Open round →
```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Sorting Algorithms Comparison</title>
  <style>
    canvas {
      border: 1px solid black;
    }
  </style>
</head>
<body>
  <canvas id="canvas" width="800" height="300"></canvas>
  <script>
    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');

    function generateRandomArray() {
      return Array(30).fill().map(() => Math.floor(Math.random() * 200) + 1);
    }

    function drawBars(arr, highlightIndex) {
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      const barWidth = canvas.width / arr.length;
      let y = 10;
      for (let i = 0; i < arr.length; i++) {
        const height = arr[i];
        if (i === highlightIndex) {
          ctx.fillStyle = 'red';
        } else {
          ctx.fillStyle = 'blue';
        }
        ctx.fillRect(i * barWidth, canvas.h …

Excerpt — the full answer is on the round page.

▶ R162 · Breadth-first search flooding a random grid maze Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Breadth-First Search Animation</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<script>
    const cols = 20;
    const rows = 15;
    let canvas, ctx;
    let grid, frontier, start, goal;
    let visited = new Set();
    let path = [];
    let timerId;

    function random() {
        return Math.random();
    }

    function generateMaze() {
        grid = Array(rows).fill(0).map(() => Array(cols).fill(false));
        for (let y = 0; y < rows; y++) {
            for (let x = 0; x < cols; x++) {
                if (random() < 0.25) grid[y][x] = true;
            }
        }
        start = { x: Math.floor(Math.random() * cols), y: 0 };
        goal = { x: Math.floor …

Excerpt — the full answer is on the round page.

▶ R163 · Prim's algorithm growing a minimum spanning tree Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prim's Minimum Spanning Tree</title>
<style>
  canvas {
    border: 1px solid black;
  }
  #graph {
    width: 50%;
    height: 400px;
  }
  #tree {
    width: 20%;
    height: 200px;
  }
</style>
<script>
  const nodes = [];
  const edges = [];
  let tree = [];
  let graph = document.getElementById('graph');
  let canvas = graph.getContext('2d');
  let treeCanvas = document.getElementById('tree');
  let treeCtx = treeCanvas.getContext('2d');

  function randomNode() {
    return { x: Math.random() * graph.width, y: Math.random() * graph.height };
  }

  function distance(node1, node2) {
    return Math.sqrt(Math.pow(node1.x - node2.x, 2) + Math.pow(node1.y - node2.y, 2));
  }

  function generateGraph(numNodes) {
    for (let i = 0; i < num …

Excerpt — the full answer is on the round page.

▶ R164 · Boids flocking with separation, alignment, cohesion and a predator Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
#c { border: 1px solid black; }
</style>
</head>
<body>
<canvas id='c' width=800 height=600></canvas>
<script>
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

// constants
var NUM_BOIDS = 60;
var PREDATOR_RADIUS = 20;

// boid properties
function Boid(x, y) {
  this.x = x || Math.floor(Math.random() * (canvas.width - 10));
  this.y = y || Math.floor(Math.random() * (canvas.height - 10));
  this.velX = Math.random()*2-1;
  this.velY = Math.random()*2-1;
}

// predator properties
function Predator(x, y) {
  this.x = x || Math.floor(Math.random() * (canvas.width - PREDATOR_RADIUS*2));
  this.y = y || Math.floor(Math.random() * (canvas.height - PREDATOR_RADIUS*2));
  this.velX = Math.random()*0.5-0.25;
  this.velY = Math.random()*0.5-0.25;
}

// flock properties
function Flock(boids) {
  this.boids = boids || [];
} …

Excerpt — the full answer is on the round page.

▶ R165 · Recursive backtracker carving a maze, then solving it Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maze Generator and Solver</title>
<style>
.canvas {
  border: 1px solid black;
}
.step-count {
  font-size: 12px;
  color: gray;
}
.solving .step-count {
  color: blue;
}
.path {
  stroke-width: 2;
  fill: none;
}
.wanderer {
  fill: red;
}
.visited {
  fill-opacity: 0.5;
}
</style>
</head>
<body>
<canvas id="maze" width="25*20" height="18*20"></canvas>
<div class="step-count">Steps: <span id="solve-steps">0</span></div>
<script>
const canvas = document.getElementById('maze');
const ctx = canvas.getContext('2d');
const gridWidth = 25;
const gridHeight = 18;

function randomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

function Cell(x, y) {
  this.x = x;
  this.y = y;
  this.visited = false;
  this.walls = [tr …

Excerpt — the full answer is on the round page.

▶ R166 · Faithful 3-sentence summary of a chaotic meeting transcript Open round →
The weekly status update will now be sent on Mondays instead of Fridays, starting next week. Priya will update the shared labeling guide document with her new simplified ticket labeling system by Wednesday so everyone can start using it. Tom will send out an updated calendar invite reflecting this change by end of day Friday.
▶ R167 · One-sentence TL;DR under 25 words Open round →
The legacy /v1/reports API endpoint will be fully shut down on September 30, 2026, requiring all integrations to migrate to the /v3/reports endpoint by then.
▶ R168 · Extract action items as a checklist Open round →
1. Maria -- finalize new homepage copy -- by this Thursday
2. Maria -- send finalized homepage copy to Ben for review -- by this Thursday
3. Ben -- review and provide feedback on new homepage copy -- by Friday
4. Chen -- push contact form fix -- by Monday
5. Maria -- chase client about new logo colors -- by today (July 29)
6. Ben -- send updated privacy policy text to legal -- by next Wednesday
▶ R169 · Neutral summary of a biased product rant Open round →
The blender jug has a leak around the base seal when filled past halfway, resulting in a puddle on the counter. The "10-speed" dial is inconsistent, with speeds 4-7 sounding and behaving identically. The motor overheats after approximately 90 seconds of continuous blending, shutting off automatically.
▶ R170 · Compress a how-to into exactly 5 numbered stepsDNF Open round →
No usable answer reached the harness in this round.
▶ R171 · Fireworks bursting into fading sparks Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Fireworks</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<script>
var c = document.createElement("canvas");
c.width = window.innerWidth;
c.height = window.innerHeight;
document.body.appendChild(c);
var ctx = c.getContext("2d");

function rand(a, b) { return Math.random() * (b - a) + a; }

class Particle {
    constructor(x, y, vx, vy, r, g, b, size, life) {
        this.x = x;
        this.y = y;
        this.vx = vx;
        this.vy = vy;
        this.r = r;
        this.g = g;
        this.b = b;
        this.size = size;
        this.life = life;
    }

    draw() {
        ctx.fillStyle = `rgb(${Math.floor(this.r)}, ${Math.floor(this.g)}, ${Math.floor(this.b)})` …

Excerpt — the full answer is on the round page.

▶ R172 · Raindrops sliding down a window pane Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rain on a Window Pane</title>
<style>
body {
  margin: 0;
}
canvas {
  display: block;
}
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');

let drops = [];
let score = 0;

function random() {
  return Math.random() * (1 << 30);
}

function drawRect(x, y, w, h) {
  ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
  ctx.fillRect(x, y - h / 2, w, h);
}

function drawDrop(d) {
  const { x, y, vx } = d;
  const r = Math.sqrt((d.radius * d.radius));
  const blur = 4 + (6 - d.radius) * 0.5;
  ctx.shadowBlur = blur;
  ctx.shadowColor = 'rgba(255, 255, 255, 1)';
  ctx.fillStyle = `rgba(255, 255, 255, ${d.glossiness})`;
  drawRect(x - r / 2, y - d.radiu …

Excerpt — the full answer is on the round page.

▶ R173 · Metaball lava lamp with heating and cooling blobs Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Metaball Lava Lamp</title>
<style>
body {
  margin: 0;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
  const canvas = document.createElement('canvas');
  document.body.appendChild(canvas);
  const ctx = canvas.getContext('2d');
  canvas.width = 512;
  canvas.height = 768;

  let blobs = [];
  for (let i = 0; i < 8; i++) {
    const x = Math.random() * canvas.width;
    const y = Math.random() * canvas.height;
    const r = 10 + Math.random() * 20;
    const v = [Math.random(), Math.random()];
    const t = 255 + Math.random() * 130;
    blobs.push({x, y, r, vx: v[0], vy: v[1], t});
  }

  function draw() {
    ctx.fillStyle = 'black';
    ctx.fillRect(0, 0, canvas.width, canvas.height);

    const grid = Array(32).fill().map(() => Array(512).fill());
    for (const blob of blobs) {
      const …

Excerpt — the full answer is on the round page.

▶ R174 · Recursive fractal tree growing branch by branch Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Fractal Tree</title>
    <style>
        body {
            margin: 0;
            background-color: #f0f0f0;
        }
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
<script>
    const canvas = document.createElement('canvas');
    canvas.width = 800;
    canvas.height = 600;
    document.body.appendChild(canvas);
    const ctx = canvas.getContext('2d');

    let treeDepth = Math.floor(Math.random() * 3) + 8;
    let wind = 0.1;

    function drawTree(x, y, angle, length, depth) {
        if (depth === 0) return;
        ctx.beginPath();
        ctx.lineWidth = 1 / (depth + 1);
        ctx.strokeStyle = `rgba(0, 0, 0, ${1 - (depth / treeDepth)})`;
        ctx.moveTo(x, y);
        let newAngle = angle + Math.random() * 2 - 1;
        let newX = x + length * …

Excerpt — the full answer is on the round page.

▶ R175 · Noise flowfield painting additive particle trails Open round →
```html
<html>
<head>
<style>
body {
  margin: 0;
  background-color: #000;
}
#canvas {
  border: none;
  width: 100vw;
  height: 100vh;
  display: block;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
var canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var ctx = canvas.getContext('2d');

// Perlin noise settings
var pnoise = new (function() {
  this.x = [0, 0];
  this.y = [0, 0];
  this.octave = 6;
  this.scale = 100;
})();

// Particle properties
var psize = 3;
var pcount = 400;
var particles = [];
for(var i=0; i<300; i++) {
  particles.push({
    x: Math.random() * canvas.width,
    y: Math.random() * canvas.height,
    v: [Math.random()*2-1, Math.random()*2-1],
    hue: Math.floor(Math.random()*360)
  });
}

function animate(timestamp) {
  ctx.fillStyle = 'rgba(0,0,0,.01)';
  ctx.fillRect(0,0,canvas.w …

Excerpt — the full answer is on the round page.

▶ R176 · Fix exactly the errors, change nothing else 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 chairs. 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 consistentDNF Open round →
No usable answer reached the harness in this round.
▶ R178 · Remove redundancy without losing facts Open round →
The neighborhood mobile clinic launches on April 8 at the Maple Community Center, which is located on Maple Street. The clinic's regular weekly hours are Wednesdays from 10 a.m. to 4 p.m. Services will be based at this site and include free blood pressure checks, vaccinations, and short medical consultations. Appointments can be booked by phone or in person at the center. During clinic hours, Spanish and Vietnamese interpreters will be available for assistance.
▶ R179 · Unify tense and perspective Open round →
At dawn, I stepped onto the station platform and checked the timetable. The last train number was blinking on the board before the screen went dark. I waited beside the vending machine, but one 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 thought about the missed connection. Finally, I boarded the replacement bus, and sat near the back window. As the bus left town, I watched the station lights disappear behind the rain.
▶ R180 · Fix the broken referencesDNF Open round →
No usable answer reached the harness in this round.