qwen3.5:9b
Low participation: this average comes from only 19 of 179 rounds (11%). Not directly comparable to models with fuller participation.
Rounds & answers 179
▶ R1 · Constrained product copy under a strict word count★ 5/10 Open round →
Keep your feline friend optimally hydrated with this beautiful stainless steel fountain. Its steady flow motion reminds cats of natural running water, encouraging superior drinking habits. The sturdy construction resists rust and lasts for years, making it a reliable addition to any home pet care routine. It is whisper quiet and incredibly easy to clean. Trust us to keep their water pristine every day. (59 words)
▶ R2 · Photorealistic hero-image prompt engineering★ 7.5/10 Open round →
▶ R3 · Bouncing-ball physics: gravity, friction, elastic collisionsDNF★ 0/10 Open round →
▶ R4 · Sorting race: bubble vs insertion vs quicksortDNF★ 1.5/10 Open round →
▶ R5 · Creative coding: an animated solar systemDNF★ 0/10 Open round →
▶ R6 · Extraction → JSON9.6 s Open round →
{"name": "AquaPur X2 Trinkbrunnen", "brand": "PetFlow", "price_eur": 29.99, "weight_g": 800, "features": ["Dreifach-Filter", "extrem leisem 2-Watt-Pumpsystem", "spuelmaschinenfestem Edelstahlaufsatz"], "in_stock": false}▶ R7 · Sentiment classification3.1 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↔EN7.3 s Open round →
A) That’s an old hat trick—life punishes those who are late. We managed to pull this cart out of the mud, but now we can't make leaps before taking steps. --- B) Der wahre Wert eines Dinges zeigt sich erst in der Benutzung: Unser knapper Etat zwang uns zwar dazu, an einigen Ecken Abstriche zu machen, aber der Start war trotzdem ein voller Erfolg.
▶ R9 · One-liner code14.4 s Open round →
1. \d{4}-(0[1-9]|1[0-2])-\d{2}
2. SELECT customer_id, SUM(amount) FROM orders GROUP BY customer_id ORDER BY SUM(amount) DESC LIMIT 5;
3. .items[].id
4. nav a[href^="http"]
5. awk '{print $1}' access.log | sort | uniq | wc -l▶ R10 · Facts quiz8.6 s Open round →
1. Canberra 2. 1989 3. W 4. I'm a teapot 5. Franz Kafka 6. Saturn 7. 101010 8. 443 9. Linus Torvalds 10. 97
▶ R11 · Micro-copy & slogans17.4 s Open round →
1. Keeps whiskers hydrated. Fresh water, happy cat. 2. Taste tradition in every fresh-baked bite. 3. Compare models easily. Your definitive AI guide. 4. Silence the world. Find your perfect focus. 5. One secure password for every digital life.
▶ R13 · Image prompts9.4 s Open round →
1. Cinematic shot of a modern ergonomic gaming chair in a fully decked-out streaming room. Neon lights reflect off steel and glossy plastic. Shallow depth of field, ultra HD photograph. 2. Close-up macro photo of a clear craft gin bottle resting on a dark mahogany bar. Moody, warm cinematic lighting with reflections in an upscale speakeasy setting. 3. E-scooter parked against a vibrant, colorful graffiti mural in an urban alleyway. Crisp detail under soft morning sunlight. Cinematic street photography style.
▶ R14 · Product names4.7 s Open round →
1. Hydrate Flow—Your daily hydration guide. 2. AquaMind—Always remind yourself to sip. 3. SipSync—Optimal health through consistent sipping. 4. H2o Coach—Stay perfectly hydrated, effortlessly managed. 5. LifeDrip—Smart reminder for perfect health.
▶ R15 · CSS spinner5.3 s Open round →
```html
<div class="spinner"></div>
<style>
/* Spinner container */
.spinner {
width: 60px;
height: 60px;
border: 5px solid rgba(0, 0, 0, 0.1); /* Light background ring */
border-radius: 50%;
border-top-color: #3498db; /* Primary loading color */
animation: spin 1s linear infinite;
}
/* Animation keyframes */
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>
```▶ R16 · Explain it to a child (German)7.4 s Open round →
Stell dir den Akku wie einen Lagerraum voller chemischer Energie vor, die bereit ist, freigesetzt zu werden. In diesem "Lager" sind verschiedene Stoffe so platziert, dass sie sich miteinander verbinden wollen. Wenn du Strom brauchst, starten diese Stoffe eine kleine Reaktion, bei der Elektronen (die winzigen Teilchen für den Strom) gezwungen werden, einen Weg zu nehmen. Dieser daraus entstehende stetige „Stromfluss“ treibt dann alle deine Geräte an und macht sie leuchtend oder funktionierend.
▶ R17 · Logic riddle14 s★ 5/10 Open round →
Sie ziehen aus der Kiste mit der Beschriftung „Gemischt“. Da alle Etiketten falsch sind und die Kiste nicht wirklich Gemisch sein kann (sonst wäre das Label richtig), muss sie rein Äpfel oder rein Birnen enthalten. Bestimmt dieser Inhalt, wissen Sie, was in diese Box gehört. Die nun verbleibenden beiden Kisten müssen dann durch eine logische Schlussfolgerung sortiert werden: Jede der gelabelten Kisten kann nicht den Inhalt tragen, für den sie beschriftet ist und muss daher auch nicht das Etikett der gemischten Kiste erhalten (da diese falsch war).
▶ R18 · German registers & tone8.5 s★ 8/10 Open round →
1. Sehr geehrte/r [Name], aufgrund unvorhergesehener Umstände müssen wir Ihnen leider mitteilen, dass wir den ursprünglich vereinbarten Liefertermin nicht einhalten können. 2. Update: Die Lieferung verzögert sich; der neue voraussichtliche Termin ist [Datum]. 3. Hey, ganz ehrlich, das wird eh nicht klappen – wir kriegen das Ding etwas später fertig.
▶ R19 · Table QA11.2 s★ 10/10 Open round →
1. VitaSip 2. 830 Gramm 3. PureFlow 4. 19,51 EUR 5. 3
▶ R20 · JSON repair10.9 s★ 10/10 Open round →
{"name": "Trinkflasche Pro", "price": 29.90, "tags": ["outdoor", "sport"], "stock": {"berlin": 12, "muenchen": 7, "hamburg": null}, "active": true}▶ R21 · Sorting race bubble/insertion/selection35 s★ 7.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Live Sort Race</title>
<style>
body { font-family: sans-serif; display: flex; justify-content: space-around; margin: 20px; background-color: #f4f4f9;}
.panel { border: 1px solid #ccc; padding: 10px; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
canvas { background-color: #fff; display: block; margin: 10px auto; }
</style>
</head>
<body>
<div class="panel"><h3 id="title_bubble">Bubble Sort</h3><canvas id="canvas_bria" width="450" height="200"></canvas><p id="status_bubble">Awaiting start...</p></div>
<div class="panel"><h3 id="title_insert">Insertion Sort</h3><canvas id="canvas_insr" width="450" height="200"></canvas><p id="status_insert">Awaiting start...</p></div>
<div class="panel"><h3 id="title_select">Selection Sort</h3><canvas id="canvas_se …Excerpt — the full answer is on the round page.
▶ R22 · Hexagon balls43.2 s★ 7.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Rotating Bouncing Hexagon</title></head>
<body><canvas id="c"></canvas><script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
ctx.lineWidth = 1;
let W = 800, H = 600;
c.width = W;
c.height = H;
const G = 0.3;
const BALL_COUNT = 8;
const HEX_SIZE = 250;
const ROTATION_SPEED = 0.01;
let rotationAngle = 0;
let balls = [];
for (let i = 0; i < BALL_COUNT; i++) {
balls.push({
x: Math.random() * (W - 20) + 10,
y: Math.random() * (H - 20) + 10,
vx: (Math.random() - 0.5) * 8,
vy: (Math.random() - 0.5) * 8,
r: 10 + i % 3 * 3,
color: `hsl(${i * 45}, 70%, 60%)`
});
}
// Vector utility functions (simplified for line limit)
function dot(v1, v2) { return v1.x * v2.x + v1.y * v2.y; }
// Calculate Hexagon vertices
function getHexWalls() {
let walls = [ …Excerpt — the full answer is on the round page.
▶ R23 · Pendulum wave10.4 s★ 8.5/10 Open round →
<!DOCTYPE html>
<html><head><title>Pendulum Wave</title></head><body style="display:flex; justify-content:center; align-items:center; background: #000;"><canvas id="c" width="800" height="400" style="border:1px solid #333;"></canvas><script>
const c=document.getElementById('c');
const ctx=c.getContext('2d');
let t=0;
function draw() {
ctx.clearRect(0, 0, c.width, c.height);
const numPendulums = 15;
const spacing = (c.width - 50) / (numPendulums + 1);
const pivotY = 20;
for (let i=0; i<numPendulums; i++) {
const x=(i+1)*spacing;
// Period modulation: different base frequencies/lengths
const lengthScale = 30 + (i * 2);
// Traveling wave equation with damping and phase shift based on index (i)
const angle = Math.sin((t*0.5 + i*0.5 * i / numPendulums)) * 0.8;
// Calculate bob coordinates …Excerpt — the full answer is on the round page.
▶ R24 · Maze race BFS/DFS/A*39.1 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Pathfinding Racer</title>
<style>
body { font-family: sans-serif; display: flex; flex-direction: column; align-items: center; background: #111; color: white; }
.container { display: flex; justify-content: space-around; width: 90%; max-width: 1200px; margin-top: 20px; }
canvas { border: 3px solid #444; background: #eee; margin: 5px; }
h3 { text-align: center; color: #aaa; margin-bottom: 5px; }
</style>
</head>
<body onload="initMaze()">
<div class="container">
<div><h3>BFS</h3><canvas id="bfsCanvas" width="500" height="510"></canvas></div>
<div><h3>DFS</h3><canvas id="dfsCanvas" width="500" height="510"></canvas></div>
<div><h3>A*</h3><canvas id="aStarCanvas" width="500" height="510"></canvas></div>
</div>
<script>
const SIZE = 25;
const CANVAS_WIDTH = 500;
const CELL_SIZE = CANVAS_WIDTH / (SIZE - 1); // Adjust size so corners fit …Excerpt — the full answer is on the round page.
▶ R25 · Sorting race quick/merge/heap47.3 s★ 2/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting Race</title>
<style>
body { font-family: sans-serif; display: flex; justify-content: space-around; padding: 20px; background-color: #f4f4f9; }
.panel { width: 30%; border: 1px solid #ccc; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); background-color: white; border-radius: 8px; }
</style>
</head>
<body>
<canvas id="quick-canvas" width="300" height="400" class="panel"></canvas>
<canvas id="merge-canvas" width="300" height="400" class="panel"></canvas>
<canvas id="heap-canvas" width="300" height="400" class="panel"></canvas>
<script>
const CANVAS_SIZES = [
document.getElementById("quick-canvas"),
document.getElementById("merge-canvas"),
document.getElementById("heap-canvas")
];
const ARRAY_SIZE = 60;
function shuffle(a) { for (let i = a …Excerpt — the full answer is on the round page.
▶ R26 · Projectile ballistics32.5 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Projectile Simulation</title>
<style>
body { background: #111; display: flex; justify-content: center; align-items: center; margin: 0; height: 100vh; }
canvas { border: 2px solid #333; background: linear-gradient(to bottom, #6aa84f 0%, #5c9e3b 100%); cursor: crosshair; }
</style>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
// Setup Dimensions (Scale to match typical cannon launch)
canvas.width = 800;
canvas.height = 400;
let GRAVITY = 9.81 * 0.15; // Scaled gravity factor for visibility
let V0_SCALE = 1.2; // Initial velocity scale
const GROUND_LEVEL = canvas.height - 50;
const anglesDeg = [20, 35, 45, 60, 70];
let projectiles = [];
let animationFrameId = null;
function initializeProjectiles() {
projectiles = [];
for (let i = 0; i < 5; i++) { …Excerpt — the full answer is on the round page.
▶ R27 · Double-pendulum chaos29.4 s★ 0.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Double Pendulum Chaos</title>
<style>body {background: #000; display: flex; justify-content: center; align-items: center; height: 100vh;} canvas {border:1px solid gray;}</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
// System constants (identical for both)
const L1 = 100, L2 = 100; // Lengths (in pixels/units) - must be small enough to fit
const M1 = 5, M2 = 5; // Masses
const G = 9.8 * 30; // Gravity scaled for visual effect
// Simulation state structures: [angle_1, angle_2, omega_1, omega_2]
let p1 = [Math.PI / 2, Math.pi / 2, 0, 0]; // Initial angles (start horizontal)
let p2 = [Math.PI / 2 + 0.001, Math.pi / 2 - 0.001, 0, 0]; // Chaotic initialization
// Trail storage: [[x, y], ...]
l …Excerpt — the full answer is on the round page.
▶ R28 · Particle fountain29.5 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Particle Fountain</title>
<style>
body { margin: 0; overflow: hidden; background-color: #111; }
#canvas { display: block; border-bottom: 5px solid #aaa; }
#controls { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10; color: white; text-align: center;}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div id="controls">
Wind Control (W): <span id="windValue">0</span><br>
<input type="range" id="windSlider" min="-1.5" max="1.5" step="0.05" value="0">
</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let width = window.innerWidth;
let height = window.innerHeight * 0.9; // Reserve space for controls/floor visual
canvas.width = width;
canvas.height = height;
window.onresize = function() { …Excerpt — the full answer is on the round page.
▶ R29 · Orbital mechanics28.7 s★ 0.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Newtonian Orbits</title>
<style>body { margin: 0; background: #111; }</style>
</head>
<body><canvas id="c"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
const SCALE = 50; // Pixels per AU (visualization scale)
function setup() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const G_PHYS = 1 * 10; // Gravitational constant for simulation units
const SUN_MASS = 10000;
let bodies = [
// Planet 1 (Inner, stable) - Near circular orbit approximation
{ pos: { x: 25 * SCALE, y: 0 }, vel: { x: 0, y: 3.85 * Math.sqrt(G_PHYS * SUN_MASS / 25) }, mass: 1, radius: 6, trail: [] },
// Planet 2 (Medium, stable)
{ pos: { x: -70 * SCALE, y: 0 }, vel: { x: 0, y …Excerpt — the full answer is on the round page.
▶ R30 · Spring-mass chain31.2 s★ 7.5/10 Open round →
<!DOCTYPE html>
<html>
<head>
<title>Spring Chain Simulation</title>
<style>body {margin: 0; overflow: hidden;} #canvas {display: block;}</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let W = window.innerWidth;
let H = window.innerHeight * 0.7;
canvas.width = W;
canvas.height = H;
const N = 12;
const L_INITIAL = 80; // Initial spacing between masses
const K_SPRING = 0.05; // Spring constant (Hooke's law)
const DAMPING = 0.98; // Damping factor applied to velocity
const MASS_RADIUS = 10;
const DT = 0.01;
let masses = [];
for (let i = 0; i < N; i++) {
masses[i] = { x: 50 + i * L_INITIAL, y: H / 2, vx: 0, vx: 0 };
}
let isDragging = false;
let grabbedIndex = -1;
const ANCHOR_LIMITS = { start: 0, end: N - 1 };
function updateMass(i) {
const m = masses[ …Excerpt — the full answer is on the round page.
▶ R31 · Bat and ball (the classic reasoning trap) Open round →
Der Ball kostet **0,05 Euro**. Man setzt die Formel für den Schläger ($S = B + 1,00$) in die Gesamtformel ein ($S + B = 1,10$). Dies ergibt $2 \cdot B + 1,00 = 1,10$. Wenn man 1,00 Euro abzieht und durch zwei teilt, erhält man den Preis für den Ball.
▶ R32 · Four houses, four clues (constraint puzzle) Open round →
Die Farben der Häuser von Position 1 bis 4 sind:
| Position | Farbe |
| :---: | :---: |
| **1** | Grün |
| **2** | Rot |
| **3** | Blau |
| **4** | Gelb |
***
### Begründung:
1. **Startpunkt (Fakt 2):** Wir wissen, dass das grüne Haus an Position 1 steht.
*(Aktuelle Anordnung: Grün, ?, ?, ?)*
2. **Kettenbildung (Fakten 1 und 3):**
* Fakt (1) besagt: Rot $\to$ Blau (R ist direkt links von B).
* Fakt (3) besagt: Blau $\to$ Gelb (Y ist direkt rechts von B).
* Diese beiden Fakten ergeben eine feste Kette aus drei Häusern: **Rot, Blau, Gelb**.
3. **Platzierung:** Da Position 1 bereits mit Grün belegt ist, müssen die Häuser Rot, Blau und Gelb in den verbleibenden Positionen (2, 3 und 4) stehen.
* Position 2 = Rot
* Position 3 = Blau
* Position 4 = Gelb
**Überprüfung:**
* Das grüne Haus ist an Position 1. (Korrekt)
* Das rote Haus (P2) steht direkt links vom b …Excerpt — the full answer is on the round page.
▶ R33 · Idioms that break literal translation (EN→DE) Open round →
**1) to bite the bullet** Durchbeißen / Sich zusammenreißen (bedeutet, dass man sich zwingen muss, eine unangenehme oder schwierige Sache mit Mut zu ertragen und zu erledigen.) **2) the ball is in your court** Die Entscheidung/Initiative liegt bei dir. (Bedeutet, dass nun die andere Person handeln oder entscheiden muss.) **3) it's raining cats and dogs** Es gießt wie aus Eimern. (Bedeutet, dass es extrem stark regnet.)
▶ R34 · Constrained taglines (word ban + length cap) Open round →
1. Bamboo für dein Lächeln, sanft rein. 2. Ein sauberer Start, ohne Kunststoffmüll. 3. Grün im Bad. Reinheit mit Bambus.
▶ R35 · Minutes in a (non-leap) year — show the math Open round →
**Rechnung:**
1. **Tage in Stunden:**
Ein Jahr hat 365 Tage und ein Tag hat 24 Stunden.
$365 \text{ Tage} \times 24 \text{ Stunden/Tag} = 8760 \text{ Stunden}$
2. **Stunden in Minuten:**
Eine Stunde hat 60 Minuten.
$8760 \text{ Stunden} \times 60 \text{ Minuten/Stunde} = 525.600 \text{ Minuten}$
**Endergebnis:**
525600▶ R36 · Continue the sequence (doubling gaps) Open round →
Die nächste Zahl ist **33**. **Regel:** Die Differenz zwischen aufeinanderfolgenden Zahlen verdoppelt sich bei jedem Schritt ($+1$, dann $+2$, dann $+4$, dann $+8$, und somit wird als Nächstes $+16$ gerechnet: $17 + 16 = 33$).
▶ R37 · False friend: 'control' EN→DE Open round →
Bevor wir verschicken, muss ich die Testergebnisse überprüfen und schließlich zwei Fehler beheben.
▶ R38 · Register shift: formal → casual (DE) Open round →
Hey [Name der Kollegin], nur kurze Info: Das Meeting muss leider auf morgen um 10 Uhr verschoben werden! 😊
▶ R39 · 40-word product blurb with 3 required words Open round →
Genießen Sie pure Hydratation mit unserer hochwertigen Edelstahlflasche. Dank ihres Designs ist sie absolut auslaufsicher und hält Ihre Getränke stundenlang kühl. Robust, stilvoll und spülmaschinenfest – Ihr perfekter täglicher Begleiter für unterwegs. Jetzt bestellen!
▶ R40 · isPalindrome (ignore case & non-alphanumerics) Open round →
const isPalindrome = (s) => {
// Clean the string by converting to lowercase and keeping only alphanumeric characters
const cleanedString = s.toLowerCase().replace(/[^a-z0-9]/g, '');
let left = 0;
let right = cleanedString.length - 1;
while (left < right) {
if (cleanedString[left] !== cleanedString[right]) {
return false;
}
left++;
right--;
}
return true;
};▶ R41 · Prose → valid JSON Open round →
```json
{
"name": "Anna Schmidt",
"alter": 30,
"stadt": "Freiburg",
"hobbys": [
"Lesen",
"Radfahren"
],
"newsletter_abonniert": true
}
```▶ R42 · All but nine (word-problem trap) Open round →
9 Neun Schafe sind noch am Leben.
▶ R43 · Five machines (rate-reasoning trap) Open round →
5 Die Maschinen arbeiten parallel und die Anzahl der benötigten Teile steigt im gleichen Verhältnis wie die verfügbaren Maschinen (100 zu 100). Da das Verhältnis von Maschinenzahl zu Teilstückzahl konstant bleibt, bleibt auch die Zeit unverändert. Die Produktionszeit wird in diesem Szenario nicht durch eine Steigerung des Ressourcenverhältnisses verkürzt oder verlängert.
▶ R44 · Appointment extraction to strict JSON Open round →
```json
[
{
"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 perfect, but let’s keep our expectations reasonable—all in all, we can live with it.
▶ R46 · Energy conservation on a frictionless incline Open round →
This problem requires the application of the principle of **Conservation of Energy**, as friction is ignored. The total initial mechanical energy ($E_{initial}$) must equal the total final mechanical energy ($E_{final}$).
**Given values:**
* Mass ($m$) = $2 \text{ kg}$
* Initial height ($h_i$) = $5 \text{ m}$
* Final height ($h_f$) = $0 \text{ m}$ (at the bottom)
* Initial speed ($v_i$) = $0 \text{ m/s}$
* Gravity ($g$) = $9.8 \text{ m/s}^2$
### 1. Energy Conservation Setup
$$E_{initial} = E_{final}$$
$$\text{KE}_i + \text{PE}_i = \text{KE}_f + \text{PE}_f$$
Where:
* $\text{KE} = \frac{1}{2} m v^2$
* $\text{PE} = m g h$
Substituting the known values (and noting that $v_i=0$, so $\text{KE}_i = 0$; and $h_f=0$, so $\text{PE}_f = 0$):
$$0 + m g h_i = \frac{1}{2} m v^2 + 0$$
$$m g h_i = \frac{1}{2} m v^2$$
---
### (a) Calculate the block's speed at the bottom ($v$)
We …Excerpt — the full answer is on the round page.
▶ R47 · Unit conversion: km/h to m/s and mph Open round →
This problem requires two separate unit conversions for the speed of 108 km/h.
---
## (a) Conversion to meters per second ($\text{m/s}$)
We must convert kilometers ($\text{km}$) to meters ($\text{m}$), and hours ($\text{h}$) to seconds ($\text{s}$).
**Conversion Factors:**
* $1 \text{ km} = 1000 \text{ m}$
* $1 \text{ h} = 60 \text{ minutes} \times 60 \text{ seconds/minute} = 3600 \text{ s}$
**Steps:**
$$\text{Speed} (\text{m/s}) = 108 \frac{\text{km}}{\text{h}} \times \left(\frac{1000 \text{ m}}{1 \text{ km}}\right) \times \left(\frac{1 \text{ h}}{3600 \text{ s}}\right)$$
$$\text{Speed} (\text{m/s}) = 108 \times \frac{1000}{3600}$$
$$\text{Speed} (\text{m/s}) = 108 \times \frac{1}{3.6}$$
$$\text{Speed} (\text{m/s}) = 30$$
**Final Answer (rounded to 1 decimal place):**
$30.0 \text{ m/s}$
---
## (b) Conversion to miles per hour ($\text{mph}$)
We must convert kilometers ($\ …Excerpt — the full answer is on the round page.
▶ R48 · Low-orbit satellite: speed and period (orbital/Kepler estimate) Open round →
This problem requires calculating the orbital speed using the energy equation and then using that speed to determine the period.
### Given Values
* Altitude ($h$): $400 \text{ km}$
* Earth Radius ($R_E$): $6371 \text{ km}$
* Standard Gravitational Parameter ($\mu$): $398600 \text{ km}^3/\text{s}^2$
***
### Step 1: Calculate the Orbital Radius ($r$)
First, we must find the total distance from the center of Earth to the satellite.
$$r = R_E + h$$
$$r = 6371 \text{ km} + 400 \text{ km}$$
$$\mathbf{r = 6771 \text{ km}}$$
***
### (a) Estimate the Orbital Speed ($v$)
We use the formula:
$$v = \sqrt{\frac{\mu}{r}}$$
**Show Work:**
$$v = \sqrt{\frac{398600 \text{ km}^3/\text{s}^2}{6771 \text{ km}}}$$
$$v = \sqrt{58.8643 \text{ km}^2/\text{s}^2}$$
$$\mathbf{v \approx 7.672 \text{ km/s}}$$
***
### (b) Estimate the Orbital Period ($T$)
We use the formula:
$$T = \frac{2\pi r}{v}$$
* …Excerpt — the full answer is on the round page.
▶ R49 · Ohm's law: resistance and power dissipation Open round →
### Given Values:
* Voltage ($V$) $= 12 \text{ V}$
* Current ($I$) $= 0.5 \text{ A}$
***
### (a) Calculate the resistance of the resistor
We use Ohm's Law, which states that $V = I \times R$. To find the resistance ($R$), we rearrange the formula:
$$R = \frac{V}{I}$$
**Calculation:**
$$R = \frac{12 \text{ V}}{0.5 \text{ A}}$$
$$R = 24 \text{ } \Omega$$
**(a) The resistance of the resistor is $\mathbf{24 \text{ } \Omega}$.**
***
### (b) Calculate the electrical power dissipated in it
We use the formula for electrical power, $P = V \times I$.
**Calculation:**
$$P = 12 \text{ V} \times 0.5 \text{ A}$$
$$P = 6 \text{ W}$$
*(Alternatively, using the calculated resistance: $P = I^2 R = (0.5 \text{ A})^2 \times 24 \text{ } \Omega = 0.25 \times 24 = 6 \text{ W}$)*
**(b) The electrical power dissipated is $\mathbf{6 \text{ W}}$.**▶ R50 · Thin lens equation: image distance and magnification Open round →
This problem uses the thin lens equation to determine where an image forms and what its characteristics are.
### Given Values:
* Focal length ($f$): $+10 \text{ cm}$ (Positive because it is a converging lens)
* Object distance ($d_o$): $15 \text{ cm}$
* Thin Lens Equation: $\frac{1}{f} = \frac{1}{d_o} + \frac{1}{d_i}$
---
### (a) Calculate the image distance $d_i$
We rearrange the thin lens equation to solve for $1/d_i$:
$$\frac{1}{d_i} = \frac{1}{f} - \frac{1}{d_o}$$
Substitute the given values:
$$\frac{1}{d_i} = \frac{1}{10 \text{ cm}} - \frac{1}{15 \text{ cm}}$$
To subtract these fractions, we find a common denominator (which is 30):
$$\frac{1}{d_i} = \left(\frac{3}{30}\right) - \left(\frac{2}{30}\right)$$
$$\frac{1}{d_i} = \frac{3 - 2}{30}$$
$$\frac{1}{d_i} = \frac{1}{30}$$
$$d_i = +30 \text{ cm}$$
**The image distance $d_i$ is $+30 \text{ cm}$.**
---
### (b) Calculat …Excerpt — the full answer is on the round page.
▶ R51 · Heat required to warm water (specific heat capacity) Open round →
This problem requires using the heat energy equation $Q = m \cdot c \cdot \Delta T$.
### 1. Identify Given Values and Calculate $\Delta T$
* **Mass ($m$):** $2 \text{ kg}$
* **Specific Heat Capacity ($c$):** $4186 \text{ J}/(\text{kg}\cdot\text{K})$
* **Initial Temperature ($T_i$):** $20^\circ\text{C}$
* **Final Temperature ($T_f$):** $80^\circ\text{C}$
First, calculate the change in temperature ($\Delta T$). Since $\Delta T$ is a change in temperature, we can use the difference in Celsius or Kelvin:
$$\Delta T = T_f - T_i$$
$$\Delta T = 80^\circ\text{C} - 20^\circ\text{C}$$
$$\Delta T = 60^\circ\text{C} \quad (\text{or } 60 \text{ K})$$
### 2. Calculation of Heat Energy ($Q$)
Now, substitute the values into the formula:
$$Q = m \cdot c \cdot \Delta T$$
$$Q = (2 \text{ kg}) \cdot (4186 \text{ J}/(\text{kg}\cdot\text{K})) \cdot (60 \text{ K})$$
$$Q = 50,232 \text{ J}$$
### …Excerpt — the full answer is on the round page.
▶ R52 · Fermi estimate: how many piano tuners in a 10-million-person city? Open round →
This estimation relies entirely on making several educated, but purely speculative, guesses about demographics and consumer behavior. Here is the step-by-step assumption chain: *** ### 🎹 Step 1: Estimate Total Households First, we need to convert the population into a manageable unit (households). * **Population:** 10,000,000 people. * **Assumption (Average Household Size):** Let's assume an average household size of 2.5 people. * **Calculation:** $10,000,000 \div 2.5 = 4,000,000$ households. ### 🎹 Step 2: Estimate Number of Pianos Owned Not every house has a piano, and not all pianos need professional tuning (some might be played sparingly). We must estimate the share of households that own an instrument requiring regular maintenance. * **Assumption (Piano Ownership Rate):** Let's assume that about 1 in every 50 households owns a piano capable of needing professional ann …
Excerpt — the full answer is on the round page.
▶ R53 · Why is the sky blue? (conceptual) Open round →
The sky appears blue because of a physical process called **scattering**. Here is the plain, non-technical explanation: *** ### The Simple Explanation Think of sunlight not as one single color of light, but as a mix of all colors—red, orange, yellow, green, blue, and indigo. Each of these colors has a different "size" or wavelength (blue light waves are shorter and smaller than red light waves). When the sun's light reaches Earth, it doesn't just travel straight down; it encounters trillions of tiny particles floating in our atmosphere—mostly nitrogen and oxygen gas molecules. These atmospheric molecules act like little speed bumps for the sunlight. When the light hits these molecules, it gets scattered and bounced off in all directions. The key is that **shorter wavelengths (like blue and violet) are much better at scattering than longer wavelengths (like red and orange).** Becau …
Excerpt — the full answer is on the round page.
▶ R54 · Time dilation: why do moving clocks run slow? (conceptual, special relativity) Open round →
This explanation focuses on the concepts of time and measurement, rather than on complex mathematics. *** ## 1. Why a Moving Clock Runs Slow (Time Dilation) The core reason for time dilation is not because there is some mysterious "slowing down" force affecting the clock; it's a fundamental consequence of the fact that **the speed of light ($c$) must be measured as constant by every single observer, no matter what they are doing.** Imagine you have two clocks: Clock A (at rest with Observer A) and Clock B (moving very fast relative to Observer A). For everything in physics, we assume that distance and time are fundamental dimensions. Time dilation shows us that these dimensions are not independent when motion is involved; they become interconnected. Here is the conceptual explanation using a thought experiment: **The Light Clock.** 1. **The Setup:** Imagine a very simple clock whe …
Excerpt — the full answer is on the round page.
▶ R55 · The double-slit experiment and wave-particle duality (conceptual, quantum mechanics) Open round →
## The Double-Slit Experiment Explained In plain, conceptual language, this experiment is less about "what particles are" and more about how **observation changes reality**. It's one of the most famously weird and counterintuitive experiments in modern physics. --- ### 1. The Setup: Particles Sent One at a Time (No Observation) When physicists fire single particles—like electrons or photons—at a barrier that has two narrow slits, they do not expect to see a wave pattern. They are expecting the results of tiny bullets passing through two openings. **The Expected Result (If they were just particles):** If these particles behaved like perfectly predictable little marbles, they would hit the screen in two distinct bands directly behind each slit. The pattern would be simple and localized. **The Actual Observation (The Surprising Part):** When the experiment is run in this mode—sending …
Excerpt — the full answer is on the round page.
▶ R56 · Double-slit interference, particle by particle Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Double Slit Interference</title>
<style>
body { background: #111; color: #eee; font-family: monospace; display: flex; justify-content: center; margin-top: 20px; }
canvas { border: 1px solid #333; background: #050505; }
#info { margin-left: 20px; font-size: 1.2em; line-height: 1.4; }
</style>
</head>
<body>
<canvas id="slitCanvas" width="900" height="300"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('slitCanvas');
const ctx = canvas.getContext('2d');
const infoDiv = document.getElementById('info');
let particlesDrawn = 0;
let runningParticles = [];
const MAX_PARTICLES = 5000; // Limit for simulation stability/performance
// Constants (Normalized to Canvas size)
const CANVAS_W = 900;
const SCREEN_X1 = CANVAS_W * 0.6; // Start of screen
const SLEET_WIDTH = 40;
const SLIT_S …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></head>
<body><canvas id="c"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
canvas.width = 800;
canvas.height = 600;
const N = 40;
const K_PASSES = 15;
const G = 0.3; // Gravity constant
const DT = 0.1; // Time step
let particles = [];
let constraints = [];
let impulseTimer = 0;
function init() {
for (let i = 0; i < N; i++) {
particles.push({ x: canvas.width / 2, y: 50 + (i * 12) });
}
// Anchor the ends (Particles 0 and N-1 are fixed or constrained to anchors)
const anchorA = { x: 100, y: 80 };
const anchorB = { x: canvas.width - 100, y: 80 };
// Initialize positions based on a slightly curved path
for (let i = 0; i < N; i++) {
particles[i].x = anchorA.x + (anchorB.x - anchorA.x) * (i / (N - 1));
particles[ …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</title></head><body style="margin: 0; background: #000;"><canvas id="c"></canvas><script>const c = document.getElementById('c');
const ctx = c.getContext('2d');
let W = 120, H = 90;
let CELL_SIZE = Math.min(window.innerWidth, window.innerHeight) / Math.max(W, H);
c.width = W * CELL_SIZE;
c.height = H * CELL_SIZE;
const DAMPING = 0.98;
const DX2 = 1;
const DY2 = 1;
let A = Array(H).fill(0).map(() => Array(W).fill(0)); // Current amplitude
let B = Array(H).fill(0).map(() => Array(W).fill(0)); // Next amplitude
let C = Array(H).fill(0).map(() => Array(W).fill(0)); // Previous amplitude
let pulseTimer = 0;
const PULSE_INTERVAL = 120;
function initialize() {
for (let i = 0; i < H; i++) {
for (let j = 0; j < W; j++) {
A[i][j] = B[i][j] = C[i][j] = 0.0;
}
}
}
function injectPulse(x, y, strength) …Excerpt — the full answer is on the round page.
▶ R59 · Billiard break with spin and friction Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Billiard Break</title>
<style>body{margin:0;overflow:hidden;background:#333}canvas{display:block}</style>
</head>
<body>
<canvas id="billiardsCanvas"></canvas>
<script>
const canvas = document.getElementById('billiardsCanvas');
const ctx = canvas.getContext('2d');
let W, H;
function setup() {
W = canvas.width = 800;
H = canvas.height = 500;
}
setup();
const R = 8;
const DAMPING = 0.995; // Rolling friction factor
const WALL_DAMPING = 0.85; // Energy loss on cushion bounce
let balls = [];
let frameCount = 0;
function createRack(startX, startY, spacing) {
balls = [];
for (let r = 0; r < 3; r++) {
for (let c = 0; c < 4; c++) {
// Creates a semi-rack pattern
if ((r + c) % 2 === 0) {
balls.push({ x: startX + c * spacing, y: startY - r * spacing, vx: (c === 3 ? 1 : 0), vy: (r === 0 …Excerpt — the full answer is on the round page.
▶ R60 · Dijkstra vs A* on a weighted grid Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Dijkstra vs A*</title></head>
<style>body {display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #111; color: white;}#container {display: flex; width: 92vw; max-width: 1200px;}canvas {border: 2px solid #444; box-shadow: 0 0 15px rgba(0,0,0,0.5);}#dijkstra {flex: 1;}#astar {flex: 1;}h3 {text-align: center; margin-top: 5px; color: #aaa;}</style>
<body><div id="container"><canvas id="dijkstra"></canvas><canvas id="astar"></canvas></div>
<script>
const C = window.innerWidth * 0.92 / 2 - 40; // Constant for canvas size calculation (adjusted for padding)
let GRID_W = 30;
let GRID_H = 20;
let CANVAS_SIZE = 600;
const cDijkstra = document.getElementById('dijkstra');
const cAstar = document.getElementById('astar');
cDijkstra.width = CANVAS_SIZE;
cDijkstra.height = CANVAS_SIZE;
cAstar.width = CANVAS_SIZE;
cAs …Excerpt — the full answer is on the round page.
▶ R61 · Convex hull built step by step Open round →
<!DOCTYPE html>
<html>
<head>
<title>Graham Scan Animation</title>
<style>body {margin:0;overflow:hidden;}canvas {display:block;background:#111;}</style>
</head>
<body>
<canvas id="c"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let W, H;
function initialize() {
W = canvas.width = 800;
H = canvas.height = 600;
if (window.innerWidth < 800 || window.innerHeight < 600) {
canvas.style.width = `${Math.min(800, window.innerWidth)}px`;
canvas.style.height = `${Math.min(600, window.innerHeight)}px`;
}
points = [];
for (let i = 0; i < 40; i++) {
points.push({x: Math.random() * W, y: Math.random() * H});
}
hullStack = [];
stepCounter = 0;
scanIndex = 0;
animationRunning = true;
drawPoints();
animate();
}
function crossProduct(p1, p2, p3) {
return (p2.x - p1.x) * …Excerpt — the full answer is on the round page.
▶ R62 · Huffman tree from letter frequencies Open round →
```html
<!DOCTYPE html>
<html>
<head><style>body{background:#111;margin:0;display:flex;justify-content:center;align-items:center;height:100vh;}canvas{border:1px solid #333;background:#222;}</style></head><body><canvas id="huffmanCanvas"></canvas><script>
const canvas = document.getElementById('huffmanCanvas');
const ctx = canvas.getContext('2d');
canvas.width = 900;
canvas.height = 600;
let F = "this is a fixed sample sentence for huffman coding visualization";
let nodeQueue, rootNode, stepCount = 0, maxSteps = 0;
let animationRunning = true;
function countFreq(text) {
const freq = {};
for (const char of text.toLowerCase()) {
if (/[a-z]/.test(char)) {
freq[char] = (freq[char] || 0) + 1;
}
}
return freq;
}
function Node(freq, char = null, left = null, right = null) {
this.freq = freq;
this.char = char;
this.left = left;
this.r …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's MST</title></head>
<body>
<canvas id="mstCanvas" width="800" height="600" style="display:block;"></canvas>
<script>
const canvas = document.getElementById('mstCanvas');
const ctx = canvas.getContext('2d');
let N = 25;
let nodes = [];
let edges = [];
let parent, rank;
let edgesToProcess = [];
let currentEdgeIndex = 0;
let acceptedEdgesCount = 0;
let totalWeight = 0;
let animationRunning = true;
function initGraph() {
nodes = Array.from({ length: N }, (_, i) => ({ x: Math.random() * canvas.width, y: Math.random() * canvas.height }));
edges = [];
for (let i = 0; i < N; i++) {
for (let j = i + 1; j < N; j++) {
const dx = nodes[i].x - nodes[j].x;
const dy = nodes[i].y - nodes[j].y;
const weight = Math.sqrt(dx * dx + dy * dy);
edges.push({ u: i, v: j, w: weight }); …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">
<title>N-Queens Solver</title>
<style>
body { display: flex; flex-direction: column; align-items: center; background-color: #222; color: white; font-family: monospace; }
canvas { border: 5px solid #333; margin-bottom: 10px; }
#info { font-size: 1.2em; margin-top: 10px; }
</style>
</head>
<body>
<h1>N-Queens Solver</h1>
<canvas id="board"></canvas>
<div id="info">Status: Initializing | Placements: 0 | Backtracks: 0</div>
<script>
const canvas = document.getElementById('board');
const ctx = canvas.getContext('2d');
const infoEl = document.getElementById('info');
let N, BOARD_SIZE;
let currentQueens = [];
let status = 'INIT'; // INIT, RUNNING, SOLVED
let animationFrameId = null;
function updateInfo(p …Excerpt — the full answer is on the round page.
▶ R65 · Delaunay triangulation, triangle by triangle Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Incremental Delaunay Triangulation</title>
<style>body {margin:0;overflow:hidden}canvas {display:block}</style>
</head>
<body>
<canvas id="delaunator"></canvas>
<script>
const canvas = document.getElementById('delaunator');
const ctx = canvas.getContext('2d');
let W, H;
function setup() {
W = canvas.width = window.innerWidth;
H = canvas.height = window.innerHeight - 10;
}
window.addEventListener('resize', () => { setup(); });
setup();
const NUM_POINTS = 30;
let points = [];
function generatePoints() {
points = [];
for (let i = 0; i < NUM_POINTS; i++) {
points.push({ x: Math.random() * W, y: Math.random() * H });
}
}
// Global state variables
let currentPointIndex = 0;
let triangles = [];
const MAX_ITERATIONS = NUM_POINTS + 100; // Safety limit
// Helper functions for geometry
function distSq(p1, p2) { return (p …Excerpt — the full answer is on the round page.
▶ R66 · AVL tree rebalancing with rotations Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Animated AVL Tree</title>
<style>
body { font-family: sans-serif; display: flex; flex-direction: column; align-items: center; background-color: #f4f4f9; }
#canvas { border: 1px solid #ccc; margin-top: 20px; background-color: white; }
#info { margin-top: 10px; padding: 10px; border: 1px solid #ddd; width: 80%; max-width: 600px; background: #eef; }
</style>
</head>
<body>
<h1>AVL Tree Insertion Simulation</h1>
<canvas id="canvas" width="900" height="500"></canvas>
<div id="info">Height: N/A | Rotations: 0</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const infoDiv = document.getElementById('info');
let keysToInsert = [];
let rotationCount = 0;
let isAnimating = false;
class Node { …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">
<title>Sieve of Eratosthenes Animation</title>
<style>
body { background: #111; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; color: white; font-family: monospace; }
canvas { border: 2px solid #444; background: #222; }
#status { margin-left: 30px; padding: 10px; background: #333; border-radius: 5px; width: 300px; }
</style>
</head>
<body>
<canvas id="sieveCanvas" width="600" height="240"></canvas>
<div id="status"></div>
<script>
const canvas = document.getElementById('sieveCanvas');
const ctx = canvas.getContext('2d');
const statusDiv = document.getElementById('status');
const MAX_N = 400;
const CANVAS_WIDTH = 600;
const CANVAS_HEIGHT = 240;
ctx.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
// …Excerpt — the full answer is on the round page.
▶ R68 · Edit-distance DP matrix with backtrace Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Levenshtein Matrix Animation</title>
<style>body {display: flex; justify-content: center; align-items: flex-start; padding-top: 20px; background: #111; color: #eee;} canvas {border: 2px solid #555;}</style>
</head>
<body id="container">
<canvas id="levCanvas" width="800" height="400"></canvas>
<div id="output" style="margin-left: 30px; font-family: monospace; white-space: pre;"></div>
<script>
const canvas = document.getElementById('levCanvas');
const ctx = canvas.getContext('2d');
const outputDiv = document.getElementById('output');
const WORDS = ["kitten", "sitting"]; // Using 6 letters, acceptable for demonstration
let M = WORDS[0].length;
let N = WORDS[1].length;
let matrix = Array(M + 1).fill(null).map(() => Array(N + 1).fill(0));
let history = []; // S …Excerpt — the full answer is on the round page.
▶ R69 · Replanning when the map changes Open round →
<!DOCTYPE html>
<html>
<head>
<title>Dynamic Pathfinding Robot</title>
<style>
body { background: #111; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 2px solid #333; background: #000; }
#stats { color: #fff; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font-family: monospace; }
</style>
</head>
<body>
<canvas id="gameCanvas"></canvas>
<div id="stats"></div>
<script>
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
const statsDiv = document.getElementById('stats');
const GRID_W = 30;
const GRID_H = 20;
const CELL_SIZE = 18;
canvas.width = GRID_W * CELL_SIZE;
canvas.height = GRID_H * CELL_SIZE;
let grid = [];
let robotPos = { x: 0, y: 0 };
let goalPos = { x: GRID_W - 1, y: GRID_H - 1 };
let currentPath = [];
let stepIndex = 0;
let stepsCount = 0;
let replanCoun …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>body { background: #111; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; flex-direction: column; color: white; } canvas { border: 1px solid #333; } .info { margin-top: 20px; font-family: monospace; }</style>
</head>
<body>
<canvas id="canvas" width="800" height="250"></canvas>
<div class="info">Target: <span id="target-display"></span> | Comparisons: <span id="comparisons">0</span></div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const ARRAY_SIZE = 40;
const BAR_WIDTH = (canvas.width - 30) / ARRAY_SIZE * 0.8;
const PADDING = 15;
let array = [];
let targetValue = 0;
let low = 0;
let high = ARRAY_SIZE - 1;
let comparisons = 0;
let animationFrameId = null;
let isSearch …Excerpt — the full answer is on the round page.
▶ R71 · Flood fill on a pixel grid Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Flood Fill Animation</title>
<style>body {background:#111;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0;color:white;}canvas {border:2px solid #333;}</style>
</head>
<body>
<canvas id="canvas" width="60"*50" height="40"*50"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let GRID_W = 60;
let GRID_H = 40;
let CELL_SIZE = 50 / 60; // Scale down slightly for fit
// Grid state: 0=Empty, 1=Target Color, 2=Filled
let grid = Array(GRID_H).fill(0).map(() => Array(GRID_W).fill(0));
let colorGrid = Array(GRID_H).fill(0).map(() => Array(GRID_W).fill(null));
function randomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
fu …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 Carving Animation</title>
<style>body { background: #111; display: flex; flex-direction: column; align-items: center; font-family: sans-serif; color: white; } canvas { border: 2px solid #333; margin-bottom: 20px; }#stats { width: 600px; display: flex; justify-content: space-around; padding: 10px 0; background: #222;}
</style>
</head>
<body>
<canvas id="mazeCanvas" width="600" height="400"></canvas>
<div id="stats"><div>Carved: <span id="carvedCount">0</span></div><div>Depth: <span id="stackDepth">1</span></div></div>
<script>
const canvas = document.getElementById('mazeCanvas');
const ctx = canvas.getContext('2d');
const COLS = 30;
const ROWS = 20;
const CELL_SIZE = 20;
const WALL_COLOR = '#000';
const PATH_COLOR = '#555';
const CURRENT_COLOR = 'rgba(255, 255, 0, 0.8)';
const STACK_COLOR …Excerpt — the full answer is on the round page.
▶ R73 · KMP string search with prefix table Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>KMP Animation</title>
<style>body { margin: 0; background: #111; display: flex; justify-content: center; align-items: center; height: 100vh; } canvas { border: 2px solid #333; background: #000; }</style>
</head>
<body>
<canvas id="kmpCanvas"></canvas>
<script>
const canvas = document.getElementById('kmpCanvas');
const ctx = canvas.getContext('2d');
// Constants for drawing
const P_LEN = 5; // Pattern length
const T_LEN = 100; // Text length
canvas.width = 900;
canvas.height = 100;
let text = "ABABDABACADABABCABAB";
let pattern = "ABABA";
let lps = [];
// State variables
let i = 0, j = 0; // Pointers for T and P
let comparisonCount = 0;
let matchFound = false;
let animati …Excerpt — the full answer is on the round page.
▶ R74 · Quadtree collision detection Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Quadtree Collision Demo</title>
<style>body { background: #111; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; } canvas { border: 2px solid #333; }</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth * 0.95;
canvas.height = window.innerHeight * 0.8;
class Ball { constructor(x, y) { this.x = x; this.y = y; this.r = 3 + Math.random() * 4; this.vx = (Math.random() - 0.5) * 2; this.vy = (Math.random() - 0.5) * 2; } update() { this.x += this.vx; this.y += this.vy; if (this.x < 0 || this.x > canvas.width) this.vx *= -1; this.x = Math.max(0, Math.min(canvas.width, this.x)); if (this.y < 0 || this.y > …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 Simulation</title>
<style>body { background: #111; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; } canvas { border: 2px solid #ccc; }</style>
</head>
<body>
<canvas id="sandCanvas" width="300" height="500"></canvas>
<script>
const canvas = document.getElementById('sandCanvas');
const ctx = canvas.getContext('2d');
const COLS = 150;
const ROWS = 100;
const CELL_SIZE = 2; // Scale factor for visualization
const GRID_WIDTH = Math.ceil(COLS * CELL_SIZE);
const GRID_HEIGHT = Math.ceil(ROWS * CELL_SIZE);
let grid = Array.from({ length: COLS }, () => new Array(ROWS).fill(0));
let stepCount = 0;
let restingCells = 0;
let running = true;
function …Excerpt — the full answer is on the round page.
▶ R76 · Falling sand as free particles Open round →
```html
<!DOCTYPE html>
<html>
<body><canvas id="sandCanvas"></canvas><script>
const canvas = document.getElementById('sandCanvas');
const ctx = canvas.getContext('2d');
let W, H;
// Simulation Constants
const N_PARTICLES = 1500;
const GRAVITY = 0.3;
const DAMPING = 0.85; // Energy loss on impact
const PILE_LIMIT = 5; // Collision check radius (squared for performance)
let particles = [];
let isRunning = true;
let settledCount = 0;
let maxPileHeight = 0;
// Particle Structure: [x, y, vx, vy, active]
class Particle {
constructor(x, y) {
this.p = [x, y]; // Position
this.v = [Math.random() * 2 - 1, Math.random() * -5]; // Velocity (some initial upward/lateral kick for variety)
this.active = true;
}
update(dt) {
if (!this.active) return;
// Apply Gravity
this.v[1] += GRAVITY * dt;
// Update Position
this.p[0] …Excerpt — the full answer is on the round page.
▶ R77 · Crowd leaving a room, cell by cell Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Crowd Simulation</title>
<style>body {display:flex;justify-content:center;align-items:center;height:100vh;background:#333;color:white;}canvas {border:2px solid #ccc;}</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let WIDTH = 40 * 15;
let HEIGHT = 30 * 15;
canvas.width = WIDTH;
canvas.height = HEIGHT;
const COORDS_W = 40;
const COORDS_H = 30;
const CELL_SCALE = 15;
const NUM_PEOPLE = 60;
let people = [];
let stepCount = 0;
function initializePeople() {
people = [];
for (let i = 0; i < NUM_PEOPLE; i++) {
people.push({
x: Math.floor(Math.random() * (COORDS_W - 10)) + 5,
y: Math.floor(Math.random() * (COORDS_H - 10)) + 5,
left: false
});
}
stepCount = 0;
}
function getTarget(x, y) { …Excerpt — the full answer is on the round page.
▶ R78 · Crowd leaving a room by steering Open round →
```html
<!DOCTYPE html>
<html><head><title>Crowd Simulation</title></head><style>body{margin:0;overflow:hidden;background:#111}canvas{display:block}</style><body><canvas id="c"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let W, H, agents, exitX, exitY, totalPeople = 60;
ctx.fillStyle = '#FFF';
function init() {
W = canvas.width = window.innerWidth;
H = canvas.height = window.innerHeight;
agents = [];
let lastId = 1;
for (let i = 0; i < totalPeople; i++) {
agents.push({
id: lastId++,
x: Math.random() * W,
y: Math.random() * H,
vx: (Math.random() - 0.5) * 1,
vy: (Math.random() - 0.5) * 1,
maxSpeed: 2 + Math.random(),
radius: 4 + Math.random() * 3,
isLeft: false
});
}
exitX = W * 0.9;
exitY = …Excerpt — the full answer is on the round page.
▶ R79 · Aggregation on a lattice Open round →
<!DOCTYPE html>
<html><head><title>DLA Simulation</title></head><body style="margin:0;overflow:hidden;"><canvas id="dlaCanvas" width="400" height="300"></canvas><script>
const canvas = document.getElementById('dlaCanvas');
const ctx = canvas.getContext('2d');
let GRID_W = 200;
let GRID_H = 150;
let CELL_SIZE = 2;
let grid, clusterSize;
let seedX, seedY;
function initialize() {
grid = Array(GRID_H).fill(0).map(() => Array(GRID_W).fill(0));
clusterSize = 1;
seedX = Math.floor(GRID_W / 2);
seedY = Math.floor(GRID_H / 2);
// Set the seed cell (value 1)
grid[seedY][seedX] = 1;
}
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (let y = 0; y < GRID_H; y++) {
for (let x = 0; x < GRID_W; x++) {
if (grid[y][x] === 1) {
ctx.fillStyle = 'rgba(0, 150, 255, 0.8)';
ctx.fillRect(x * CELL_SIZE, …Excerpt — the full answer is on the round page.
▶ R80 · Aggregation by continuous drift Open round →
<!DOCTYPE html>
<html><body><canvas id="c"></canvas><script>const canvas = document.getElementById('c');const ctx = canvas.getContext('2d');let W=window.innerWidth;let H=window.innerHeight;canvas.width=W;canvas.height=H;const N=800;const STICK_RADIUS=5;const DT=0.98;const CENTER={x:W/2,y:H/2};let particles=[];let stuckCount=0;function init(){particles=[];stuckCount=0;for(let i=0;i<N;i++){particles.push({x:(Math.random()*W),y:(Math.random()*H),vx:(Math.random()-0.5)*0.5,vy:(Math.random()-0.5)*0.5,stuck:false});}requestAnimationFrame(loop)}function update(){for(let i=0;i<N;i++){const p=particles[i];if(!p.stuck){const dx=CENTER.x-p.x;const dy=CENTER.y-p.y;const distSq=dx*dx+dy*dy;const pullForce=1/(distSq+500);p.vx+=dx*pullForce*0.005;p.vy+=dy*pullForce*0.005;}p.vx*=DT;p.vy*=DT;p.x+=p.vx;p.y+=p.vy;const targetDist=(Math.hypot(CENTER.x-p.x,CENTER.y-p.y));if(targetDist<STICK_RADIUS*2){p.stuck …Excerpt — the full answer is on the round page.
▶ R81 · Flocking birds with three rules Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Boids Simulation</title>
<style>body { margin: 0; overflow: hidden; background-color: #111; } canvas { display: block; }</style>
</head>
<body>
<canvas id="boidCanvas"></canvas>
<script>
const canvas = document.getElementById('boidCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let birds = [];
// Simulation Parameters
const NUM_BIRDS = 200;
const MAX_SPEED = 3.5;
const MAX_FORCE = 0.1;
const SEPARATION_WEIGHT = 1.5;
const ALIGNMENT_WEIGHT = 1.0;
const COHESION_WEIGHT = 1.0;
function resize() {
W = canvas.width = window.innerWidth;
H = canvas.height = window.innerHeight;
}
window.addEventListener('resize', resize);
resize();
class Bird {
constructor(x, y) {
this.pos = { x: x, y: y };
this.vel = { x: Math.random() * 2 - 1, y: Math.random() * 2 - 1 };
this.acc = { x: 0, y: 0 };
}
applyForc …Excerpt — the full answer is on the round page.
▶ R82 · Conway's Game of Life with seeded patterns Open round →
```html
<!DOCTYPE html>
<html><head><title>Game of Life</title></head><style>body{background:#111;display:flex;justify-content:center;align-items:center;height:100vh;margin:0;color:#fff;font-family:monospace;}canvas{border:2px solid #333;}</style></head><body><canvas id="gameCanvas" width="600" height="480"></canvas><script>
const C = document.getElementById('gameCanvas');
const CTX = C.getContext('2d');
let W = 120, H = 80; // Grid dimensions
let CELL_SIZE = Math.min(600 / W, 480 / H);
// State grids: [age, alive]
let gridA = Array(W).fill(0).map(() => Array(H).fill([1, false]));
let gridB = Array(W).fill(0).map(() => Array(H).fill([1, false]));
let currentGrid, nextGrid;
let generation = 0;
const MAX_AGE = 50; // Max age for color cycling
function initGrids() {
currentGrid = gridA;
nextGrid = gridB;
}
// Helper to get cell state safely (handles boundaries)
function getStat …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{background:#111;margin:0;overflow:hidden}.canvas{display:block}</style></head><body onload="init()"><canvas id="c" width="600" height="400"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let animationFrameId;
// Global state
let phaseOffset = 0;
let epicycles = [];
let history = [];
const MAX_HISTORY = 500;
function init() {
history = [];
epicycles = [];
phaseOffset = Math.random() * Math.PI * 2;
drawFourier(10); // Use 10 coefficients for the epicycle chain
animate();
}
// Calculates Fourier coefficients (approximated) and sets up epicycles
function drawFourier(N) {
epicycles = [];
const L = canvas.width;
const H = canvas.height;
let s …Excerpt — the full answer is on the round page.
▶ R84 · Voronoi cells with moving seeds Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Voronoi Animation</title>
<style>body {margin:0;display:flex;justify-content:center;align-items:center;min-height:100vh;background:#111;}canvas {border:2px solid #444;}</style>
</head>
<body>
<canvas id="voronoiCanvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('voronoiCanvas');
const ctx = canvas.getContext('2d');
let seeds = [];
let velocities = [];
let W = canvas.width;
let H = canvas.height;
function init() {
seeds = [];
velocities = [];
for (let i = 0; i < 25; i++) {
seeds.push({ x: Math.random() * W, y: Math.random() * H });
velocities.push({ vx: (Math.random() - 0.5) * 0.5, vy: (Math.random() - 0.5) * 0.5 });
}
}
functio …Excerpt — the full answer is on the round page.
▶ R85 · Travelling salesman improved by 2-opt Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>TSP 2-Opt Optimization</title>
<style>
body { background: #111; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: sans-serif; color: white; }
canvas { border: 1px solid #333; background: #000; }
#info { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #ccc; font-size: 1.2em; }
</style>
</head>
<body>
<canvas id="tspCanvas" width="800" height="600"></canvas>
<div id="info">Length: 0 | Improvements: 0</div>
<script>
const canvas = document.getElementById('tspCanvas');
const ctx = canvas.getContext('2d');
const infoDiv = document.getElementById('info');
let points = [];
let tourPathIndices = []; // Stores the indices of cities in order
let currentLength = 0;
let improvementsCount = 0;
let isOptimizingPass = false;
l …Excerpt — the full answer is on the round page.
▶ R86 · Scrolling terrain from value noise Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Infinite Noise Landscape</title></head>
<body style="margin:0; overflow:hidden;"><canvas id="c"></canvas><script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let W, H;
let offsetX = 0;
function resize() {
W = window.innerWidth;
H = window.innerHeight;
c.width = W;
c.height = H;
}
window.addEventListener('resize', resize);
resize();
// Simple seeded pseudo-random number generator (for consistent noise generation)
let seed = Math.random() * 10000;
function rand(x, y) {
let s = x * 34527 + y * 59621 + seed;
s ^= s >>> 18;
return (s / 0x100000000);
}
// Interpolation function: smoothstep
function smooth(t) { return t * t * t * (t * (t * 6 - 15) + 10); }
// Perlin/Value Noise implementation for a single point (x, y)
function noise(x, y) {
let X = Math.floor(x);
let Y = Math.floor(y …Excerpt — the full answer is on the round page.
▶ R87 · Gray-Scott reaction-diffusion Open round →
```html
<!DOCTYPE html>
<html><head><title>Gray-Scott Simulation</title></head><body style="background:#000;margin:0;"><canvas id="c"></canvas><script>
const N = 128;
let canvas, ctx;
let bufferA = new Float32Array(N * N); // A chemical concentration
let bufferB = new Float32Array(N * N); // B chemical concentration
let nextBufferA = new Float32Array(N * N);
let nextBufferB = new Float32Array(N * N);
// Parameters (Tuning for visible patterns)
const DA = 0.16;
const DB = 0.08;
const FEED_RATE = 0.055; // k
const KILL_RATE = 0.004; // m
let stepCount = 0;
function initialize() {
canvas = document.getElementById('c');
ctx = canvas.getContext('2d');
canvas.width = N * 3;
canvas.height = N * 3;
// Seed the center with high B concentration (the catalyst)
const center = Math.floor(N / 2);
for (let i = 0; i < N * N; i++) {
bufferA[i] = 1.0; // Start A …Excerpt — the full answer is on the round page.
▶ R88 · L-system tree growing in wind Open round →
```html
<!DOCTYPE html>
<html><head><title>L-System Tree</title></head><style>body{margin:0;overflow:hidden;background:#111}{canvas{display:block}}#status{position:absolute;top:10px;left:10px;color:#ccc;font-family:monospace;padding:5px;background:#000b1133;border-radius:5px}</style><body><canvas id="treeCanvas"></canvas><div id="status">Generating...</div><script>
const canvas = document.getElementById('treeCanvas');
const ctx = canvas.getContext('2d');
let W, H;
function resize() {W=canvas.width=window.innerWidth;H=canvas.height=window.innerHeight;ctx.fillStyle='#000';ctx.fillRect(0,0,W,H); }
window.addEventListener('resize',resize);
resize();
const L_RULES = ['F', 'FF+[+F%-]']; // A classic fractal rule
let currentString = '';
let generation = 0;
let maxGenerations = 6;
let branchesDrawn = 0;
let isBuilding = true;
let animationTime = 0;
struct State {
x: number, y: number, angl …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 Tracer</title><style>body{margin:0;overflow:hidden}canvas{display:block}</style></head><body onload="init()"><canvas id="c"></canvas><script>
let c, ctx;
const COORDS = { W: 800, H: 600 };
const GRID_RES = 32; // Grid size (N x N)
const THRESHOLD = [0.5, 1.0, 1.5];
let metaballs = [];
let animationFrameId = null;
function init() {
c = document.getElementById('c');
ctx = c.getContext('2d');
c.width = COORDS.W;
c.height = COORDS.H;
resetState();
}
function resetState() {
metaballs = [];
for (let i = 0; i < 4; i++) {
metaballs.push({ x: Math.random() * COORDS.W, y: Math.random() * COORDS.H, r: 80 + Math.random() * 50 });
}
if (animationFrameId) cancelAnimationFrame(animationFrameId);
animate();
}
function metaballField(x, y) {
let sum = 0; …Excerpt — the full answer is on the round page.
▶ R90 · Poisson-disk sampling, Bridson's algorithm Open round →
```html
<!DOCTYPE html>
<html><head><title>Poisson Disk Sampling</title></head><body style="margin:0;overflow:hidden;"><canvas id="c"></canvas><script>
const c=document.getElementById('c');
const ctx=c.getContext('2d');
let W, H;
let grid, active=[];
let max_dist;
let count=0;
let running=true;
function init() {
W=H=window.innerWidth;
c.width=W;
c.height=H;
grid=new Map();
active=[];
count=0;
running=true;
}
init();
function getGridKey(x, y) {
const gx=Math.floor((x/max_dist));
const gy=Math.floor((y/max_dist));
return `${gx},${gy}`;
}
function setPoint(x, y, r) {
ctx.beginPath();
ctx.arc(x, y, r, 0, Math.PI*2);
ctx.fillStyle=rgba(0,150,255,0.8);
ctx.fill();
}
function isSafe(px, py) {
const gx=Math.floor((px/max_dist));
const gy=Math.floor((py/max_dist));
const key=`${gx},${gy}`;
if (!grid.has(key)) return tru …Excerpt — the full answer is on the round page.
▶ R91 · Starfield tunnel in perspective Open round →
<!DOCTYPE html>
<html>
<head>
<title>Starfield</title>
<style>body {margin:0;overflow:hidden;}canvas{display:block;background-color:#000;}</style>
</head>
<body>
<canvas id="starCanvas"></canvas>
<script>
const canvas = document.getElementById('starCanvas');
const ctx = canvas.getContext('2d');
let width, height;
function resize() {
width = window.innerWidth;
height = window.innerHeight;
canvas.width = width;
canvas.height = height;
}
window.addEventListener('resize', resize);
resize();
const NUM_STARS = 300;
let stars = [];
let speed = 0.05; // Speed factor for movement
class Star {
constructor() {
this.reset();
}
reset() {
// Initial position far away (large negative Z)
this.z = Math.random() * -1000 - 100;
// Random horizontal spread (-W/2 to W/2)
this.x = (Math.random() - 0.5) * width * 2;
// Random vert …Excerpt — the full answer is on the round page.
▶ R92 · Rotating wireframe solids with depth sorting Open round →
```html
<!DOCTYPE html>
<html><head><style>body{margin:0;overflow:hidden}canvas{display:block}</style></head><body id="b"><canvas id="c" width="800" height="600"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let angleX = 0;
let angleY = 0;
// Define vertices and edges for the Cube (A) and Octahedron (B)
// Vertices are relative to a center point.
const V_A = [[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], [-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]];
const E_A = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4], [0, 4], [1, 5], [2, 6], [3, 7]];
const V_B = [[0, 1, 0], [-1, 0, 1], [0, -1, 0], [1, 0, -1], [0, 1, 0]];
// Note: For the octahedron, we'll reuse some points and define connectivity based on a simple structure.
const V_B_full = [[0, 1, 0], [-1, 0, 1], [0, -1, 0], [1, 0, -1], [0, 1, 0]]; // Adjusted for …Excerpt — the full answer is on the round page.
▶ R93 · Rotating wireframe height field Open round →
```html
<!DOCTYPE html>
<html>
<body><canvas id="c"></canvas><script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let W = 800;
let H = 600;
c.width = W;
c.height = H;
let GRID_SIZE = 25; // NxN grid
let STEP = 1.0;
// Camera/Scene parameters
const CAMERA_DISTANCE = 8.0;
const SCALE = 0.3;
let time = 0;
let angleX = 0;
let angleY = 0;
let lastTime = 0;
function setup() {
time = Math.random() * 100;
angleX = Math.PI / 4 + Math.random() * Math.PI / 2;
angleY = Math.random() * Math.PI;
lastTime = performance.now();
}
// Smooth height function: H(x, z)
function getHeight(x, z, t) {
let h = Math.sin(x * 0.5 + t * 0.2) * Math.cos(z * 0.3 + t * 0.1);
return h * 0.8;
}
// Project (x, y, z) to screen coordinates (x', y')
function project(p) {
let x = p[0];
let y = p[1] + p[2]; // Height acts as Y relative to ground plane
let z …Excerpt — the full answer is on the round page.
▶ R94 · Raycast maze walkthrough Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Auto Maze Raycaster</title></head>
<body>
<canvas id="c" width="640" height="320"></canvas>
<script>
const C = document.getElementById('c');
const ctx = C.getContext('2d');
// --- Configuration ---
const MAP_W = 10;
const MAP_H = 8;
const TILE_SIZE = 64;
const WALL_THICKNESS = 1; // Assume 1 unit thick walls
// Maze: 1=Wall, 0=Path
let maze = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 1, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 1, 0, 1, 1, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 1, 0, 1],
[1, 0, 1, 1, 1, 1, 0, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
// Camera State
let cam = { x: TILE_SIZE * 1.5, y: TILE_SIZE * 1.5, angle: Math.PI / 2 }; // Start at (1.5, 1.5), facing South
const SECTOR_SIZE = 640;
// --- Utility Functions ---
function checkWall(x, y) {
let mapX = Math.floor((x + TILE_SIZE / …Excerpt — the full answer is on the round page.
▶ R95 · Shaded sphere by painter's algorithm Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Spherical Mesh Renderer</title></head>
<body style="background-color:#000;margin:0;overflow:hidden;"><canvas id="c" width="600" height="600" style="display:block;"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let points = [];
let rotationAngleA = 0;
let rotationAngleB = 0;
const POINT_COUNT = 800;
function init() {
points = [];
for (let i = 0; i < POINT_COUNT; i++) {
// Generate uniform points on a unit sphere using spherical coordinates
let phi = Math.acos(Math.random() * 2 - 1); // Inclination angle [0, pi]
let theta = Math.random() * 2 * Math.PI; // Azimuthal angle [0, 2pi]
const R = 150; // Sphere radius for drawing
points.push({
x: R * Math.sin(phi) * Math.cos(theta),
y: R * Math.sin(phi) * Math.sin(theta), …Excerpt — the full answer is on the round page.
▶ R96 · Force-directed graph settling Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Force Simulation Graph</title>
<style>
body {margin:0;overflow:hidden;background:#111;}canvas {display:block;border:1px solid #333;}</style>
</head>
<body>
<canvas id="graphCanvas"></canvas>
<script>
(function() {
const canvas = document.getElementById('graphCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let N = 25;
let nodes = [];
let edges = [];
let isRunning = true;
let FRAME_COUNT = 0;
// Physics constants
const K_SPRING = 0.01; // Spring constant (Attraction)
const REPULSION_COEFF = 2000; // Repulsion strength
const DAMPING = 0.98; // Velocity damping factor
const MAX_VELOCITY = 3;
function resizeCanvas() {
W = canvas.width = window.innerWidth * 0.95;
H = canvas.height = window.innerHeight * 0.85;
}
function initGraph() {
nodes = []; …Excerpt — the full answer is on the round page.
▶ R97 · Circle packing without overlap Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Circle Packing Simulation</title>
<style>
body {margin:0;overflow:hidden;background:#222;}
canvas {display:block;}
</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let W, H;
let circles = [];
let isRunning = true;
function resize() {
W = H = window.innerWidth;
c.width = W;
c.height = H;
}
window.addEventListener('resize', resize);
resize();
let state = { count: 0, area: 0 };
function drawMetrics() {
ctx.fillStyle = 'white';
ctx.font = '12px Arial';
ctx.fillText(`Circles: ${state.count}`, 10, 20);
ctx.fillText(`Coverage: ${(state.area * 100).toFixed(1)}%`, W - 150, 20);
}
function draw() {
ctx.clearRect(0, 0, W, H);
circles.forEach(c => {
// Color based on radius (normalized for visual effect)
const hu …Excerpt — the full answer is on the round page.
▶ R98 · Squarified treemap of changing data Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Animated Treemap</title>
<style>
body { margin: 0; overflow: hidden; background-color: #f0f0f0; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="treemapCanvas"></canvas>
<script>
(function() {
const canvas = document.getElementById('treemapCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let items = [];
let animationFrameId = null;
let lastWeights = [];
// --- Core Treemap Logic ---
/** Calculates the optimal target dimensions for all weights recursively (Squarified layout) */
function calculateLayout(weights, x0, y0, w0, h0) {
if (weights.length === 0) return null;
let totalWeight = weights.reduce((sum, w) => sum + w, 0);
const rootItem = { targetW: w0, targetH: h0, targetX: x0, targetY: y0, weight: totalWeight, children: [], color: '#ccc', name: …Excerpt — the full answer is on the round page.
▶ R99 · Three sorting algorithms racing Open round →
```html
<!DOCTYPE html>
<html><head><title>Sorting Race</title></head><style><body background:#111;color:white><canvas id="canvas" width="900" height="400"></canvas><div style="width:900px;margin-top:20px;"></div><div id="stats">Bubble: 0 | Insertion: 0 | QuickSort: 0</div></body></style></head><body>
<canvas id="canvas" width="900" height="400"></canvas><script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const statsDiv = document.getElementById('stats');
let bars;
let state = { finished: false, progress: 1 };
let algorithms = [];
// --- Core Utilities ---
function shuffle(arr) {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
return [...arr];
}
function generateInitialData() {
let data = Array.from({ length: 60 }, () => Math.flo …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>Flow Dynamics</title>
<style>body {margin: 0;overflow: hidden;background: #111}canvas {display: block;}</style>
</head>
<body>
<canvas id="sankeyCanvas"></canvas>
<script>
const canvas = document.getElementById('sankeyCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let SourceNodes = [
{ name: "A", x: 0.1, y: 0.33 },
{ name: "B", x: 0.5, y: 0.16 },
{ name: "C", x: 0.9, y: 0.33 }
];
let TargetNodes = [
{ name: "D", x: 0.1, y: 0.75 },
{ name: "E", x: 0.3, y: 0.82 },
{ name: "F", x: 0.6, y: 0.9 },
{ name: "G", x: 0.9, y: 0.75 }
];
// Connections: [SourceIndex][TargetIndex] -> FlowValue (A->D, A->E, ..., C->G)
let Flows = [];
const NUM_SOURCES = SourceNodes.length;
const NUM_TARGETS = TargetNodes.length;
function init() {
W = canvas.width = window.innerWidth; …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 { background: #222; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; flex-direction: column; font-family: monospace; color: white; }
canvas { border: 1px solid #555; background-color: black; }
</style>
</head>
<body>
<canvas id="grid"></canvas>
<div id="steps">Step: 0</div>
<script>
const canvas = document.getElementById('grid');
const ctx = canvas.getContext('2d');
const stepsDisplay = document.getElementById('steps');
const COLS = 150;
const ROWS = 150;
const CELL_SIZE = 4;
canvas.width = COLS * CELL_SIZE;
canvas.height = ROWS * CELL_SIZE;
let grid = [];
let ant = {};
let stepCount = 0;
let anima …Excerpt — the full answer is on the round page.
▶ R102 · Rule 110 growing line by line Open round →
```html
<!DOCTYPE html>
<canvas id="caCanvas"></canvas><script>
const canvas = document.getElementById('caCanvas');
const ctx = canvas.getContext('2d');
let gridRows = []; // Stores the active rows for calculation (L, C, R)
let rowCount = 0; // Total steps/rows calculated
let scrollOffset = 0; // Vertical position of the drawn pattern's top edge
let frameId = null;
// Rule 110 lookup table: Index is LCR binary value. Value is next state.
const RULE_110 = [0, 1, 1, 1, 0, 1, 1, 0];
function calculateNextRow(currentRow) {
const N = currentRow.length;
if (N === 0) return [];
let nextRow = new Array(N + 2).fill(0); // Allow for potential expansion/padding
// Pad the row with assumed '0' boundaries if necessary, though calculation handles this by iterating over valid indices
for (let i = 1; i < N + 1; i++) {
const L = parseInt(currentRow[i - 1]);
co …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"/><title>Wireworld Simulator</title><style>body{background:#000;display:flex;justify-content:center;align-items:center;height:100vh;margin:0;font-family:monospace}canvas{border:1px solid #333;background:#111}#info{position:absolute;top:20px;right:20px;color:#fff;text-shadow:0 0 5px rgba(0,0,0,0.8);}</style></head><body><canvas id="wireworld"></canvas><div id="info">Step: 0<br>Electrons: 0</div><script>
const canvas = document.getElementById('wireworld');
const ctx = canvas.getContext('2d');
let GRID_SIZE = 75;
let CELL_SIZE = 8;
canvas.width = GRID_SIZE * CELL_SIZE;
canvas.height = GRID_SIZE * CELL_SIZE;
// States: 0=Empty, 1=Conductor, 2=Head, 3=Tail
let grid = [];
let stepCount = 0;
// Helper function for toroidal boundary conditions
function getNeighbor(x, y) {
const nx = (x + Math.floor(Math.random() * 3) - 1 + …Excerpt — the full answer is on the round page.
▶ R104 · Abelian sandpile toppling Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Abelian Sandpile</title>
<style>body{background:#111;color:white;font-family:monospace;display:flex;flex-direction:column;align-items:center;margin:0;}#canvas{border:1px solid #333;}</style>
</head>
<body>
<canvas id="canvas" width="600" height="600"></canvas>
<div>Grains Dropped: <span id="grains_dropped">0</span> | Topplings: <span id="topplings">0</span></div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let GRID_SIZE = 50; // 50x50 grid, cell size 12px (600/50)
const CELL_SIZE = canvas.width / GRID_SIZE;
let grid = [];
let droppedGrainsCount = 0;
let topplingCount = 0;
let animationFrameId;
function initializeGrid() {
grid = Array(GRID_SIZE).fill(0 …Excerpt — the full answer is on the round page.
▶ R105 · Brian's Brain Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Brian's Brain CA</title>
<style>body{background:#111;display:flex;justify-content:center;align-items:center;height:100vh;margin:0;color:white;font-family:monospace}canvas{border:1px solid #333;}</style>
</head>
<body>
<canvas id="caCanvas"></canvas><div id="info">Gen: 0 | Live: 0</div>
<script>
const canvas = document.getElementById('caCanvas');
const ctx = canvas.getContext('2d');
let N = 128; // Grid size N x N
canvas.width = N * 4;
canvas.height = N * 4;
// States: 0=Off, 1=Dying, 2=On
const C = { OFF: 0, DYING: 1, ON: 2 };
let GridA, GridB;
let generation = 0;
const colors = {
[C.OFF]: '#111',
[C.DYING]: '#444',
[C.ON]: '#0ff'
};
const cell_size = 4; …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 Tile Animation</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: #111; }
canvas { border: 1px solid #333; }
#info { position: absolute; top: 20px; color: white; font-family: monospace; z-index: 10; }
</style>
</head>
<body>
<canvas id="c"></canvas>
<div id="info">Grid: 12x12 | Flips: 0</div>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let CANVAS_SIZE = 640;
canvas.width = CANVAS_SIZE;
canvas.height = CANVAS_SIZE;
const GRID_W = 12;
const GRID_H = 12;
const TILE_SIZE = CANVAS_SIZE / GRID_W;
let tiles = [];
let flipCount = 0;
let animationFrameId = …Excerpt — the full answer is on the round page.
▶ R107 · Hilbert curve drawing itself Open round →
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>Hilbert Curve</title></head><body style="background:#111;margin:0;"><canvas id="curveCanvas" width="600" height="600" style="border:1px solid #333;display:block;"></canvas><script>
const canvas = document.getElementById('curveCanvas');
const ctx = canvas.getContext('2d');
let N_ORDER = 5;
let POINTS = [];
let CURRENT_POINT_INDEX = 0;
let IS_RUNNING = false;
function hilbert(index, order) {
let x = index;
let y = 0;
for (let i = 1; i <= order; i++) {
let M = 2;
let mask = Math.floor(M / 2);
let h = (x ^ y) & mask;
let x_new, y_new;
if (h == 0) { // (y, y) -> (y, y)
x_new = x;
y_new = y;
} else if (h == 1) { // (x, y) -> (x, x+y)
x_new = x ^ y; …Excerpt — the full answer is on the round page.
▶ R108 · Interlocking star pattern on a grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Islamic Star Grid</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #000; }
canvas { border: 1px solid #333; }
</style>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let rotationAngle = 0;
let animationFrameId = null;
let gridInfo = {};
// Configuration parameters
const GRID_SIZE = 15; // N x M cells
const CELL_WIDTH = c.width / (GRID_SIZE + 1);
const CELL_HEIGHT = c.height / (Math.floor(c.height / c.width) * (GRID_SIZE + 1));
// Function to initialize or re-initialize the pattern state
function initPat …Excerpt — the full answer is on the round page.
▶ R109 · Moire from two rotating rasters Open round →
<!DOCTYPE html>
<html>
<head>
<title>Moiré Effect Canvas</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #111; }
canvas { border: 1px solid #333; }
#info { color: white; position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-family: monospace; font-size: 14px; }
</style>
</head>
<body>
<canvas id="moireCanvas" width="600" height="600"></canvas>
<div id="info">Angle: 0.00° | Offset: 0.00</div>
<script>
const canvas = document.getElementById('moireCanvas');
const ctx = canvas.getContext('2d');
const infoDisplay = document.getElementById('info');
let startTime;
let animationFrameId;
function drawRaster(ctx, centerX, centerY, radius, frequencyScale, colorStart) {
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
for (le …Excerpt — the full answer is on the round page.
▶ R110 · Penrose-style aperiodic tiling growing Open round →
<!DOCTYPE html>
<html><head><title>Aperiodic Tiling</title><style>body{background:#111;margin:0;overflow:hidden}canvas{display:block}</style></head><body onload="init()">
<canvas id="c"></canvas>
<script>
const c=document.getElementById('c');
const ctx=c.getContext('2d');
let g=0;
let tiles=[];
let running=true;
function init(){
c.width=window.innerWidth;
c.height=window.innerHeight;
tiles=[[]]; // Initial empty seed structure
g=0;
running=true;
requestAnimationFrame(loop);
}
// Simple helper function to draw a single rhombus (quadrilateral defined by 4 points)
function drawRhombus(p1, p2, p3, p4){
ctx.fillStyle='#4CAF50'; // Green fill
ctx.strokeStyle='#2E7D32'; // Darker border
ctx.lineWidth=1;
ctx.beginPath();
ctx.moveTo(p1[0],p1[1]);
ctx.lineTo(p2[0],p2[1]);
ctx.lineTo(p3[0],p3[1]);
ctx.lineTo(p4[0],p4[1]);
ctx.closePath( …Excerpt — the full answer is on the round page.
▶ R111 · Ant colony laying pheromone trails Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Ant Colony Simulation</title></head>
<body><canvas id="c"></canvas><script>const c=document.getElementById('c');c.width=800;c.height=600;const ctx=c.getContext('2d');let A=[],Pouse=new Map(),FOOD_LOC={x:750,y:50},NEST_LOC={x:50,y:550};const PheromoneDecay=0.98;const MaxPheromone=100;const AntCount=25;let FoodCarried=0;function init() {A=[];for(let i=0;i<AntCount;i++)A.push({x:Math.random()*c.width,y:Math.random()*c.height,vx:Math.cos(Math.random()*Math.PI)*2+(Math.random()*4-2),vy:Math.sin(Math.random()*Math.PI)*2+(Math.random()*4-2),dir:Math.atan2(Math.sin(i*0.5)*10,Math.cos(i*0.5)*10)});A.forEach(a=>{a.energy=1;a.food=0;});Pouse.clear();for(let x=0;x<80;x++)for(let y=0;y<60;y++){Pouse.set(`${x},${y}`,Math.random()*5);}FoodCarried=0;ctx.clearRect(0,0,c.width,c.height);draw();requestAnimationFrame(loop)}function draw() {ctx.fillStyle='#333';ctx …Excerpt — the full answer is on the round page.
▶ R112 · Physarum slime-mould network Open round →
```html
<!DOCTYPE html><html><head><title>Physarum Simulation</title></head><body style="margin:0;overflow:hidden"><canvas id="c"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let W, H;
let agents = [];
let trailMap;
let stepCount = 0;
const NUM_AGENTS = 300; // Reduced from "thousands" for character limit safety/performance
const TRAIL_SIZE = 50;
const FADE_RATE = 0.98;
function setup() {
W = canvas.width = window.innerWidth * 0.95;
H = canvas.height = window.innerHeight * 0.95;
canvas.style.width = `${W}px`;
canvas.style.height = `${H}px`;
trailMap = Array(Math.ceil(W / TRAIL_SIZE)).fill(0).map(() => Array(Math.floor(H / TRAIL_SIZE)).fill(0));
agents = [];
for (let i = 0; i < NUM_AGENTS; i++) {
agents.push({ x: Math.random() * W, y: Math.random() * H, vx: Math.cos(Math.random() * 2 * Math.PI) * …Excerpt — the full answer is on the round page.
▶ R113 · Predator and prey on a shared field Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Predator-Prey Simulation</title>
<style>
body {background: #111; display: flex; justify-content: center; align-items: center; margin: 0;}
canvas {border: 2px solid #333; background: #000; }
#stats {color: white; font-family: monospace; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 10px; background: rgba(0,0,0,0.7); border-radius: 5px;}
</style>
</head>
<body>
<canvas id="gameCanvas" width="800" height="600"></canvas>
<div id="stats"></div>
<script>
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
const statsDiv = document.getElementById('stats');
let W = canvas.width;
let H = canvas.height;
let prey = [];
let predators = [];
let food = [];
// Constants
const MAX_PREY = 150;
const MIN_PREY = 20;
const INITIAL_PREDATORS = 7;
const PREDATOR_ENERGY_DECAY = 0.03;
cons …Excerpt — the full answer is on the round page.
▶ R114 · Traffic jam from nothing Open round →
<!DOCTYPE html>
<html><head><title>NS Traffic Simulation</title><style>body{margin:0;background:#111;overflow:hidden}canvas{display:block}</style></head><body onload="init()"> <canvas id="c"></canvas><script>var c=document.getElementById('c');var ctx=c.getContext('2d');ctx.canvas.width=800;ctx.canvas.height=400;var L=100; // Road length (discrete units) var V_max=5; var N=30; // Number of cars var P=0.05; // Random slow down probability
var cars=[];var lastTime=0;
function init(){
cars=[];
for(let i=0;i<N;i++){
let pos=Math.floor((i/N)*L);
let speed=1+Math.floor(Math.random()*V_max);
cars.push({x:pos,v:speed});
}
lastTime=performance.now();
animate();
}
function update(){
const t=Date.now();
if(!lastTime){lastTime=t;}
var dt=Math.min(1/30,(t-lastTime)/16); // Scaling factor for smoother updates
lastTime=t;
for(let i=0;i<N …Excerpt — the full answer is on the round page.
▶ 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; overflow: hidden; background: #111; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="crowdCanvas"></canvas>
<script>
const canvas = document.getElementById('crowdCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let agents = [];
let goal = { x: canvas.width * 0.15, y: canvas.height / 2 }; // Narrow exit location
const AGENT_COUNT = 400;
const REPULSION_DIST = 30;
const ATTRACTION_STRENGTH = 0.005;
const MAX_SPEED = 2.5;
const REFILL_INTERVAL = 100; // Frames until refill attempt
let flowRateCount = 0;
let lastRefreshTime = performance.n …Excerpt — the full answer is on the round page.
▶ R116 · Bresenham circles and lines, pixel by pixel Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Pixel Drawing Animation</title></head>
<body><canvas id="c"></canvas><script>
const c=document.getElementById('c');
c.width=400;c.height=400;
const ctx=c.getContext('2d');
let data=ctx.getImageData(0,0,400,400);
let pixels=data.data;
function setPixel(x,y,r,g,b){
if(x<0 || x>399 || y<0 || y>399) return false;
const i=(y*400+x)*4;
pixels[i+0]=r;
pixels[i+1]=g;
pixels[i+2]=b;
return true;
}
// Bresenham Line Algorithm (Midpoint)
function drawLine(x0,y0,x1,y1,r,g,b,px,py){
let dx=Math.abs(x1-x0),dy=Math.abs(y1-y0);
let xinc = Math.sign(x1-x0), yinc = Math.sign(y1-y0);
if(dx>dy){
let p=2*dy-dx;
for(let i=0;i<dx;i++){
let x=x0+i*xinc,y=y0+(Math.round((i*(2*dy-dx)/dx))*yinc);
setPixel(x,y,r,g,b);
}
}else{
let p=2*dx-dy;
for(let i=0;i<dy;i++){ …Excerpt — the full answer is on the round page.
▶ R117 · De Casteljau construction of a Bezier curve Open round →
```html
<!DOCTYPE html>
<html><head><title>De Casteljau Animation</title></head><body style="background:#111;margin:0;"><canvas id="c" width="800" height="600" style="display:block;"></canvas><script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let P = []; // Control Points [x, y]
let time = 0;
let animationFrameId = null;
function initPoints(seed) {
P[0] = [Math.random() * 150 + seed*10 % 100, Math.random() * 200 + seed*20 % 20];
P[1] = [Math.random() * 400 - 100 + seed*30 % 50, Math.random() * 300 + seed*40 % 30];
P[2] = [Math.random() * 550 - 100 + seed*60 % 50, Math.random() * 250 + seed*80 % 20];
P[3] = [Math.random() * 700 - 100 + seed*90 % 50, Math.random() * 100 + seed*10 % 10];
}
function updatePoints(t) {
const offsetX = Math.sin(time * 0.0005 + 1) * 150;
const offsetY = Math.cos(time * 0.0003 + 2) * 80;
// Drift b …Excerpt — the full answer is on the round page.
▶ R118 · Sutherland-Hodgman polygon clipping Open round →
```html
<!DOCTYPE html>
<html><head><title>SH Clipping</title></head><body style="background-color:#111;margin:0;"><canvas id="c"></canvas><script>const c=document.getElementById('c');const ctx=c.getContext('2d');c.width=600;c.height=400;let p={x:50,y:50,angle:0};function init(){p={x:Math.random()*100+100,y:Math.random()*100+100,angle:0};}function draw(t){ctx.clearRect(0,0,600,400);const W=100;const H=150;let orig=[];for(let i=0;i<7;i++){orig.push({x:p.x+Math.cos(t*0.02+(i/3))*W+Math.sin(t*0.01)*i%2*10, y:p.y+Math.sin(t*0.02+(i/3))*H-Math.cos(t*0.01)*i%2*10})}ctx.strokeStyle='#444';ctx.lineWidth=1;ctx.beginPath();orig.forEach((v,i)=>{if(i===0)ctx.moveTo(v.x,v.y);else ctx.lineTo(v.x,v.y);});ctx.closePath();ctx.stroke();const clip=[[20,20],[580,20],[580,380],[20,380]];let vertices=orig;let currentVertices=vertices;let countBefore=vertices.length;let history=[];// --- Clipping Logic Start - …Excerpt — the full answer is on the round page.
▶ R119 · Floyd-Steinberg dithering a gradient Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Floyd-Steinberg Dithering</title></head>
<body><canvas id="c"></canvas><div id="s"></div><script>
const c = document.getElementById('c');
const s = document.getElementById('s');
let ctx = null;
// Constants for the simulation
const W = 256;
const H = 256;
const PALETTE_SIZE = 16; // Max brightness levels (0-15)
c.width = W;
c.height = H;
ctx = c.getContext('2d');
// Precompute the palette (simple linear ramp for greyscale)
let P = [];
for(let i=0; i<PALETTE_SIZE; i++) {
P[i] = Math.floor(i * 16); // 0, 16, 32, ..., 240 (approximation of brightness levels)
}
// Global state variables
let frameCount = 0;
let imageData = null;
let data = new Uint8ClampedArray(W * H * 4);
function generateImageData() {
imageData = ctx.getImageData(0, 0, W, H);
data = imageData.data;
}
function drawFrame() {
if (!ctx) return;
let t = frame …Excerpt — the full answer is on the round page.
▶ R120 · Scanline fill of a self-intersecting polygon Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Scanline Fill</title></head>
<body><canvas id="c"></canvas><script>const c=document.getElementById('c');const ctx=c.getContext('2d');c.width=800;c.height=600;let p=[{x:150,y:300},{x:400,y:150},{x:700,y:350},{x:250,y:500},{x:50,y:400}];let v=0;const E=Math.PI/6;function init(){p=[{x:150,y:300},{x:400,y:150},{x:700,y:350},{x:250,y:500},{x:50,y:400}];v=0;ctx.clearRect(0,0,800,600)}function updateP(){p[0].x=150 + 100*Math.sin(v);p[0].y=300+50*Math.cos(v/2);p[1].x=400+150*Math.sin(v*0.8);p[1].y=150;p[2].x=700-50*Math.cos(v*0.5);p[2].y=350+100*Math.sin(v*0.2);p[3].x=250+80*Math.cos(v*1.2);p[3].y=500-70*Math.sin(v*0.9);p[4].x=50+100*Math.sin(v*0.6);p[4].y=400;v+=0.01}function intersect(p1,p2,y){if(Math.abs(p1.y-p2.y)<1e-6)return null;let x=p1.x+(p2.x-p1.x)*(y-p1.y)/(p2.y-p1.y);return Math.max(Math.min(Math.max(x,0),0),800)}function drawScanline(){ctx. …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">
<title>A* Search Visualization</title>
<style>
body { background: #222; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: Arial, sans-serif; color: white; }
#container { display: flex; padding: 20px; background: #111; border-radius: 8px; box-shadow: 0 0 15px rgba(0, 255, 0, 0.3); }
canvas { border: 4px solid #4CAF50; background: #0d0d0d; }
#stats { margin-left: 20px; padding: 10px; background: #222; border-radius: 5px; min-width: 180px; }
h3 { margin-top: 0; color: #4CAF50; }
</style>
</head>
<body>
<div id="container">
<canvas id="aStarCanvas"></canvas>
<div id="stats">
<h3>Stats</h3>
<p>Nodes Expanded: <span id="expandedCount">0</span></p>
<p>Path Length: <span id="pathLength">N/ …Excerpt — the full answer is on the round page.
▶ R122 · Randomized maze generation via recursive backtracking Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Maze Generator</title>
<style>
body { background: #000; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 2px solid white; image-rendering: pixelated; }
</style>
</head>
<body>
<canvas id="mazeCanvas"></canvas>
<script>
const canvas = document.getElementById('mazeCanvas');
const ctx = canvas.getContext('2d');
let COLS = 30;
let ROWS = 20;
let CELL_SIZE = 15;
// Canvas dimensions must account for cell centers and walls
canvas.width = (COLS * 2 + 1) * CELL_SIZE;
canvas.height = (ROWS * 2 + 1) * CELL_SIZE;
let mazeGrid = []; // Stores visited status and parent connections
let stack = [];
let carvedCount = 0;
let isRunning = true;
// Initialize the grid structure: 0=unvisi …Excerpt — the full answer is on the round page.
▶ R123 · Breadth-first flood fill spreading through a region Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>BFS Flood Fill Animation</title>
<style>
body { background: #111; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; font-family: monospace; color: white; }
canvas { border: 2px solid #333; image-rendering: pixelated; }
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let COLS = 60;
let ROWS = 40;
let CELL_SIZE = 10;
canvas.width = COLS * CELL_SIZE;
canvas.height = ROWS * CELL_SIZE;
let grid = [];
let distanceMap = [];
let isRunning = false;
let stepCount = 0;
let filledCells = 0;
let totalReachable = 0;
let queue = [];
function initGrid( …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">
<title>Dijkstra Visualization</title>
<style>body { background: #111; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; } canvas { border: 2px solid #444; }</style>
</head>
<body><canvas id="dijkstraCanvas"></canvas><script>
const canvas = document.getElementById('dijkstraCanvas');
const ctx = canvas.getContext('2d');
let N = 30; // Grid size N x N
let S, T; // Source and Target coordinates
let grid; // Cost map
let dist; // Distance map (Dijkstra's distances)
let prev; // Predecessor map for path reconstruction
let settledCount = 0;
let animationRunning = false;
canvas.width = N * 15;
canvas.height = N * 15;
function generateGrid() {
grid = [];
dist = Array(N).fill(0).map(() => Array(N).fill(Infinity));
prev = Array(N).fill(0).map(() => Array( …Excerpt — the full answer is on the round page.
▶ R125 · Voronoi diagram growing by multi-source flood fill Open round →
```html
<!DOCTYPE html>
<html>
<head><title>Voronoi Flood Fill</title></head>
<body style="margin:0;overflow:hidden;"><canvas id="voronoiCanvas" width="800" height="600" style="display:block;background:#111;"></canvas><script>
let canvas = document.getElementById('voronoiCanvas');
let ctx = canvas.getContext('2d');
const W = canvas.width;
const H = canvas.height;
const GRID_SIZE = 30; // Cells per side (e.g., 30x30 grid)
const CELL_W = W / GRID_SIZE;
const CELL_H = H / GRID_SIZE;
let grid, seeds, queue, animationRunning = true;
let cellsClaimedCount = 0;
function initGrid() {
grid = [];
for (let y = 0; y < GRID_SIZE; y++) {
grid[y] = [];
for (let x = 0; x < GRID_SIZE; x++) {
grid[y][x] = null; // null means unclaimed
}
}
}
function scatterSeeds(count) { …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">
<title>Bubble Sort Visualization</title>
<style>
body { background: #1a1a2e; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: sans-serif; color: white; }
#visualization { display: flex; flex-direction: column; align-items: center; }
canvas { border: 1px solid #3c3c6e; background: #2a2a4a; }
</style>
</head>
<body>
<div id="visualization">
<canvas id="canvas" width="800" height="350"></canvas>
<p id="info">Comparisons: 0 | Status: Ready</p>
</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const infoEl = document.getElementById('info');
let bars = [];
let N = 80; // Number of bars
let B_WIDTH = 10;
let maxVal = canvas.height * 0.95;
/ …Excerpt — the full answer is on the round page.
▶ R127 · Quicksort partitioning around glowing pivots Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Quicksort Visualization</title>
<style>body { background: #111; display: flex; justify-content: center; align-items: center; margin: 0; height: 100vh; color: white; font-family: sans-serif; } canvas { border: 1px solid #333; }</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let N = 80;
const BAR_WIDTH = (canvas.width - 1) / N;
let arr = [];
let swaps = 0;
let animationFrameId = null;
// State tracking for visualization
let low_p = 0, high_p = N - 1; // Current partition range
let pivot_index = -1; // Index of the current pivot
let isSorting = false;
function initArray() {
arr = Array.from({ length: N }, () => Math.floor(Math.random() * 200) + 50);
swaps = 0;
}
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height); …Excerpt — the full answer is on the round page.
▶ R128 · Merge sort weaving runs together Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Merge Sort Animation</title>
<style>
body { margin: 0; overflow: hidden; background-color: #111; }
canvas { display: block; }
#info { position: absolute; top: 10px; left: 10px; color: white; font-family: monospace; z-index: 10;}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div id="info">Pass: 0 | Run Length: N/A</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let W, H;
let bars;
let A = []; // Array holding bar heights (values)
let active = true;
let infoElement = document.getElementById('info');
const NUM_BARS = 80;
const BAR_WIDTH = Math.min(1, W / NUM_BARS);
const INITIAL_HEIGHT = 50;
let mergeState = { …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">
<title>Heap Sort Visualization</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; background-color: #111; color: white; font-family: monospace; }
canvas { border: 1px solid #333; background-color: #222; }
</style>
</head>
<body>
<canvas id="heapCanvas" width="800" height="400"></canvas>
<script>
const C = document.getElementById('heapCanvas');
const CTX = C.getContext('2d');
let A;
let N, W, H;
let swapCount = 0;
let state = 'INIT'; // INIT, BUILD_HEAP, SORTING, COMPLETE
let heapSize = 0;
let currentSwapIndices = [];
const BAR_WIDTH = 8;
const PADDING = 10;
function initialize(arr) {
A = arr;
N = A.length;
W = …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>
<head><title>LSD Radix Sort Visualization</title></head>
<body style="margin:0;overflow:hidden"><canvas id="sortCanvas" width="800" height="600"></canvas><script>
const canvas = document.getElementById('sortCanvas');
const ctx = canvas.getContext('2d');
let bars = [];
const NUM_BARS = 80;
const MAX_HEIGHT = 500;
const BAR_WIDTH = (canvas.width - 1) / NUM_BARS;
function initializeBars() {
bars = Array(NUM_BARS).fill(0).map(() => Math.floor(Math.random() * MAX_HEIGHT) + 5);
}
let state = {
currentPass: -1,
digitPlace: 0, // Represents the current power of 10 (1, 10, 100...)
isRunning: false,
animationFrameId: null
};
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const maxVal = Math.max(...bars);
const scaleFactor = canvas.heigh …Excerpt — the full answer is on the round page.
▶ R131 · Weekday riddle from two clues Open round →
Today is **Sunday**. *Justification:* If the day after tomorrow is two days before Thursday, that means the day after tomorrow is Tuesday. Counting back two days from Tuesday reveals that tomorrow must be Monday, making today Sunday.
▶ R132 · Fermi estimate: a lifetime of drinking water Open round →
Assumptions: Daily intake $\approx$ 2.5 L/day; Lifespan $\approx$ 70 years.
Calculation: $2.5 \text{ L/day} \times 365 \text{ days/year} \times 70 \text{ years}$
Total Volume $\approx$ 63,875 liters
64,000▶ R133 · Three friends, three pets Open round →
Ana owns the parrot because her allergy prevents her from owning the dog or cat due to animal fur. Ben cannot own the dog, as its owner must be older than him, leaving him with the cat since his pet cannot fly. This means Cleo must own the remaining pet, the dog. Therefore, Ana has the parrot, Ben has the cat, and Cleo has the dog.
▶ R134 · Smallest number from three remainders Open round →
This problem requires finding the smallest positive integer $N$ that satisfies a system of congruences, which can be solved using techniques related to the Chinese Remainder Theorem.
We are given:
1. $N \equiv 1 \pmod{3}$
2. $N \equiv 2 \pmod{5}$
3. $N \equiv 3 \pmod{7}$
**Step 1: Combine the first two congruences.**
From (1), $N = 3k + 1$. Substituting this into (2):
$3k + 1 \equiv 2 \pmod{5}$
$3k \equiv 1 \pmod{5}$
To solve for $k$, we multiply by the inverse of 3 modulo 5. Since $3 \times 2 = 6 \equiv 1 \pmod{5}$, we use 2:
$2(3k) \equiv 2(1) \pmod{5}$
$6k \equiv 2 \pmod{5}$
$k \equiv 2 \pmod{5}$
Thus, $k = 5j + 2$. Substituting this back into the expression for $N$:
$N = 3(5j + 2) + 1$
$N = 15j + 7$
This means $N \equiv 7 \pmod{15}$.
**Step 2: Incorporate the third congruence.**
We use the result $N = 15j + 7$, and apply condition (3):
$15j + 7 \equiv 3 \pmod{7}$
Simplify modul …Excerpt — the full answer is on the round page.
▶ R135 · Conditional dice probability Open round →
The total number of outcomes where at least one die shows a 4 (Event $A$) is 11. The outcomes are those pairs $(D_1, D_2)$ where $D_1=4$ or $D_2=4$.
We are interested in the event that the dice sum to 9 (Event $B$). We need to find the outcomes common to both $A$ and $B$, which is $A \cap B$. The pairs summing to 9 are $(3, 6), (4, 5), (5, 4), (6, 3)$. Among these, only $(4, 5)$ and $(5, 4)$ contain a 4.
Thus, $|A \cap B| = 2$. The conditional probability $P(B|A)$ is the ratio of favorable outcomes in the restricted sample space:
$$P(\text{Sum}=9 | A) = \frac{|A \cap B|}{|A|} = \frac{2}{11}$$
**Answer:** $\frac{2}{11}$▶ R136 · Double pendulum tracing a chaotic path Open round →
```html
<!DOCTYPE html>
<html><head><title>Chaotic Double Pendulum</title></head><body style="margin:0;overflow:hidden"><canvas id="c"></canvas><script>const c=document.getElementById('c');const ctx=c.getContext('2d');c.width=800;c.height=600;let t=0,t_max=15;let x={};function init(){x.ang1=Math.random()*Math.PI*2;x.ang2=Math.random()*Math.PI*2;x.cos1=Math.cos(x.ang1);x.sin1=Math.sin(x.ang1);x.cos2=Math.cos(x.ang2);x.sin2=Math.sin(x.ang2);}}init();function update(){let L1=W=L2;let m1=M=m2=0.5;let d=c.width/4;let delta_a=x.ang1-x.ang2;let cA=Math.cos(delta_a);let sA=Math.sin(delta_a);let a1_dot,a2_dot,a1_ddot,a2_ddot;let d1=L1*m1;let d2=L1+L2;let w1=Math.cos(x.ang1)*d1;let w2=Math.sin(x.ang1)*d1;let x_p={};for(let i=0;i<3000;i++){if(t>t_max){init();t=0;}const L1=W=L2;const m1=M=m2=0.5;const d=c.width/4;let a1=x.ang1,a2=x.ang2;let cA=Math.cos(a1-a2);let sA=Math.sin(a1-a2);let delta_t=0.016 …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><title>Physics Cloth Simulation</title><style>body {margin:0;overflow:hidden;background:#111}canvas {display:block}</style></head><script>
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
let W, H;
const COLS = 15;
const ROWS = 10;
const P_DENSITY = 1.0; // Initial spacing
const SIM_STEPS = 6; // Constraint passes per frame
const WIND_STRENGTH_BASE = 0.02;
let pos, prevPos, isFixed, constraints, windAmplitude = 0;
function init() {
W = canvas.width = window.innerWidth * 0.8;
H = canvas.height = window.innerHeight * 0.7;
canvas.style.width = W + 'px';
canvas.style.height = H + 'px';
pos = [];
prevPos = [];
isFixed = [];
constraints = [];
for (let r = 0; r < ROWS; r++) {
for (let c = 0; c < COLS; c++) {
const i = r * COLS + …Excerpt — the full answer is on the round page.
▶ R138 · Two-source wave interference pattern Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Wave Interference Simulation</title>
<style>
body { margin: 0; background: #000; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
canvas { border: 1px solid #333; }
</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let W, H;
let S1 = { x: 0, y: 0 };
let S2 = { x: 0, y: 0 };
let t = 0;
let D_start = 0; // Initial separation distance
function setup() {
W = H = 800;
c.width = W;
c.height = H;
t = 0;
D_start = Math.random() * (W / 4) + (W / 8); // Initial separation between W/8 and W/2
S1 = { x: W / 4, y: H / 2 };
S2 …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>
<title>N-Body Gravity Simulation</title>
<style>body { margin: 0; overflow: hidden; background: #000; } canvas { display: block; } </style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let width, height;
function init() {
width = window.innerWidth;
height = window.innerHeight;
c.width = width;
c.height = height;
}
window.addEventListener("resize", init);
init();
class Body {
constructor(x, y, m, vx, vy) {
this.pos = { x: x, y: y };
this.vel = { x: vx, y: vy };
this.acc = { x: 0, y: 0 };
this.mass = m;
this.radius = Math.max(2, Math.pow(m, 1/3));
this.color = `hsl(${Math.random() * 360}, 80%, ${50 + m*5}%)`;
this.trail = [];
}
applyForce(ax, ay) {
this.acc.x += ax;
this.acc. …Excerpt — the full answer is on the round page.
▶ R140 · Water sloshing in a tilting container Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Sloshing Water Simulation</title>
<style>
body { margin: 0; overflow: hidden; background-color: #111; display: flex; justify-content: center; align-items: center; height: 100vh; }
canvas { border: 1px solid #333; background-color: #222; }
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let W, H;
let particles = [];
const NUM_PARTICLES = 200;
// Physics constants
const GRAVITY_STRENGTH = 0.15;
const REPULSION_RANGE = 6;
const COHESION_STRENGTH = 0.03;
const DAMPING = 0.98;
const BOUNCE_ELASTICITY = 0.7;
// Gravity tilt parameters
let currentAngle = 0; // Radians
const MAX_TILT_DEGREES = Math.PI / 4; // Tilt up to 45 degrees
let timeOffset = 0;
function init() {
W = canvas.width = 700;
H = canvas.height = 600;
particles = []; …Excerpt — the full answer is on the round page.
▶ R141 · Idiom-dense German into natural English Open round →
That was a total waste of effort—now we're in a bind, but giving up is not an option.
▶ R142 · Register shift: casual complaint into formal Open round →
Subject: Complaint Regarding Defective Blender [Order Number, if known] Dear Customer Service Team, I am writing to report that the blender received in my recent order malfunctioned after only two days of use. The unit ceased operation and displayed visible sparking, suggesting a significant defect. As this appliance is clearly faulty, I request immediate resolution. Please advise on the process for either receiving a full refund or obtaining a prompt replacement unit. I look forward to your swift action regarding this matter. Sincerely, [Your Name]
▶ R143 · Bureaucratic German into plain English Open round →
To receive the benefit, you must submit a fully completed application by the deadline. Otherwise, your claim will expire.
▶ R144 · English apology into idiomatic Sie-German Open round →
Wir sind hier mit diesem Punkt fehlgeschlagen – das sagen wir ganz offen. Aber wir werden es wiedergutmachen, und das wird Sie keinen Cent kosten.
▶ R145 · False-friend minefield German into English Open round →
We might have to reschedule the current appointment; this is a sensitive topic, and I don't want to stir up trouble.
▶ 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. 241.47 2. 1001, 1003, 1006 3. 1005 and 268.50
▶ R149 · Extract meeting invite into a fixed JSON schema Open round →
```json
{
"title": "Q3 Roadmap Kickoff",
"date": "2026-08-18",
"time": "10:30",
"location": "Conference Room B, Berlin office (3rd floor)",
"attendees": [
"Sarah",
"Tom",
"Priya"
]
}
```▶ R150 · Diff two near-identical config blocks Open round →
timeout: 30 -> 45 debug: false -> true max_connections: 100 -> 150
▶ R151 · Binary search tree growing node by node Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>BST Animation</title>
<style>
body { background: #111; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }
canvas { border: 1px solid #333; background: #222; }
</style>
</head>
<body>
<canvas id="bstCanvas"></canvas>
<script>
const canvas = document.getElementById('bstCanvas');
const ctx = canvas.getContext('2d');
let nodeCount = 0;
let tree = null;
let animationState = {};
let frameId = null;
// Configuration
const CANVAS_WIDTH = 900;
const CANVAS_HEIGHT = 650;
canvas.width = CANVAS_WIDTH;
canvas.height = CANVAS_HEIGHT;
// BST Node structure
function TreeNode(val) {
this.value = val;
this.left = null;
this.right = null;
this.parent = null;
}
// Utility function to generate random unique integers (10-30 range for a compact tree)
function getRandomArray(count) {
const set = new Se …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 Simulation</title></head>
<body><canvas id="c"></canvas><script>const c = document.getElementById('c');const ctx = c.getContext('2d');c.width=800;c.height=450;const NUM_BUCKETS=12;let buckets=[];let totalKeys=0;let animationRunning=true;let lastKey=null;
function initBuckets() {
buckets = Array(NUM_BUCKETS).fill(null).map(() => []);
totalKeys = 0;
}
function hash(key) {
return key % NUM_BUCKETS;
}
function updateLoadFactor() {
const loadFactor = totalKeys / NUM_BUCKETS;
ctx.fillStyle = `rgba(0,0,0,0.7)`;
ctx.fillRect(10, 10, 200, 30);
ctx.fillStyle='#fff';
ctx.font='14px monospace';
ctx.fillText(`Load Factor: ${loadFactor.toFixed(2)}`, 20, 25);
}
function drawBucketColor(bucket) {
if (bucket.length === 0) return 'rgba(144, 238, 144, 0.6)'; // Light Green
if (bucket.length < 3) return 'r …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><title>Heap Animation</title></head><body style="margin:0;overflow:hidden;"><canvas id="heapCanvas" width="800" height="600"></canvas><script>
const canvas = document.getElementById('heapCanvas');
const ctx = canvas.getContext('2d');
let heap = [];
let isAnimating = false;
let animationState = {};
const NODE_RADIUS = 15;
const LEVEL_HEIGHT = 60;
const MAX_NODES = 100;
function getCoords(index) {
if (index < 0 || index >= heap.length) return null;
let i = index;
let level = 0;
while (i > 0 && i % 2 === 0) {
i /= 2;
level++;
}
let nodeIndexAtLevel = Math.floor(index / Math.pow(2, level));
let x = (nodeIndexAtLevel - ((Math.pow(2, level)) - 1) / 2) * 80 + (canvas.width / 4);
let y = LEVEL_HEIGHT * level;
return { x: Math.m …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><title>Ring Buffer Animator</title></head><body style="display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #222;"><canvas id="ringCanvas" width="600" height="300" style="border: 1px solid #444;"></canvas><script>
const canvas = document.getElementById('ringCanvas');
const ctx = canvas.getContext('2d');
let N = 20; // Number of slots
let centerX = canvas.width / 2;
let centerY = canvas.height / 2 + 30;
let radius = Math.min(canvas.width, canvas.height) * 0.4;
let slotAngleStep = (Math.PI * 2) / N;
// State variables
let slots = new Array(N).fill(false); // true = filled, false = empty
let pIndex = 0; // Producer pointer index
let cIndex = 0; // Consumer pointer index
let lastTime = performance.now();
// Rates (slower movement for visibility)
let pRate = Math.random() * 0.01 + 0.005;
let cRate = Math.rand …Excerpt — the full answer is on the round page.
▶ R155 · Linked list with animated pointer relinking Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Animated Linked List</title>
<style>body {margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: #222; color: #eee;} #canvasContainer {border: 1px solid #444;}</style>
</head>
<body>
<div id="canvasContainer" style="width: 95%; max-width: 1000px;">
<canvas id="listCanvas"></canvas></div>
<script>
const canvas = document.getElementById('listCanvas');
const ctx = canvas.getContext('2d');
let L;
let HEAD_NODE;
let NODE_WIDTH = 80;
let NODE_HEIGHT = 40;
let SPACING = 30;
let CANVAS_WIDTH, CANVAS_HEIGHT;
class Node {
constructor(value) {
this.value = value;
this.next = null;
this.x = 0;
this.y = 0;
}
}
class LinkedList {
constructor() {
this.head = null;
this.length = 0;
this.animationState = { active: false, targetX: 0, targetY: 0, c …Excerpt — the full answer is on the round page.
▶ R156 · Invent 3 product names + taglines for a fictional object (no superlatives) Open round →
1. BagKeeper Clip — Seals your favorite snacks for longer enjoyment. 2. SnackStand Seal — Keeps bags upright and contents fresh. 3. Silicone GripSaver — Easy sealing, simple storage solution.
▶ R157 · Rewrite the same product text for two different audiences, facts unchanged Open round →
(a) Teenagers: You need this bottle! It holds a massive 750 ml and keeps your drinks icy for a full 12 hours, no matter what. Plus, it's made from BPA-free plastic and comes with a built-in straw so staying hydrated is zero effort. Best of all, it’s super easy to clean—it’s dishwasher-safe—and you can pick your favorite vibe from 4 cool colors. (b) Seniors: This AquaGlow bottle offers reliable hydration, holding 750 ml and ensuring your beverages stay cold for up to 12 hours. It is constructed from safe, BPA-free plastic and includes a convenient built-in straw for easy drinking. The maintenance is simple since it is dishwasher-safe, and you have the choice of 4 lovely colors to match your home decor.
▶ R158 · 5 email subject lines under 50 chars, no clickbait, no ALL-CAPS Open round →
1. Jackets sale, app feedback, and returns updated 2. Winter savings + free returns info 3. Update your experience (and save on jackets!) 4. App survey: Help us improve + new return policy 5. Save 20% on winter gear & learn about returns
▶ R159 · Micro-story: exactly 50 words (±5) with 3 mandatory elements Open round →
The rain soaked the platform. My red umbrella offered little comfort as the train whistle wailed past—a definite miss. Alone now, staring at the harbor, I felt adrift. The distant lighthouse beam cut through the gloom, a steady promise guiding me toward a different life, away from this station's regretful melancholy.
▶ R160 · Critique a generic slogan in 2 sentences + give 2 better alternatives Open round →
The phrase "Quality You Can Trust" is overly generic and interchangeable with nearly any durable goods brand, failing entirely to address the unique needs of an outdoor audience. It makes no specific claim about portability, power output, or ruggedness—the core concerns for campers and hikers. 1. Powering your journey, off-grid. 2. Reliable charge for remote trails.
▶ R161 · Selection sort vs shell sort racing side by side Open round →
```html
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>Sort Race</title><style>body{display:flex;margin:0;align-items:center;justify-content:center;height:100vh;background:#222}#container{width:95%;max-width:1200px;display:flex;gap:10px}canvas{border:1px solid #444;background:#111}</style></head><body id=""><div id="container"><canvas id="canvas1" width="600" height="350"></canvas><canvas id="canvas2" width="600" height="350"></canvas></div><script>
const C1 = document.getElementById('canvas1');
const C2 = document.getElementById('canvas2');
const CTX1 = C1.getContext('2d');
const CTX2 = C2.getContext('2d');
let A; // Shared Array
let N = 30; // Number of elements
let ANIMATING = true;
let SORTED_STATE = false;
// Selection Sort State (Left)
let SEL_I = 0, SEL_MIN_IDX = 0, SEL_J = 1;
let SEL_SWAP_PENDING = { swap: null, step: 0 };
// Shell Sort State (Right)
let SH …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">
<title>BFS Maze Animation</title>
<style>body {background: #111; color: #eee; font-family: monospace;} canvas {border: 2px solid white; display: block; margin: 20px auto;}#info {text-align: center; width: 400px;}</style>
</head>
<body>
<canvas id="mazeCanvas" width="600" height="375"></canvas>
<div id="info">Visited: <span id="visitedCount">0</span></div>
<script>
const canvas = document.getElementById('mazeCanvas');
const ctx = canvas.getContext('2d');
const visitedSpan = document.getElementById('visitedCount');
// Grid dimensions (approx 20x15)
const COLS = 20;
const ROWS = 15;
const CELL_SIZE = 30;
let grid = [];
let start, goal;
let visitedNodes = new Set();
let pathParent = {}; // Key: "r,c", Value: …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">
<title>Prim's MST Animation</title>
<style>
body { background: #1e1e2f; color: #ccc; font-family: Arial, sans-serif; display: flex; justify-content: center; margin-top: 20px; }
#container { display: flex; gap: 30px; max-width: 95%; }
canvas { border: 1px solid #444; background: #2a2a3e; }
#info { width: 250px; padding: 10px; background: #2a2a3e; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.3); }
h3 { color: #6c9fe4; margin-top: 0; }
</style>
</head>
<body>
<div id="container">
<canvas id="graphCanvas" width="800" height="600"></canvas>
<div id="info">
<h3>Status</h3>
<p id="stepCount">Step: 0/25</p>
<p id="totalWeight">Total Weight: 0.0</p>
<hr style="border-color: #444;">
<h4>Algorithm Steps</h4> …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 lang="en">
<head>
<meta charset="UTF-8">
<title>Boids Simulation</title>
<style>body {margin:0;overflow:hidden;background:#111}canvas {display:block;border:1px solid #333;}</style>
</head>
<body>
<canvas id="boidCanvas"></canvas>
<script>
const canvas = document.getElementById('boidCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let NUM_BOIDS = 60;
let MAX_SPEED = 3;
let NEIGHBOR_RADIUS = 50;
let SEPARATION_DISTANCE = 15;
let COHESION_WEIGHT = 1.0;
let ALIGNMENT_WEIGHT = 1.0;
let SEPARATION_WEIGHT = 2.0;
class Vector {
constructor(x, y) {
this.x = x || 0;
this.y = y || 0;
}
add(v) { return new Vector(this.x + v.x, this.y + v.y); }
sub(v) { return new Vector(this.x - v.x, this.y - v.y); }
mult(s) { return new Vector(this.x * s, this.y * s); }
magSq() { return this.x * this.x + this.y * this.y; } …Excerpt — the full answer is on the round page.
▶ R165 · Recursive backtracker carving a maze, then solving it Open round →
```html
<!DOCTYPE html>
<head><title>Animated Maze Solver</title></head>
<body><canvas id="mazeCanvas" width="600" height="480"></canvas><script>
const canvas = document.getElementById('mazeCanvas');
const ctx = canvas.getContext('2d');
const COLS = 25;
const ROWS = 18;
const CELL_SIZE = Math.min(Math.floor(canvas.width / (COLS + 1)), Math.floor(canvas.height / (ROWS + 1)));
let grid = [];
let visited = Array(ROWS).fill(0).map(() => Array(COLS).fill(false));
let stack = [];
let isGenerating = false;
let isSolving = false;
let carvedCount = 0;
let solveSteps = 0;
function initGrid() {
grid = Array(ROWS).fill(0).map(() => Array(COLS).fill(false)); // 0: Wall, 1: Path
visited = Array(ROWS).fill(0).map(() => Array(COLS).fill(false));
stack = [];
carvedCount = 0;
solveSteps = 0;
for (let r = 0; r < ROWS; r++) {
for (let c = 0; c < COLS; c++) {
g …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 is officially moving to Monday mornings starting next week, and Tom must send out the updated calendar invite reflecting this change by end of day Friday. Regarding ticket labeling, the team adopted Priya's new five-label system, and she will update the shared labeling guide document by Wednesday. Finally, the discussion about the office plant budget was deferred until the following meeting.
▶ R167 · One-sentence TL;DR under 25 words Open round →
The legacy /v1/reports API endpoint will shut down; migrate to the new /v3/reports endpoint by September 30, 2026.
▶ R168 · Extract action items as a checklist Open round →
1. Maria -- finalize and send new homepage copy to Ben -- by this Thursday 2. Ben -- provide feedback on homepage copy -- by Friday 3. Chen -- push contact form fix -- by Monday 4. Maria -- chase the client for new logo colors confirmation -- today 5. Ben -- send updated privacy policy draft to legal -- by next Wednesday
▶ R169 · Neutral summary of a biased product rant Open round →
The blender jug leaks liquid from around the base seal when filled above the halfway mark. Additionally, speeds 4 through 7 operate identically, limiting the functional range of speed settings. Finally, the motor automatically shuts off after approximately 90 seconds of continuous blending due to overheating.
▶ R170 · Compress a how-to into exactly 5 numbered steps Open round →
1. Mix 100g whole wheat flour with 100g water (~21°C). Cover loosely for 24 hours. 2. Discard half. Feed remaining with 100g flour and 100g water; let sit 24 hours. 3. Repeat this daily discard-and-feed process for about five more days. 4. By day 7, check for bubbles and a pleasant tangy smell. 5. It is ready when it reliably doubles within 4–6 hours of feeding.
▶ R171 · Fireworks bursting into fading sparks Open round →
```html
<!DOCTYPE html>
<html><head><title>Fireworks</title></head><body style="margin:0;overflow:hidden;"><canvas id="c"></canvas><script>const canvas = document.getElementById('c');const ctx = canvas.getContext('2d');let W, H;let particles=[],rockets=[],secondarySparks=[];let frameCount=0;function resize(){W=H=Math.max(window.innerWidth, window.innerHeight);canvas.width=W;canvas.height=H;}resize();window.addEventListener('resize',resize());const G = 0.02;const DRAG = 0.99;let particleCount=0;function Particle(x, y, vx, vy, color, lifespan, size=1){this.x=x;this.y=y;this.vx=vx*0.8+Math.random()*0.4-0.2;this.vy=vy*0.8+Math.random()*0.4-0.2;this.color=color;this.lifespan=lifespan+(size>1?0:0);this.maxLife=this.lifespan;this.initialSize=size;this.size=size;}Particle.prototype.update=function(){this.vx*=DRAG;this.vy*=DRAG;this.x+=this.vx;this.y+=this.vy;this.vy+=G;this.lifespan-=1;if(this.s …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">
<title>Rain Simulation</title>
<style>
body { margin: 0; overflow: hidden; background: #111; display: flex; justify-content: center; align-items: center; height: 100vh; }
canvas { border: 1px solid #222; background: #3a455b; /* Dim scene behind glass */ }
</style>
</head>
<body>
<canvas id="rainCanvas"></canvas>
<script>
const canvas = document.getElementById('rainCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let droplets = [];
let animationFrameId = null;
const MAX_DROPS = 150;
const GROWTH_THRESHOLD_SQ = 18 * 18; // Size threshold for sliding (Area ~324)
// --- Setup Function ---
function setup() {
W = window.innerWidth > 800 ? 800 : window.innerWidth - 40;
H = window.i …Excerpt — the full answer is on the round page.
▶ R173 · Metaball lava lamp with heating and cooling blobs Open round →
<!DOCTYPE html>
<html><head><title>Metaball Lava Lamp</title></head><body style="margin:0;overflow:hidden"><canvas id="c"></canvas><script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let W, H;
function resize() {
W = window.innerWidth;
H = window.innerHeight;
canvas.width = W;
canvas.height = H;
}
window.addEventListener('resize', resize);
resize();
const BLOB_COUNT = 6;
let blobs = [];
class Blob {
constructor(x, y, r) {
this.pos = { x: x, y: y };
this.radius = r;
this.vel = { x: (Math.random() - 0.5) * 0.1, y: Math.random() * 0.3 + 0.2 }; // Initial slow random drift
this.temp = Math.random(); // State variable for heating/cooling
this.maxR = r;
}
update(dt) {
// Temperature-based movement cycle (Simulated buoyancy)
const gravityFactor = 0.0005;
const …Excerpt — the full answer is on the round page.
▶ R174 · Recursive fractal tree growing branch by branch Open round →
```html
<!DOCTYPE html>
<html>
<head>
<title>Fractal Tree Animation</title>
<style>body { margin: 0; overflow: hidden; background-color: #222; } canvas { display: block; }</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');
let W, H;
ctx.canvas.width = window.innerWidth;
ctx.canvas.height = window.innerHeight;
W = window.innerWidth;
H = window.innerHeight;
let treeData = [];
let animationState = {
running: false,
progress: 0, // Tracks how many segments have finished growing
maxSegments: 0,
timeElapsed: 0,
windOffset: Math.random() * Math.PI * 2
};
const MAX_DEPTH = 9;
const MIN_BRANCHES = 1;
const MAX_BRANCHES = 3;
function generateTree(x, y, angle, length, depth, parentSegments) {
let segments = [];
segments.push({ x: x, y: y, angle: angle, length: length, depth: depth }); …Excerpt — the full answer is on the round page.
▶ R175 · Noise flowfield painting additive particle trails Open round →
```html
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>Flowfield</title><style>body{margin:0;overflow:hidden;background:#000;}</style></head><canvas id="c"></canvas><script>const c=document.getElementById('c');const ctx=c.getContext('2d');let W=window.innerWidth,H=window.innerHeight;c.width=W;c.height=H;let particles=[],count=0;let noiseTime=Math.random()*100;function setup(){particles=[];for(let i=0;i<450;i++){particles.push({x:Math.random()*W,y:Math.random()*H,vx:0,vy:0,life:1}));}}setup();window.onresize=()=>{c.width=W=window.innerWidth;c.height=H=window.innerHeight;if(particles.length>0){setup()}};window.addEventListener('resize',window.onresize);function noise(x,y){let n=Math.sin((x*23.5+noiseTime)*0.1)+(Math.cos((y*23.5+noiseTime)*0.1)*1.5);return (n/2+1)/2;}(p)=>{const x=p.x,y=p.y;let nVal=noise(x/W*10,y/H*10);let angle=(Math.sin(x*0.003 + noiseTime)*0.5+Math.c …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 chair. She noticed that one window was stuck, but the hallway was quiet and the heater worked well. At nine o'clock, twelve students entered the archive, greeted the staff, and began comparing old town maps. Their teacher asked them to write short notes about every map they handled. One student found a drawing of the river bridge, and another matched it to a photograph from 1912. By noon, the class had labeled the boxes, cleaned the tables, and thanked Mara for her help. The visit ended on time, and the archive stayed open for regular visitors after lunch.
▶ R177 · Make the numbers consistent Open round →
Workshop attendance report: The registration desk recorded 18 participants: 7 from North Hall, 6 from East Studio, and 5 from River Annex. The header currently says 18 participants attended. The event ran on Wednesday, March 4, 2026, and the room booking confirmation and the posted schedule both list Wednesday, March 4, 2026. For the feedback survey, 15 of the 18 participants submitted forms. The draft summary says this equals 72%, but 15 out of 18 is 83% when rounded to the nearest whole percent.
▶ R178 · Remove redundancy without losing facts Open round →
The neighborhood mobile clinic launches on April 8th at the Maple Community Center. Operating weekly at this site, the clinic will be available every Wednesday from 10 a.m. to 4 p.m. Services offered include free blood pressure checks, vaccinations, and short medical consultations. Residents can book appointments either by phone or in person at the center. For accessibility, Spanish and Vietnamese interpreters will be available during all scheduled hours.
▶ R179 · Unify tense and perspective Open round →
At dawn, I stepped onto the station platform and checked the timetable. I noticed the last train number blinking on the board before the screen went dark. I waited beside the vending machine, but my gaze 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 me a paper voucher. I folded the voucher into my notebook and thought about the missed connection. Finally, I boarded the replacement bus, and I sat near the back window. As the bus left town, I watched the station lights disappear behind the rain.
▶ R180 · Fix the broken references Open round →
Maintenance note for the demo room: The tablet is stored in the blue cabinet, and it must be charged before each session. The projector was tested after lunch; the unit should remain unplugged overnight. See above for the cleaning checklist. Setup steps: 1. Unlock the cabinet. 2. Place the tablet on the stand. 3. Start the room timer.