mistral-small:24b
Low participation: this average comes from only 14 of 174 rounds (8%). Not directly comparable to models with fuller participation.
Rounds & answers 174
▶ R6 · Extraction → JSON8.8 s Open round →
{"name": "AquaPur X2 Trinkbrunnen", "brand": "PetFlow", "price_eur": 29.99, "weight_g": 800, "features": ["Dreifach-Filter", "extrem leisem 2-Watt-Pumpsystem", "spuelsmaschinenfestem Edelstahlaufsatz"], "in_stock": false}▶ R7 · Sentiment classification10.3 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 s Open round →
A) That's old news—life punishes those who come too late. We pulled ourselves out of the mire. --- B) Der Beweis des Pudding liegt im Essen: Unser knapp bemessenes Budget zwang uns, an Ecken und Enden zu sparen, aber der Start verlief reibungslos.
▶ R9 · One-liner code10.7 s Open round →
```^
1
2.\`|^(?=(\\d{4}-((0[1-9])|(1[0-2]))-\\d{2}$|\\b))
2
SELECT customer_id, SUM(amount) AS total_value FROM orders GROUP BY customer_id ORDER BY total_value DESC LIMIT 5;
3.[.items[*].id]
4.nav a[href^="http"],nav a[href^="https"]
5.{ cut -d' ' -f1;sort|uniq}▶ R10 · Facts quiz6.4 s Open round →
1. Canberra 2. 1989 W (tungssten) 4.I'm a teapot Franz Kafka 6.Saturn 7. 101010 8. 443 9. Linus Torvalds 10. 97
▶ R11 · Micro-copy & slogans12.1 s Open round →
1. Hyacinth "Stainless Steel Cat Fountain" - Purifies water whilst keeping a fresh supply 24/7. 2. Family-owned since 1980, your local favourite artisan baking business 3. A Comprehensive and Objective AI Model Comparison Website To Assist You In Choosing The Optimal Algorithms For Your Application 4. Drown out distractions in perfect HD sound. Noise-cancelling headphones with 15 hours of battery life by Nio. 5. Your data, your identity. Manage every password securely and effortlessly with this intuitive application from Nordpass.
▶ R13 · Image prompts0.8 s Open round →
```
▶ R14 · Product names6.1 s Open round →
1. HydraFlow — Drink More Often. 2. SipSense — Your Intuitive Reminder. 3. AquaPrompt — Never Forget to Hydrate 4. FlowMate — Smartly Staying Hydrated. 5. DrinkEasy — Hydration Simplified.
▶ R15 · CSS spinner10.1 s Open round →
```html
<div class="spinner"></div>
<style>
.spinner {
border: 4px solid #f3f3f3; border-top: 4px solid #3498db;
border-radius: 50%; width: 40px; height: 40px;
animation: spin 2s linear infinite;
}
@keyframes spin {
100% { transform: rotate(360deg); }
}
</style>
```▶ R16 · Explain it to a child (German)10.8 s Open round →
Ein Akku ist wie eine Tüte mit Süßigkeiten für dein elektrisches Gerät. Er enthält Energie, die aus Chemikalien entsteht und diese Energie wird in Elektrizität umgewandelt, wenn du den Schalter betätigst . Wenn der Akku leer ist, müssen die Chemikalien wieder aufgeladen werden, was bedeutet, dass man sie mit Strom füllt, genau wie man eine Süßigkeiten Tüte wieder füllen muss. Das dauert ein bisschen Zeit und danach kann dein Gerät wieder benutzt werden
▶ R17 · Logic riddle15 s★ 5.5/10 Open round →
Ziehen Sie eine einzelne Frucht aus der Kiste mit dem Etikett "Gemischt". Basierend auf der einzigen falschen Information darauf, kann die Kiste nur Äpfel enthalten. Das bedeutet: Die anderen zwei Kisten müssen dann Birnen und "Gemischtes" (Äpfel +Birnen) sein. Daraus folgt: Die Kiste mit dem Etikett “Birnen“ muss Gemischtes enthalten und die Kiste mit dem Etikett “Äpfel” die echten Birnen. Verändern Sie daher das Etikett auf “Äpfel“ zu „Gemischt", das Etikett "Birnen" zu "Äpfel" und das bisherige "Gemischt" Etikett zu „Birnen".
▶ R18 · German registers & tone6.2 s★ 8.5/10 Open round →
1. Wir bedauern Ihnen mitteilen zu müssen, dass wir den vereinbarten Liefertermin leider nicht einhalten können. 2. Der angesetzte Liefertermin kann aktuell nicht eingehalten werden. 3. Ich befürchte, wir kriegen es dieses Mal nicht bis zum angegebenen Termin hin.
▶ R19 · Table QA3.5 s★ 9.5/10 Open round →
1. VitaSip 2. 830 3. PureFlow 4. 19,51 5. drei
▶ R20 · JSON repair8 s★ 7.5/10 Open round →
```json
{
"name": "Trinkflasche Pro",
"price": 29.90,
"tags": ["outdoor","sport"],
"stock": {
"berlin": 12,
"muenchen": 7,
"hamburg": null
},
"active": true
}
```▶ R21 · Sorting race bubble/insertion/selection91.3 s★ 3.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting Algorithms Visualization</title>
<style>
canvas {
border: 1px solid black;
}
.container {
display: flex;
justify-content: space-around;
}
</style>
</head>
<body>
<div class="container">
<canvas id="bubble" width="400" height="350"></canvas>
<canvas id="insertion" width="400" height="350"></canvas>
<canvas id="selection" width="400" height="350"></canvas>
</div>
<script>
const ctx = [document.getElementById('bubble').getContext('2d'),
document.getElementById('insertion').getContext('2d'),
document.getElementById('selection').getContext('2d')];
function drawArray(ctx, arr) {
ctx.clearRect(0, 0, 400, 350);
const barWidth = 10; …Excerpt — the full answer is on the round page.
▶ R22 · Hexagon balls140.3 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Physics Simulation</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas {
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}
</style>
</head>
<body>
<canvas id="physicsCanvas" width="600" height="600"></canvas>
<script>
const canvas = document.getElementById('physicsCanvas');
const ctx = canvas.getContext('2d');
const balls = [];
const hexagonPoints = [
{x: 300, y: 50},
{x: 450, y: 150},
{x: 450, y: 350},
{x: 300, y: 450},
{x: 150, y: 350},
{x: 150, y: 150}
];
const gravity = 0.1;
let angle = 0;
class Ball {
constructor(x, y, radius) {
this.x = x;
this.y = y;
this.radius = r …Excerpt — the full answer is on the round page.
▶ R23 · Pendulum wave66.3 s★ 8.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pendulum Wave</title>
<style>
canvas { background: #fff; display: block; margin: 20px auto; }
</style>
</head>
<body>
<canvas id="pendulums" width="800" height="600"></canvas>
<script>
function pendulumWave() {
const canvas = document.getElementById('pendulums');
const ctx = canvas.getContext('2d');
let lastTime = 0;
const numPendulums = 15;
const pendulumLengths = Array.from({ length: numPendulums }, (_, i) => 30 * (numPendulums - i));
const pivotX = canvas.width / 2;
const amplitudes = pendulumLengths.map(l => l * 0.8);
function animate(time) {
if (!lastTime) lastTime = time;
const deltaTime = time - lastTime;
ctx.clearRect(0, 0, canv …Excerpt — the full answer is on the round page.
▶ R24 · Maze race BFS/DFS/A*98.1 s★ 1/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pathfinding Algorithms</title>
<style>
body {
display: flex;
font-family: Arial, sans-serif;
}
canvas {
border: 1px solid black;
}
</style>
<script>
function createMaze() {
const maze = [];
for (let i = 0; i < 25; i++) {
const row = [];
for (let j = 0; j < 25; j++) {
row.push(Math.random() > 0.7 ? 1 : 0);
}
maze.push(row);
}
return maze;
}
function drawMaze(ctx, maze) {
ctx.clearRect(0, 0, 500, 500);
for (let i = 0; i < 25; i++) {
for (let j = 0; j < 25; j++) {
if (maze[i][j] === 1) {
ctx.fillStyle = 'black';
} else {
ctx.fillStyle = '#fff7a9'; //lig …Excerpt — the full answer is on the round page.
▶ R25 · Sorting race quick/merge/heap81 s★ 3/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sorting Algorithms Visualization</title>
<style>
body { display: flex; justify-content: space-around; }
canvas { border: 1px solid black; }
#status { margin-top: 20px; text-align: center; }
</style>
</head>
<body>
<canvas id="qsort" width="400" height="500"></canvas>
<canvas id="msort" width="400" height="500"></canvas>
<canvas id="hsort" width="400" height="500"></canvas>
<div id="status">Racing...</div>
<script>
const values = [];
for (let i = 60; i > 0; --i) values.push(i);
shuffle(values);
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]];
}
}
function d …Excerpt — the full answer is on the round page.
▶ R26 · Projectile ballistics71.7 s★ 1/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Projectile Motion</title>
<style>
canvas { background: #f0f0f0; }
</style>
</head>
<body>
<canvas id="cannonCanvas" width="600" height="400"></canvas>
<script>
const ctx = document.getElementById('cannonCanvas').getContext('2d');
const g = 9.8;
const u = 50; // initial speed
let balls = [];
function start(){
balls = [];
const angles = [20,35,45,60,75];
for (let angle of angles) {
let radians = angle * Math.PI / 180;
balls.push({
x: u * Math.cos(radians),
y: -u * Math.sin(radians) + g,
theta: radians
});
}
}
function animate(){
ctx.clearRect(0,0,600,400);
for (let ball of balls){
if (ball.y > 350 || ball.x < -10){
continue; // Ball out of view.
}
ctx.beginPa …Excerpt — the full answer is on the round page.
▶ R27 · Double-pendulum chaos95.6 s★ 1/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Double Pendulum Chaos</title>
<style>
body { margin: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; background: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="pendulum" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('pendulum');
const ctx = canvas.getContext('2d');
let p1Theta1 = -Math.PI / 3, p1Theta2 = Math.PI / 4;
let p2Theta1 = -Math.PI / 3 + 0.001, p2Theta2 = Math.PI / 4;
const l1 = 200, l2 = 150, m1 = 10, m2 = 10;
const g = 9.81;
let x1, y1, x2, y2;
let vx1 = 0, vy1 = 0, vx2 = 0, vy2 = 0;
function reset() {
p1Theta1 = -Math.PI / 3; p1Theta2 = Math.PI / 4;
p2Theta1 = -Math.PI / 3 + 0.001; p2Theta2 = Math.PI / 4;
}
function drawPendulum(color, x1, y1, x2, …Excerpt — the full answer is on the round page.
▶ R28 · Particle fountain79.1 s★ 3/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Particle Fountain</title>
<style>
body { margin: 0; overflow: hidden; }
#controls { position: absolute; top: 10px; left: 10px; z-index: 1; }
canvas { display: block; }
</style>
</head>
<body>
<div id="controls">
Wind: <input type="range" id="wind" min="-5" max="5" step="0.1" value="0">
</div>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const particles = [];
const windInput = document.getElementById('wind');
class Particle {
constructor(x, y) {
this.x = x;
this.y = y;
this.vx = (Math.random() - 0.5);
this.vy = -(2 + Math.random());
this.radius = 2;
}
update(Wind){
thi …Excerpt — the full answer is on the round page.
▶ R29 · Orbital mechanics83.1 s★ 1.5/10 Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Orbital Mechanics</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="orchestral"></canvas>
<script>
let canvas = document.getElementById('orchestral');
let ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const G = 1e-3;
const bodies = [
{m: 100, x: canvas.width / 2, y: canvas.height / 2, vx: 0, vy: 0, trail: []},
{m: 1, x: 50, y: 180, vx: 3, vy: 4, trail: []},
{m: 1, x: 300, y: canvas.height / 2, vx: -2.2, vy: 0.6, trail: []},
{m: 5, x: 700, y: 150, vx: 0, vy: 4.8, trail: []},
{m: 3, x: canvas.width / 2 + 350, y: canvas.height - 50, vx: -6.9, vy: -2, trail: []}
];
function drawBody(body) {
ctx.beginPath();
ctx.arc(body.x, body.y, Math.sqrt(body. …Excerpt — the full answer is on the round page.
▶ R30 · Spring-mass chain103.4 s★ 2/10 Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Spring-Mass Chain</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; background-color: #f0f0f0; }
</style>
</head>
<body>
<canvas id="chainCanvas" width="800" height="400"></canvas>
<script>
const canvas = document.getElementById('chainCanvas');
const ctx = canvas.getContext('2d');
const numMasses = 12;
const masses = [];
const springs = [];
const springLength = 50;
const stiffness = 0.1;
const damping = 0.98;
for (let i = 0; i < numMasses; i++) {
masses.push({ x: i * springLength + 10, y: canvas.height / 2, vx: 0, vy: 0 });
}
for (let i = 0; i < numMasses - 1; i++) {
springs.push({ a: i, b: i + 1 });
}
let isDragging = false;
let draggedMassIndex;
canvas.addEventListener('mousedown', e => {
const mouseX = e.clientX;
const mouseY = e.clientY; …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. Begründung: Wenn der Schläger 1,00 Euro mehr kostet als der Ball, dann lassen wir \( x \) den Preis des Balls darstellen. Der Preis des Schlägers ist dann \( x + 1,00 \). Die Gesamtkosten betragen \( x + (x + 1,00) = 1,10 \). Dies führt zu der Gleichung \( 2x + 1,00 = 1,10 \), was vereinfacht wird zu \( 2x = 0,10 \). Daraus folgt \( x = 0,05 \).
▶ R32 · Four houses, four clues (constraint puzzle) Open round →
Um die Farben der Häuser zu bestimmen, gehen wir schrittweise vor: 1. **Grünes Haus steht an Position 1.** - Dies ist aus Fakt (2) klar. 2. **Rotes Haus steht direkt links vom blauen Haus.** - Dies bedeutet, dass das rote Haus eine Position weiter links als das blaue Haus stehen muss. - Aus Fakt (3) wissen wir, dass das gelbe Haus direkt rechts vom blauen Haus steht. - Daher muss das blaue Haus an einer der Positionen 2 oder 3 stehen. 3. **Gelbes Haus steht direkt rechts vom blauen Haus.** - Wenn das blaue Haus an Position 2 steht, dann kann das gelbe Haus nicht an Position 4 stehen (da wir nur vier Häuser haben und alle Positionen besetzt sind). - Daher muss das blaue Haus an Position 3 stehen. - Damit steht das gelbe Haus an Position 4. 4. **Rotes Haus muss direkt links vom blauen Haus stehen.** - Da das blaue Haus an Position 3 steht, muss das rote Haus an …
Excerpt — the full answer is on the round page.
▶ R33 · Idioms that break literal translation (EN→DE) Open round →
1) etwas Unangenehmes durchstehen, das sich nicht vermeiden lässt. - Ein deutscher Ausdruck dafür ist: „den Stier bei den Hörnern packen.“ 2) Nun liegt es an dir, zu handeln oder zu entscheiden. - Ein deutscher Ausdruck dafür ist: „der Ball liegt jetzt in deinem Spielfeld.“ 3) Es regnet sehr stark. - Ein deutscher Ausdruck dafür ist: „es schüttet wie aus Eimern.“
▶ R34 · Constrained taglines (word ban + length cap) Open round →
1. Umweltfreundlich und hygienisch. 2. Zähle auf Bambus statt Plastik. 3. Sauberkeit für ein besseres Morgen.
▶ R35 · Minutes in a (non-leap) year — show the math Open round →
Um die Anzahl der Minuten in einem normalen Jahr zu berechnen, gehen wir schrittweise vor:
1. **Berechnung der Stunden pro Tag:**
Ein Tag hat 24 Stunden.
2. **Berechnung der Minuten pro Stunde:**
Eine Stunde hat 60 Minuten.
3. **Berechnung der Minuten pro Tag:**
\[
\text{Minuten pro Tag} = 24 \text{ Stunden/Tag} \times 60 \text{ Minuten/Stunde}
\]
\[
\text{Minuten pro Tag} = 1440 \text{ Minuten}
\]
4. **Berechnung der Minuten in einem Jahr:**
Ein normales Jahr hat 365 Tage.
\[
\text{Minuten im Jahr} = 365 \text{ Tage/Jahr} \times 1440 \text{ Minuten/Tag}
\]
\[
\text{Minuten im Jahr} = 525,600 \text{ Minuten}
\]
Das Endergebnis ist also:
\[
\boxed{525600}
\]▶ R36 · Continue the sequence (doubling gaps) Open round →
Um die nächste Zahl zu finden, addiert man die beiden vorherigen Zahlen der Reihe und subtrahiert dann eins. Die nächste Zahl ist also 28.
▶ R37 · False friend: 'control' EN→DE Open round →
Bevor wir versenden, muss ich die Testergebnisse überprüfen und möglicherweise zwei Fehler beheben.
▶ R38 · Register shift: formal → casual (DE) Open round →
Hallo Frau Müller, leider mussten wir die Besprechung auf morgen 10 Uhr verschieben.
▶ R39 · 40-word product blurb with 3 required words Open round →
Die robuste Edelstahl-Trinkflasche ist auslaufsicher, hält Getränke stundenlang warm oder kalt und ist spülmaschinenfest für einfache Reinigung.
▶ R40 · isPalindrome (ignore case & non-alphanumerics) Open round →
```javascript
function isPalindrome(s) {
const cleaned = s.replace(/[^A-Za-z0-9]/g, '').toLowerCase();
const reversed = cleaned.split('').reverse().join('');
return cleaned === reversed;
}
```▶ 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 →
Die Antwort ist: 9. Es stirbt, es bleiben also alle 9 Schafe am Leben.
▶ R43 · Five machines (rate-reasoning trap) Open round →
Die Zeit, die benötigt wird, um eine bestimmte Anzahl von Teilen herzustellen, hängt nicht linear von der Anzahl der Maschinen ab, wenn jede Maschine unabhängig arbeiten kann. Wenn 5 Maschinen 5 Minuten benötigen, um 5 Teile herzustellen, bedeutet dies, dass jede Maschine 1 Teil in 5 Minuten herstellt. Daher würde auch eine einzige Maschine 5 Minuten benötigen, um ein Teil herzustellen. Deshalb brauchen 100 Maschinen ebenfalls nur 5 Minuten, um 100 Teile herzustellen.
▶ 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 →
That's not perfect, but we should keep things in perspective—at the end of the day, it's manageable.
▶ R46 · Energy conservation on a frictionless incline Open round →
To solve this problem using energy conservation, we'll apply the principle that the total mechanical energy of the system remains constant if there are no non-conservative forces acting on it.
(a) **Calculating the block's speed at the bottom:**
1. **Initial Potential Energy (PE):**
The initial potential energy is given by \( PE = mgh \), where \( m \) is the mass of the block, \( g \) is the acceleration due to gravity, and \( h \) is the height.
\[
PE = 2 \, \text{kg} \times 9.8 \, \text{m/s}^2 \times 5 \, \text{m}
\]
\[
PE = 98 \, \text{J}
\]
2. **Final Kinetic Energy (KE):**
At the bottom of the incline, all the potential energy has been converted into kinetic energy.
\[
KE = \frac{1}{2} m v^2
\]
By conservation of energy:
\[
PE = KE
\]
\[
98 \, \text{J} = \frac{1}{2} \times 2 \, \text{kg} \times v^2
\]
3. **Solving for …Excerpt — the full answer is on the round page.
▶ R47 · Unit conversion: km/h to m/s and mph Open round →
To convert the speed from kilometers per hour (km/h) to meters per second (m/s), we use the following conversion factors:
1 kilometer = 1000 meters
1 hour = 3600 seconds
So, to convert 108 km/h to m/s:
\[ 108 \text{ km/h} = 108 \times \frac{1000 \text{ meters}}{1 \text{ kilometer}} \times \frac{1 \text{ hour}}{3600 \text{ seconds}} \]
\[ 108 \text{ km/h} = 108,000 \text{ m/h} \times \frac{1 \text{ h}}{3600 \text{ s}} \]
\[ 108 \text{ km/h} = \frac{108,000}{3600} \text{ m/s} \]
\[ 108 \text{ km/h} = 30 \text{ m/s} \]
So, the speed in meters per second is **30.0 m/s**.
Next, to convert the speed from kilometers per hour (km/h) to miles per hour (mph), we use the given conversion factor:
1 mile = 1.60934 km
To convert 108 km/h to mph:
\[ 108 \text{ km/h} = 108 \times \frac{1 \text{ mile}}{1.60934 \text{ kilometers}} \]
\[ 108 \text{ km/h} = \frac{108}{1.60934} \text{ mph} \]
\[ …Excerpt — the full answer is on the round page.
▶ R48 · Low-orbit satellite: speed and period (orbital/Kepler estimate) Open round →
To solve this problem, we need to follow these steps:
### (a) Orbital Speed
The formula for orbital speed \( v \) is given by:
\[ v = \sqrt{\frac{\mu}{r}} \]
where:
- \(\mu\) is the standard gravitational parameter (\(\approx 398600 \, \text{km}^3/\text{s}^2\))
- \( r \) is the distance from the Earth's center to the satellite.
First, we calculate \( r \):
\[ r = R_{\text{Earth}} + h \]
where:
- \( R_{\text{Earth}} \) is the radius of the Earth (\(\approx 6371 \, \text{km}\))
- \( h \) is the altitude of the satellite (400 km)
So,
\[ r = 6371 \, \text{km} + 400 \, \text{km} = 6771 \, \text{km} \]
Now, we can find the orbital speed:
\[ v = \sqrt{\frac{398600 \, \text{km}^3/\text{s}^2}{6771 \, \text{km}}} \]
\[ v = \sqrt{\frac{398600}{6771}} \]
\[ v \approx \sqrt{58.87} \]
\[ v \approx 7.67 \, \text{km/s} \]
### (b) Orbital Period
The formula for the orbital period \( T \) is given by …Excerpt — the full answer is on the round page.
▶ R49 · Ohm's law: resistance and power dissipation Open round →
To solve this problem, we can use Ohm's law and the formula for electrical power.
(a) **Calculating the Resistance:**
Ohm's law states that \( V = IR \), where:
- \( V \) is the voltage,
- \( I \) is the current, and
- \( R \) is the resistance.
Given:
- \( V = 12 \) volts,
- \( I = 0.5 \) amperes.
We can rearrange Ohm's law to solve for \( R \):
\[ R = \frac{V}{I} \]
Substituting the given values:
\[ R = \frac{12 \, \text{V}}{0.5 \, \text{A}} \]
\[ R = 24 \, \Omega \]
So, the resistance of the resistor is \( 24 \, \Omega \).
(b) **Calculating the Electrical Power:**
The formula for electrical power dissipated in a resistor is:
\[ P = VI \]
Given:
- \( V = 12 \) volts,
- \( I = 0.5 \) amperes.
Substituting the given values:
\[ P = 12 \, \text{V} \times 0.5 \, \text{A} \]
\[ P = 6 \, \text{W} \]
So, the electrical power dissipated in the resistor is \( 6 \, \text{W} \).
### Su …Excerpt — the full answer is on the round page.
▶ R50 · Thin lens equation: image distance and magnification Open round →
Given:
- Focal length \( f = 10 \) cm
- Object distance \( d_o = 15 \) cm
We need to find the image distance \( d_i \) using the thin lens equation:
\[ \frac{1}{f} = \frac{1}{d_o} + \frac{1}{d_i} \]
Rearranging for \( 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}} \]
Calculate each term:
\[ \frac{1}{10 \, \text{cm}} = 0.1 \]
\[ \frac{1}{15 \, \text{cm}} = \frac{1}{15} \approx 0.0667 \]
So,
\[ \frac{1}{d_i} = 0.1 - 0.0667 = 0.0333 \]
Taking the reciprocal to find \( d_i \):
\[ d_i = \frac{1}{0.0333} \approx 30 \, \text{cm} \]
So, \( d_i \) is approximately 30 cm.
(b) To calculate the magnification \( m \):
\[ m = -\frac{d_i}{d_o} \]
Substitute the values:
\[ m = -\frac{30 \, \text{cm}}{15 \, \text{cm}} = -2 \]
The magnification is -2, which means the image is …Excerpt — the full answer is on the round page.
▶ R51 · Heat required to warm water (specific heat capacity) Open round →
To calculate the heat energy required, we'll use the formula: Q = m * c * ΔT where: - Q is the heat energy, - m is the mass of the water, - c is the specific heat capacity of water, - ΔT is the change in temperature. Given: - m = 2 kg, - c = 4186 J/(kg*K), - ΔT = 80°C - 20°C = 60 K (or °C, since the size of a degree Kelvin is the same as a degree Celsius). Now, plug in the values: Q = 2 kg * 4186 J/(kg*K) * 60 K Q = 8372 * 60 Q = 502,320 J To convert joules to kilojoules (kJ), divide by 1,000: Q = 502,320 J / 1,000 Q = 502.32 kJ So, the heat energy required is 502,320 joules or 502.32 kilojoules.
▶ R52 · Fermi estimate: how many piano tuners in a 10-million-person city? Open round →
To estimate the number of professional piano tuners in a city of 10 million people using Fermi estimation, we'll make several reasonable assumptions: 1. **Household Count**: - Let's assume an average household size of 4 people. - Number of households = Total population / Average household size - Number of households = 10,000,000 / 4 ≈ 2,500,000 households 2. **Piano Ownership**: - Let's assume that about 1 in 100 households owns a piano. - Number of pianos = Households owning pianos - Number of pianos = 2,500,000 / 100 ≈ 25,000 pianos 3. **Frequency of Tuning**: - A typical piano might need tuning once or twice a year. - Let's assume an average of 1.5 tunings per piano per year. - Total tunings needed = Number of pianos * Average tunings per piano per year - Total tunings needed = 25,000 * 1.5 ≈ 37,500 tunings per year 4. **Tunings Per Tuner**: - Let' …
Excerpt — the full answer is on the round page.
▶ R53 · Why is the sky blue? (conceptual) Open round →
The sky appears blue during the day due to a process called Rayleigh scattering. Here's a simple explanation: When the Sun's light reaches Earth's atmosphere, it collides with the tiny molecules and particles in the air. These collisions scatter the light in different directions. Blue light is scattered more than other colors because it travels in shorter, smaller waves. This means that when we look up at the sky, we see more blue light than any other color, making the sky appear blue. So, Rayleigh scattering is responsible for the blue color of the sky during the day.
▶ R54 · Time dilation: why do moving clocks run slow? (conceptual, special relativity) Open round →
Sure, let's break down these concepts in simple terms. ### Time Dilation Imagine you have a clock that is moving relative to you. According to special relativity, this moving clock will appear to run slower than your own stationary clock. This phenomenon is known as time dilation. Here’s why: 1. **Relative Motion**: When something moves relative to an observer, it experiences different conditions compared to when it's at rest. 2. **Spacetime**: In Einstein's theory of relativity, space and time are intertwined into a four-dimensional fabric called spacetime. The way time progresses can be affected by how quickly or slowly objects move through this fabric. 3. **Light Speed Limit**: According to the theory, nothing can exceed the speed of light. As an object moves faster, it experiences more "stretching" in space but less progression in time to maintain this limit. So, when you observe …
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 is a fundamental demonstration in quantum physics that illustrates the wave-particle duality of matter and light. Here's a simplified explanation: 1. **Basic Setup**: Imagine a wall with two closely spaced slits, and behind it, a screen. Particles (like electrons or photons) are sent through the slits one at a time. 2. **Pattern without 'Which-Path' Detector**: - When particles go through the slits individually, an interference pattern is observed on the screen. - This pattern consists of alternating bands of high and low intensity, like ripples in water when two stones are dropped into it. - The interference pattern suggests that each particle is behaving like a wave, because waves can interfere constructively or destructively. 3. **Pattern with 'Which-Path' Detector**: - If you add a detector to determine which slit each particle went through, …
Excerpt — the full answer is on the round page.
▶ R56 · Double-slit interference, particle by particle Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Double-Slit Experiment</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #000; color: #fff; }
canvas { border: 1px solid #fff; }
#count { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 24px; }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="count">Particles Detected: 0</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const countDisplay = document.getElementById('count');
let particlesDetected = 0;
const slitWidth = 50;
const slits = [300, 450];
const screenStartX = 600;
function drawParticle() {
const particleX = Math.random() * canvas.width;
const particleY = Math.random() * canvas.height / 2 + can …Excerpt — the full answer is on the round page.
▶ R57 · Hanging rope with Verlet integration Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hanging Rope Simulation</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="ropeCanvas"></canvas>
<script>
const canvas = document.getElementById('ropeCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const numPoints = 40;
const points = [];
const constraints = [];
for (let i = 0; i < numPoints; i++) {
points.push({ x: i * 15, y: 0 });
}
for (let i = 0; i < numPoints - 1; i++) {
constraints.push([i, i + 1]);
}
points[0].x = canvas.width / 4;
points[numPoints - 1].x = 3 * canvas.width / 4;
function VerletIntegrate(points) {
for (let p of points) {
p.oldX = p.x;
p.oldY = p.y;
p.vy += 0.2; // gravity
p.x += p.vx;
p.y += p.vy; …Excerpt — the full answer is on the round page.
▶ R58 · 2D wave propagation with reflection Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>2D Wave Equation</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: #000; }
canvas { border: 1px solid #fff; }
</style>
</head>
<body>
<canvas id="waveCanvas" width="840" height="630"></canvas>
<script>
const canvas = document.getElementById('waveCanvas');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
const cellSize = 7;
const rows = Math.floor(height / cellSize);
const cols = Math.floor(width / cellSize);
let field1 = Array.from({ length: rows }, () => Array(cols).fill(0));
let field2 = Array.from({ length: rows }, () => Array(cols).fill(0));
function updateField() {
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
let newValue = (field1[y][x] * -2 + …Excerpt — the full answer is on the round page.
▶ R59 · Billiard break with spin and friction Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Billiard Break</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="billiardCanvas"></canvas>
<script>
const canvas = document.getElementById('billiardCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const balls = [];
const rackPos = { x: 400, y: 350 };
const frictionCoeff = 0.01;
class Ball {
constructor(x, y, radius, color, mass) {
this.x = x; this.y = y;
this.vx = 0; this.vy = 0;
this.radius = radius;
this.color = color;
this.mass = mass;
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
ctx.fillStyle = this.color;
ctx.fill();
ctx.closePath();
}
update() {
if (this.vx > 0) this.vx -= frictionCoef …Excerpt — the full answer is on the round page.
▶ R60 · Dijkstra vs A* on a weighted grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dijkstra vs A*</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 10px; left: 10px; color: white; font-family: Arial, sans-serif; }
</style>
</head>
<body>
<canvas id="canvas" width="640" height="480"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const cellSize = 10;
const rows = 30;
const cols = 20;
const terrainCosts = Array.from({ length: rows }, () => Array(cols).fill(0));
const dijkstraFrontier = [];
const aStarFrontier = [];
let dijkstraVisited = new Set();
let aStarVisited = new Set();
let dijkstraPath = [];
let aStarPath = [];
let dijkstraExpanded = 0;
let aStarExpande …Excerpt — the full answer is on the round page.
▶ R61 · Convex hull built step by step Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Convex Hull Animation</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="hullCanvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('hullCanvas');
const ctx = canvas.getContext('2d');
const points = [];
const hull = [];
function getRandomPoint() {
return { x: Math.random() * canvas.width, y: Math.random() * canvas.height };
}
function crossProduct(o, a, b) {
return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
}
function distanceSquared(a, b) {
const dx = a.x - b.x;
const dy = a.y - b.y;
return dx * dx + dy * dy;
}
function sortPoints() {
points.sort((a, b) => a.y === b.y ? a.x - b.x : a.y - b.y);
}
function polarAngle( …Excerpt — the full answer is on the round page.
▶ R62 · Huffman tree from letter frequencies Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Huffman Code Animation</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="huffmanCanvas" width="800" height="600"></canvas>
<script>
// Sample sentence
const sentence = "this is an example for huffman encoding";
// Frequency table
let freqTable = {};
sentence.split('').forEach(char => {
freqTable[char] = (freqTable[char] || 0) + 1;
});
// Priority queue node class
class Node {
constructor(letter, frequency, left=null, right=null) {
this.letter = letter;
this.frequency = frequency;
this.left = left;
this.right = right;
}
}
// Priority queue class
class PQueue {
constructor( …Excerpt — the full answer is on the round page.
▶ R63 · Kruskal's MST with union-find Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Kruskal's Algorithm Animation</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #f0f0f0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 20px; left: 20px; font-family: Arial, sans-serif; color: black; }
</style>
</head>
<body>
<canvas id="graphCanvas" width="800" height="600"></canvas>
<div id="info">Edges accepted: 0<br>Total weight: 0</div>
<script>
const canvas = document.getElementById('graphCanvas');
const ctx = canvas.getContext('2d');
const nodes = Array.from({ length: 25 }, () => [Math.random() * canvas.width, Math.random() * canvas.height]);
const edges = [];
for (let i = 0; i < nodes.length; i++) {
for (let j = i + 1; j < nodes.length; j++) {
const weight = Math.sqrt(Math.pow(nodes[i][0] - nodes …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>8-Queens Solver</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 10px; left: 10px; color: white; background: rgba(0, 0, 0, 0.5); padding: 10px; font-family: monospace; }
</style>
</head>
<body>
<canvas id="board" width="400" height="400"></canvas>
<div id="info">Placements: 0<br>Backtracks: 0</div>
<script>
const canvas = document.getElementById('board');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let size = Math.floor(Math.random() * 5) + 6;
let board = Array(size).fill(0);
let placements = 0;
let backtracks = 0;
function drawBoard() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const cellSize = canvas.width / size;
for (l …Excerpt — the full answer is on the round page.
▶ R65 · Delaunay triangulation, triangle by triangle Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Delaunay Triangulation</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 20px; left: 20px; font-size: 24px; }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="info">Points: 0, Triangles: 0</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let points = [];
let triangles = [];
function randomPoint() {
return { x: Math.random() * canvas.width, y: Math.random() * canvas.height };
}
function circumcircle(triangle) {
const [a, b, c] = triangle;
let ax = a.x, ay = a.y;
let bx = b.x, by = b.y;
let cx = c.x, cy = c.y;
let d = 2 …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>AVL Tree Visualization</title>
<style>
canvas {border: 1px solid black;}
</style>
</head>
<body onload="init()">
<canvas id="avlCanvas" width="800" height="600"></canvas>
<script>
function init(){
const canvas = document.getElementById('avlCanvas');
const ctx = canvas.getContext('2d');
let keys = Array.from({length: 20}, () => Math.floor(Math.random() * 100));
let rotations = 0;
let height = 0;
class Node {
constructor(key) {
this.key = key;
this.left = null;
this.right = null;
this.height = 1;
}
}
function getHeight(node){
return node ? node.height : 0;
}
function updateHeight(node){
if (node)
node.height = 1 + Math.max(getHeight(node.left), getHeight(node.right));
} …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 { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 20px; left: 20px; font-size: 20px; }
</style>
</head>
<body>
<canvas id="sieveCanvas" width="800" height="450"></canvas>
<div id="info">Prime: -, Primes Found: 0, Cells Eliminated: 0</div>
<script>
const canvas = document.getElementById('sieveCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
const size = 40;
let primes = [];
let eliminated = 0;
function drawGrid() {
for (let i = 0; i < size * size; i++) {
const x = i % size;
const y = Math.floor(i / size);
ctx.strokeRect(x * 19, y * 20 + 50, 18, 18); …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">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Levenshtein Edit Distance</title>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="levenshteinCanvas"></canvas>
<script>
const words = ['intention', 'execution'];
const [word1, word2] = shuffle(words);
const canvas = document.getElementById('levenshteinCanvas');
const ctx = canvas.getContext('2d');
canvas.width = 600;
canvas.height = 400;
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
function drawMatrix( …Excerpt — the full answer is on the round page.
▶ R69 · Replanning when the map changes Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Robot Navigation</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 20px; left: 20px; font-size: 20px; color: white; background: rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; }
</style>
</head>
<body>
<canvas id="gameCanvas" width="600" height="400"></canvas>
<div id="info">Steps: 0 Replans: 0</div>
<script>
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
const gridSize = 30;
const cellSize = 20;
const info = document.getElementById('info');
let steps = 0, replans = 0;
function drawGrid() {
for (let x = 0; x < gridSize; x++) {
for (let y = 0; y < 20; …Excerpt — the full answer is on the round page.
▶ R70 · Binary search, step by step Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Binary Search Animation</title>
<style>
body { font-family: Arial, sans-serif; }
#canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="400"></canvas>
<div id="info"></div>
<script>
// Initialize canvas and context
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let array = Array.from({ length: 40 }, (_, i) => i + 1);
array.sort(() => Math.random() - 0.5);
let target = array[Math.floor(Math.random() * 40)];
let low = 0;
let high = array.length - 1;
let comparisons = 0;
function drawArray(arr, low, high, mid) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const barWidth = canvas.width / arr.length;
for (let i = 0; i < arr.length; i++) {
let color = 'grey';
if (i === mid) color = 'red';
else if (i …Excerpt — the full answer is on the round page.
▶ R71 · Flood fill on a pixel grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flood Fill Animation</title>
<style>
canvas { border: 1px solid black; }
#stats { position: absolute; top: 10px; left: 10px; color: white; font-size: 20px; }
</style>
</head>
<body style="background-color: black;">
<canvas id="canvas" width="600" height="400"></canvas>
<div id="stats">Filled: 0, Frontier: 0</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const gridWidth = 60;
const gridHeight = 40;
const cellSize = 10;
let floodFillQueue = [];
let filledCells = new Set();
let frontierSize = 0;
let filledCount = 0;
function drawGrid() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (let x = 0; x < gridWidth; x++) {
for (let y = 0; y < gridHeight; y++) {
const color = Math.random() …Excerpt — the full answer is on the round page.
▶ R72 · Maze generation by recursive backtracking Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Maze Generator</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 10px; left: 10px; color: white; background: rgba(0, 0, 0, 0.5); padding: 5px; font-size: 20px; }
</style>
</head>
<body>
<canvas id="mazeCanvas" width="600" height="400"></canvas>
<div id="info">Cells Carved: 0<br>Stack Depth: 0</div>
<script>
const canvas = document.getElementById('mazeCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
const width = 30, height = 20;
const cellSize = 20;
let cellsCarved = 0, stackDepth = 0;
canvas.width = width * cellSize;
canvas.height = height * cellSize;
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
cons …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;display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0;}
canvas {border:1px solid #000;}
</style>
</head>
<body>
<canvas id="kmpCanvas" width="800" height="400"></canvas>
<script>
function kmpSearch(text, pattern) {
let lps = new Array(pattern.length);
let i = 0, j = -1;
lps[0] = -1;
while (i < pattern.length) {
if ((j === -1 || pattern[i] === pattern[j]) && i + 1 < pattern.length) {
i++;
j++;
lps[i] = j;
} else {
j = lps[j];
}
}
let matches = [];
i = 0; j = 0;
while (i < text.length) {
if (pattern[j] === text[i]) { i++; j++; }
if (j === pattern.length) { matches.push(i - j); j = lps[j]; }
else if ((i < t …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">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>QuadTree Collision Detection</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
let c = document.getElementById('canvas');
c.width = window.innerWidth;
c.height = window.innerHeight;
let ctx = c.getContext('2d');
class Ball {
constructor(x, y) { this.x = x; this.y = y; this.vx = (Math.random() - 0.5) * 4; this.vy = (Math.random() - 0.5) * 4; }
update() { this.x += this.vx; this.y += this.vy;
if(this.x < 0 || this.x > c.width) this.vx *= -1;
if(this.y < 0 || this.y > c.height) this.vy *= -1;}
draw(ctx, color = 'white') { ctx.fillStyle = color; ctx.beginPath(); ctx.arc(this.x, this.y, 5, 0, Math.PI * 2); ctx.fill(); }
}
cl …Excerpt — the full answer is on the round page.
▶ R75 · Falling sand on a cell grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Falling Sand</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #f0f0f0; }
canvas { border: 2px solid black; }
#info { position: absolute; top: 10px; left: 10px; font-family: Arial, sans-serif; color: black; }
</style>
</head>
<body>
<canvas id="sandCanvas" width="600" height="400"></canvas>
<div id="info">Step: 0 | Resting: 0</div>
<script>
const canvas = document.getElementById('sandCanvas');
const ctx = canvas.getContext('2d');
const cellSize = 4;
const cols = 150;
const rows = 100;
const grid = Array.from({ length: rows }, () => Array(cols).fill(0));
let stepCount = 0;
let restingCells = 0;
function drawGrid() {
for (let r = 0; r < rows; r++) {
for (let c = 0; c < cols; c++) {
ctx.fillStyle = grid[r][ …Excerpt — the full answer is on the round page.
▶ R76 · Falling sand as free particles Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Falling Sand Simulation</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#info { position: absolute; top: 10px; left: 10px; color: white; font-size: 20px; z-index: 10; }
</style>
</head>
<body>
<canvas id="sandCanvas"></canvas>
<div id="info">Grains at Rest: 0, Pile Height: 0</div>
<script>
const canvas = document.getElementById('sandCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const grains = [];
const gravity = 0.1;
const friction = 0.95;
let restingGrains = 0;
let maxY = 0;
function createGrain() {
return { x: Math.random() * canvas.width, y: 0, vx: (Math.random() - 0.5) * 2, vy: 0 };
}
for (let i = 0; i < 1500; i++) grains.push(createGrain());
function updateGravity(grains) {
for (const grain …Excerpt — the full answer is on the round page.
▶ R77 · Crowd leaving a room, cell by cell Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Evacuation Simulation</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
#info { position: absolute; top: 20px; left: 20px; font-family: Arial, sans-serif; color: black; }
</style>
</head>
<body>
<div id="info">Step: 0 | Left: 0/60</div>
<canvas id="simulation" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('simulation');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
const gridWidth = 40;
const gridHeight = 30;
const cellSize = 20;
const exitX = 19; // X-coordinate of the exit
const exitY = 29; // Y-coo …Excerpt — the full answer is on the round page.
▶ R78 · Crowd leaving a room by steering Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Room Exit Simulation</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#info { position: absolute; top: 10px; left: 10px; color: white; font-size: 24px; }
</style>
</head>
<body>
<canvas id="simulationCanvas"></canvas>
<div id="info">People left: 0, Average Speed: 0.0</div>
<script>
const canvas = document.getElementById('simulationCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const exit = { x: canvas.width / 2, y: canvas.height - 50 };
const people = [];
const maxPeople = 60;
const repulsionRadius = 30;
const speedFactor = 1.5;
for (let i = 0; i < maxPeople; i++) {
people.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, vx: 0, vy: 0 …Excerpt — the full answer is on the round page.
▶ R79 · Aggregation on a lattice Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Diffusion-Limited Aggregation</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="dlaCanvas" width="400" height="300"></canvas>
<script>
const canvas = document.getElementById('dlaCanvas');
const ctx = canvas.getContext('2d');
const gridSize = 20;
const cols = 200 / gridSize;
const rows = 150 / gridSize;
const seedX = Math.floor(cols / 2);
const seedY = Math.floor(rows / 2);
let cluster = new Array(rows).fill().map(() => new Array(cols).fill(0));
cluster[seedY][seedX] = 1;
let frozenCount = 1;
const directions = [[-1, 0], [1, 0], [0, -1], [0, 1]];
let radius = Math.max(seedX, seedY);
function drawCluster() {
ctx.clearRect(0, 0, canvas.width, canvas.h …Excerpt — the full answer is on the round page.
▶ R80 · Aggregation by continuous drift Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Particle Clustering</title>
<style>
canvas { border: 1px solid black; }
#info { position: absolute; top: 10px; left: 10px; color: white; background: rgba(0, 0, 0, 0.5); padding: 5px; }
</style>
</head>
<body style="margin: 0;">
<canvas id="clusterCanvas" width="800" height="600"></canvas>
<div id="info">Stuck Particles: 0<br>Cluster Radius: 0.0</div>
<script>
const canvas = document.getElementById('clusterCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let stuckParticles = 0;
let clusterRadius = 0;
class Particle {
constructor(x, y) {
this.x = x;
this.y = y;
this.rx = Math.random() - 0.5;
this.ry = M …Excerpt — the full answer is on the round page.
▶ R81 · Flocking birds with three rules Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flocking Birds</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#info {
position: absolute;
top: 10px;
left: 10px;
color: white;
font-family: Arial, sans-serif;
background-color: rgba(0, 0, 0, 0.5);
padding: 10px;
border-radius: 5px;
}
</style>
</head>
<body>
<canvas id="birdCanvas"></canvas>
<div id="info">Flocks: 0 Average Speed: 0</div>
<script>
const canvas = document.getElementById('birdCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
class Bird {
constructor(x, y) {
this.pos = { x, y };
this.vel = { x: Math.random() - 0.5, y: Math.random() - 0.5 };
this.acc = { x: 0, y: 0 }; …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>Conway's Game of Life</title></head>
<body onload="start()">
<canvas id="game" width="1200" height="800"></canvas>
<script>
let canvas = document.getElementById('game');
let ctx = canvas.getContext('2d');
let width = 120, height = 80;
let grid = Array.from({length: height}, () => Array(width).fill(0));
let nextGrid = Array.from({length: height}, () => Array(width).fill(0));
let generation = 0;
let aliveCount = 0;
const colors = ['#FFFFFF', '#FF0000', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#8B4513'];
function start() {
seed();
drawGrid();
requestAnimationFrame(update);
}
function seed() {
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
grid[y][x] = Math.random() < 0.25 ? 1 : 0;
}
}
grid[1][2] = grid[2][3] = grid[3][1] = grid[3][2] = grid[3][3] = 1; // Glider
grid[ …Excerpt — the full answer is on the round page.
▶ R83 · Fourier epicycles tracing a shape Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fourier Epicycles</title>
<style>
body {display:flex; justify-content:center; align-items:center; height:100vh; margin:0;}
#canvasContainer {position:relative;}
#epicycleCount {position:absolute; top:20px; left:50%; transform:translateX(-50%); background:#fff; padding:5px 10px; border-radius:5px; font-family:Arial, sans-serif;}
</style>
</head>
<body>
<div id="canvasContainer">
<canvas id="canvas" width="600" height="600"></canvas>
<span id="epicycleCount">Number of Epicycles: 0</span>
</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let nEpicycles = Math.floor(Math.random() * 15) + 5;
document.getElementById('epicycleCount').innerText = `Number of Epicycles: ${nEpicycles}`;
function drawShape() {
const shapePoints = [];
let t = 0;
for (let i = …Excerpt — the full answer is on the round page.
▶ R84 · Voronoi cells with moving seeds Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Voronoi Animation</title>
<style>
body {margin: 0; overflow: hidden;}
canvas {display: block;}
#info {position: absolute; top: 10px; left: 10px; color: white; font-family: Arial, sans-serif; background: rgba(0, 0, 0, 0.5); padding: 5px; border-radius: 5px;}
</style>
</head>
<body>
<canvas id="voronoiCanvas" width="800" height="600"></canvas>
<div id="info"></div>
<script>
function randomInt(min, max) {return Math.floor(Math.random() * (max - min + 1)) + min;}
function distance(x1, y1, x2, y2) {return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);}
function getRandomColor() {return `rgb(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)})`;}
const canvas = document.getElementById('voronoiCanvas');
const ctx = canvas.getContext('2d');
let seeds = [];
let colors = [];
function initSeeds() {seeds = [];
for (let i = …Excerpt — the full answer is on the round page.
▶ R85 · Travelling salesman improved by 2-opt Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Travelling Salesman Tour Animation</title>
<style>
body { margin: 0; display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0;}
canvas { border: 1px solid #000; }
#info { position:absolute;top:10px;left:10px;color:#333;font-family:Arial, sans-serif;}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="info">Tour Length: Improvements: </div>
<script>
function random(lower, upper) { return Math.random() * (upper - lower) + lower; }
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext('2d');
let cities = [];
for (let i = 0; i < 60; i++) {
let x = random(50, canvas.width - 50);
let y = random(50, canvas.height - 50);
cities.push({x, y});
}
let …Excerpt — the full answer is on the round page.
▶ R86 · Scrolling terrain from value noise Open round →
```html
<canvas id="landscape" style="border:1px solid #000;"></canvas>
<script>
// Noise generation functions:
function lerp(x,y,a){return x+(y-x)*a;}
function fade(t){return t*t*t*(t*(t*6-15)+10);}
function grad(hash,x,y){let h=hash&3;let u=(h&1)?x:y;let v=(h&2)?y:x;return ((h&1) ? -u : u)+(h&2?v:-v);}
function noise(x,y){const p=[[151, 164, 180, 137], [91, 192, 129, 131],[192, 101, 143, 134],[151, 131, 180, 164]];let X=(x&255)+((y&255)<<8);X=(((p[X&255]|(p[((X>>8)&255)]<<8))|(X<<16)));
return (grad(p[(X<<13)^X>>7]%4, x,y) + grad(p[((X>>19)^X>>20) * 4], x - y, y))/Math.sqrt(3);}
function fbm(x,y,n){let a=0;let b=1;for(let i=0;i<n;i++){a+=b*noise(x/b,y/b);b/=2}}return a;}
function drawTerrain(){const canvas=document.getElementById('landscape');const ctx=canvas.getContext('2d');
let width=window.innerWidth;let height=window.innerHeight;
canvas.width=width;canvas.height=height; …Excerpt — the full answer is on the round page.
▶ R87 · Gray-Scott reaction-diffusion Open round →
```html
<!DOCTYPE html>
<html><head><title>Gray-Scott Reaction-Diffusion</title></head><body onload="init()"> <canvas id="canvas"></canvas><script>function init(){const c=document.getElementById("canvas");c.width=600;c.height=600;const ctx=c.getContext("2dx");let w=c.width, h=c.height,size=128;const scale=w/size;ctx.fillStyle="white";ctx.fillRect(0,0,w,h);const dA=0.5,dB=0.3,f=0.04,k=0.06,dt=1;let U=new Float32Array(size*size),V=new Float32Array(size*size), Unew=new Float32Array(size*size), Vnew=new Float32Array(size*size);function Laplacian(U){let Utemp=new Float32Array(size*size);for(let i=1;i<size-1;++i)for(let j=1;j<size-1;++j)Utemp[i+size*j]=(U[(i+1)+size*(j)]+U[(i-1)+size*(j)]+U[i+size*(j+1)]+U[i+size*(j-1)]-4*U[i+size*j])/scale;Utemp[0]=Utemp[size-1]=Utemp[size*(size-1)]=Utemp[size-1]=Utemp[size*(size-1)+size-1]=Utemp[size*(size-1)]=Utemp[0+size*(size-1)]=Utemp[(size-2)+(size-1)*s …Excerpt — the full answer is on the round page.
▶ R88 · L-system tree growing in wind Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fractal Tree</title>
<style>
body {margin: 0; overflow: hidden;}
canvas {display:block;}
</style>
</head>
<body>
<canvas id="treeCanvas"></canvas>
<script>
function Lsystem(axiom, rules, generations) {
this.axiom = axiom;
this.rules = rules;
this.generations = generations;
this.currentString = axiom;
for (let i = 0; i < generations; i++) this.generate();
}
Lsystem.prototype.generate = function() {
let nextString = '';
for (let c of this.currentString) nextString += this.rules[c] || c;
this.currentString = nextString;
};
function drawTree(canvas, ctx, instructions) {
let stack = [];
let pushState = {x: 0, y: 0, angle: 0};
for (let i = 0; i < instructions.length; i++) {
let cmd = instructions[i];
if (cmd === 'F') {
ctx.moveTo(pushState.x, pushState.y);
pushState.x += 10 * Math.cos(pushState.angle);
pushState.y -= …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>Marching Squares</title>
<style>
body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh}
canvas{border:1px solid #000;}
#info{position:absolute;top:10px;left:10px;font-family:Arial, sans-serif;color:#fff;}
</style>
</head>
<body>
<canvas id="fieldCanvas" width="800" height="600"></canvas>
<div id="info">Line segments drawn: 0</div>
<script>
const canvas=document.getElementById('fieldCanvas');
const ctx=canvas.getContext('2d');
const infoDiv=document.getElementById('info');
let field=[],width=80,height=60,cellsPerMetaball=5;
function generateField(){
field=[];
for(let i=0;i<width;i++){
field[i]=[];
for(let j=0;j<height;j++)field[i][j]=0;}
const metaballs=[{x:Math.random()*canvas.width,y:Math.random()*canvas.height,radius:30},{x:Math.random()*canvas.width,y:M …Excerpt — the full answer is on the round page.
▶ R90 · Poisson-disk sampling, Bridson's algorithmDNF Open round →
▶ R91 · Starfield tunnel in perspective Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Starfield</title>
<style>
body {margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: black;}
canvas {display: block;}
#info {position: absolute; top: 20px; left: 20px; color: white; font-family: Arial, sans-serif;}
</style>
</head>
<body>
<canvas id="starfield"></canvas>
<div id="info">Stars: <span id="starCount">300</span> Speed: <span id="speed">1.0</span></div>
<script>
let canvas = document.getElementById('starfield');
let ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const stars = [];
const starCount = 300;
const maxSpeed = 5;
const minSpeed = 1;
let speed = Math.random() * (maxSpeed - minSpeed) + minSpeed;
document.getElementById('starCount').innerText = starCount;
document.getElementById('speed').innerT …Excerpt — the full answer is on the round page.
▶ R92 · Rotating wireframe solids with depth sortingDNF Open round →
▶ R93 · Rotating wireframe height field Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Rotating Height Field</title><style>body{margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #000; color: #fff; font-family: Arial, sans-serif;}#info{position: absolute; top: 20px; left: 20px; z-index: 1;}</style>
</head><body>
<div id="info"></div><canvas id="canvas" width="800" height="600"></canvas><script>const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');let angle = 0;
function drawHeightField() {ctx.clearRect(0, 0, canvas.width, canvas.height);ctx.fillStyle = 'white';ctx.font = '16px Arial';
ctx.fillText(`Grid Size: 50x50`, 10, 20);
ctx.fillText(`Rotation Angle: ${angle.toFixed(2)}°`, 10, 40);
const numPointsX = 50; const numPointsZ = 50;
const gr …Excerpt — the full answer is on the round page.
▶ R94 · Raycast maze walkthrough Open round →
```html
<html>
<head>
<meta charset="UTF-8">
<title>Raycasting Maze</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="mazeCanvas"></canvas>
<script>
let canvas = document.getElementById('mazeCanvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let ctx = canvas.getContext('2d');
const map = [
'##########',
'#.........#',
'#.###.#.#.#',
'#..#...#.#.',
'#........#.',
'######.#.#.',
'#.....#..#.',
'#.#####.##.',
'#........#',
'##########'
];
const mapWidth = map[0].length;
const mapHeight = map.length;
let playerX = 1;
let playerY = 1;
let playerA = 0;
function drawPixel(x, y, color) {
ctx.fillStyle = color;
ctx.fillRect(x * 5, y * 5, 5, 5);
}
function castRay(angle) {
let x = Math.floor(playerX);
let y = Math.floor(playerY);
const cosA = Math.cos(angle);
const …Excerpt — the full answer is on the round page.
▶ R95 · Shaded sphere by painter's algorithm Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Rotating Sphere</title>
<style>
body { margin: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; background: #000; color: #fff; font-family: Arial, sans-serif; }
canvas { border: none; }
#pointCount { position: absolute; top: 20px; left: 20px; z-index: 1; }
</style>
</head>
<body>
<div id="pointCount"></div><canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
function random(min, max) {
return min + Math.random() * (max - min);
}
function getRandomPointOnSphere(radius) {
const theta = random(0, 2 * Math.PI);
const phi = Math.acos(random(-1, 1));
return { x: radius * Math.sin(phi) * Math.cos(theta), y: radius * Math.sin(phi) * Math.sin(theta), z: radius * Math.cos(phi) };
}
function generatePoints(num …Excerpt — the full answer is on the round page.
▶ R96 · Force-directed graph settling Open round →
```html
<!DOCTYPE html>
<html><head><meta charset="UTF-8"><title>Force Simulation</title><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0}canvas{border:1px solid #000}</style></head>
<body><canvas id="graphCanvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('graphCanvas');
const ctx = canvas.getContext('2d');
let nodes = [];
let edges = [];
function generateRandomGraph() {
nodes.length = 0;
edges.length = 0;
const numNodes = 25;
for (let i = 0; i < numNodes; i++) {
nodes.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height });
}
for (let i = 0; i < numNodes; i++) {
const j = Math.floor(Math.random() * numNodes);
if (i !== j) edges.push([nodes[i], nodes[j]]);
}
}
function drawGraph() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
fo …Excerpt — the full answer is on the round page.
▶ R97 · Circle packing without overlap Open round →
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {display:flex;justify-content:center;align-items:center;height:100vh;margin:0;}
canvas {border: 1px solid black;}
</style>
</head>
<body>
<canvas id="packingCanvas" width="600" height="400"></canvas>
<script>
const canvas = document.getElementById('packingCanvas');
const ctx = canvas.getContext('2d');
let circles = [];
let coveredArea = 0;
let totalCircles = 0;
function getRandomPoint() {
return { x: Math.random() * canvas.width, y: Math.random() * canvas.height };
}
function circleOverlaps(center, radius) {
for (let circle of circles) {
let dx = center.x - circle.center.x;
let dy = center.y - circle.center.y;
if (Math.sqrt(dx * dx + dy * dy) < radius + circle.radius) return true;
}
return false;
}
function drawCircle(center, radius, color) {
ctx.beginPath();
ctx.arc(center.x, center.y, …Excerpt — the full answer is on the round page.
▶ R98 · Squarified treemap of changing data Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"><meta name=viewport content="width=device-width,user-scalable=no"><title>Squarified Treemap</title><style>*{margin:0;padding:0}body{display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0;font-family:Arial,sans-serif}#canvas{border:2px solid black}</style>
</head>
<body>
<canvas id=canvas width=800 height=600></canvas><script>const canvas=document.getElementById('canvas'); const ctx=canvas.getContext('2d'); let items=[...Array(20)].map(()=>({w:Math.random()*10+5,label:''})); function draw(){ctx.clearRect(0,0,canvas.width,canvas.height);items.forEach(drawItem);}function drawItem(item,x=0,y=0,w,h){if(w>h){const a=[],b[]; for(let i=0;i<w;++i)a[i]=item.w*Math.random();for(let i=0;i<h;++i)b[i]=item.w*(1-Math.random()); const k=a.reduce((p,c)=>c+p,p=>Math.min(p,...b));const idx=k>=h?a.indexOf(M …Excerpt — the full answer is on the round page.
▶ R99 · Three sorting algorithms racing Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting Algorithms</title>
<style>
body{margin:0;font-family:Arial,sans-serif;}
canvas{border:1px solid #000;display:block;margin:auto;padding-top:5%;}
#info{text-align:center;position:absolute;top:10px;width:100%;font-size:24px;}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="info">Comparison Count: Bubble - 0, Insertion - 0, Quicksort - 0</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let array = [];
for(let i=0;i<60;i++)array.push({value:i+1,color:'#000'});
function shuffleArray(arr) {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
}
function drawBars() {
ctx.clearRect(0, …Excerpt — the full answer is on the round page.
▶ R100 · Sankey flow with travelling particles Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Sankey Diagram</title>
<style>
body {margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0;}
canvas {border: 1px solid black;}
#info {position: absolute; top: 20px; left: 20px; font-family: Arial, sans-serif; color: #333;}
</style>
</head>
<body>
<canvas id="sankeyCanvas" width="800" height="600"></canvas>
<div id="info">Total Throughput: 0</div>
<script>
const ctx = document.getElementById('sankeyCanvas').getContext('2d');
let throughput = 0;
let flowValues = [[1, 30], [2, 40], [3, 60]];
let targetFlows = {1: [], 2: [], 3: []};
targetFlows[1].push([4, Math.random() * 50]);
targetFlows[1].push([5, Math.random() * 30]);
targetFlows[2].push([4, Math.random() * 40]);
targetFlows[2].push([6, Math.random() * 70]);
targetFlows[3].push([5, Math.random() * 20] …Excerpt — the full answer is on the round page.
▶ R101 · Langton's ant building a highway Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Langton's Ant</title>
<style>
body {margin:0; overflow:hidden;}
canvas {display:block;}
</style>
</head>
<body>
<canvas id="antCanvas"></canvas>
<script>
const canvas = document.getElementById('antCanvas');
const ctx = canvas.getContext('2d');
let width = 800, height = 600;
canvas.width = width; canvas.height = height;
const cellSize = 5;
const cols = Math.floor(width / cellSize);
const rows = Math.floor(height / cellSize);
let grid = Array.from({ length: rows }, () => Array(cols).fill(0));
let antX = Math.floor(cols / 2), antY = Math.floor(rows / 2);
let direction = 0; // 0: right, 1: down, 2: left, 3: up
const directions = [[0, 1], [1, 0], [0, -1], [-1, 0]];
let stepCount = 0;
let maxSteps = 10000;
function drawGrid() {
ctx.clearRect(0, 0, width, height);
for (let y = 0; y < rows; y++) {
fo …Excerpt — the full answer is on the round page.
▶ R102 · Rule 110 growing line by line Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rule 110 Cellular Automaton</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="rule110"></canvas>
<script>
const canvas = document.getElementById('rule110');
const ctx = canvas.getContext('2d');
const width = 800;
const height = 600;
const cellSize = 4;
let rows = 300;
let colCount = Math.floor(width / cellSize);
const ruleTable = [0,1,1,1,0,1,1,0,1,1,0,0,0,1];
canvas.width = width;
canvas.height = height;
let grid = Array.from({length: rows}, () => Array(colCount).fill(0));
grid[0][Math.floor(colCount / 2)] = 1;
function drawGrid() {
ctx.clearRect(0, 0, width, height);
for (let row = 0; row < rows; row++) {
for (let col = 0; col < colCount; col++) {
if (grid[row][col] === 1) {
ctx.fillStyle = 'black';
ctx.fillRect( …Excerpt — the full answer is on the round page.
▶ R103 · Wireworld with a clock and a diode Open round →
```html
<html>
<head>
<style>
body{margin:0;}
#canvas{border:1px solid black;display:block;margin:auto;background:#fff;}
</style>
</head>
<body onload="start()">
<canvas id="canvas" width="500" height="500"></canvas>
<p style="text-align:center;">Step count: <span id="step">0</span>, Electron count: <span id="electron">1</span></p>
<script>
function randomInt(min, max) {return Math.floor(Math.random() * (max - min + 1)) + min;}
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const cellSize = 8;
const gridWidth = canvas.width / cellSize;
const gridHeight = canvas.height / cellSize;
let stepCount = 0;
let electronCount = 1;
function createGrid() {
const grid = [];
for (let y = 0; y < gridHeight; y++) {
const row = [];
for (let x = 0; x < gridWidth; x++) {
row.push(randomInt(0, 3));
}
grid.push(row); …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 { margin: 0; overflow: hidden; }
canvas { display: block; }
#stats { position: absolute; top: 10px; left: 10px; color: white; font-family: Arial, sans-serif; background: rgba(0, 0, 0, 0.5); padding: 5px; border-radius: 5px; }
</style>
</head>
<body>
<canvas id="sandpileCanvas"></canvas>
<div id="stats">Grains Dropped: 0<br>Topplings: 0</div>
<script>
const canvas = document.getElementById('sandpileCanvas');
const ctx = canvas.getContext('2d');
const stats = document.getElementById('stats');
let width = window.innerWidth;
let height = window.innerHeight;
canvas.width = width;
canvas.height = height;
const cellSize = 10;
const gridWidth = Math.floor(width / cellSize);
const gridHeight = Math.floor(height / cellSize);
let grains = Array.from({ length: gridHeight }, () => Ar …Excerpt — the full answer is on the round page.
▶ R105 · Brian's Brain Open round →
```html
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>Brian's Brain</title></head>
<body style="margin:0;display:flex;justify-content:center;align-items:center;height:100vh;">
<canvas id="briansBrainCanvas" width="645" height="645"></canvas>
<script>
const canvas = document.getElementById('briansBrainCanvas');
const ctx = canvas.getContext('2d');
const size = 120;
const cellSize = canvas.width / size;
let gridA = new Array(size).fill().map(() => new Array(size));
let gridB = new Array(size).fill().map(() => new Array(size));
let currentGrid = gridA, nextGrid = gridB;
function initializeGrid() {
for (let i = 0; i < size; i++) {
for (let j = 0; j < size; j++) {
if (Math.random() > 0.8) currentGrid[i][j] = 1;
}
}
}
function countLiveCells(grid) {
let count = 0;
for (let i = 0; i < size; i++) {
for (let j = 0; j < size; j++) { …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"><meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Truchet Tiles</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #282c34; color: white; font-family: Arial, sans-serif; }
#info { position: absolute; top: 20px; left: 20px; z-index: 1; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<div id="info"></div><canvas id="canvas" width="800" height="600"></canvas>
<script>
function drawTruchetTile(ctx, x, y, size, orientation) {
const cx = x + size / 2;
const cy = y + size / 2;
ctx.beginPath();
if (orientation === 'up-right') { ctx.arc(cx - size / 4, cy - size / 4, size / 4, Math.PI * 1.5, Math.PI * 0.5); ctx.arc(cx + size / 4, cy + size / 4, size / 4, Math.PI * 0.5, Math.PI * 1.5); }
else if (orientation === …Excerpt — the full answer is on the round page.
▶ R107 · Hilbert curve drawing itselfDNF Open round →
▶ R108 · Interlocking star pattern on a grid Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Islamic Star Pattern</title>
<style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0}canvas{border:2px solid #333}</style>
</head>
<body><canvas id="patternCanvas" width="800" height="600"></canvas>
<script>function drawPatterns(ctx,n){ctx.clearRect(0,0,w,h);const size=Math.min(w,h)/n;for(let y=n;y--;)for(let x=n;x--;){drawStar(ctx,x,y,size)}}function drawStar(ctx,x,y,s){ctx.save();ctx.translate(x*s+s/2,y*s+s/2);ctx.beginPath();ctx.moveTo(0,-s/2);for(let i=5;i--;)ctx.lineTo(s*Math.cos(i*Math.PI*.4),-s*Math.sin(i*Math.PI*.4));ctx.closePath();ctx.strokeStyle='black';ctx.stroke();ctx.restore()}const w=800,h=600,c=document.getElementById('patternCanvas'),ctx=c.getContext('2d');let n=5,angle=0;fun …Excerpt — the full answer is on the round page.
▶ R109 · Moire from two rotating rasters Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Moire Effect</title>
<style>body{margin:0;padding:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#000;color:#fff;font-family:Arial,Helvetica,sans-serif}canvas{border:1px solid#fff}</style>
</head>
<body><canvas id="moireCanvas" width="800" height="800"></canvas>
<script>const canvas=document.getElementById('moireCanvas');
const ctx=canvas.getContext('2d');
let angle=0;let offset=0;
function drawRings(ctx,angle,offset){
ctx.clearRect(0,0,canvas.width,canvas.height);
for(let i=-5;i<=5;i++){
let radius=i*100+400;
ctx.beginPath();
ctx.arc(canvas.width/2+Math.cos(angle)*offset,canvas.height/2+Math.sin(angle)*offset,radius,0,2*Math.PI);
ctx.strokeStyle='rgba(255,255,255,0.5)';
ctx.stroke();
}
for(let i=-5;i<=5;i++){
let radius=i*100+400;
ctx.beginPath();
ctx.arc(canvas.width/2-Math. …Excerpt — the full answer is on the round page.
▶ R110 · Penrose-style aperiodic tiling growing Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Aperiodic Rhombus Tiling</title>
<style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0;}canvas{border:1px solid #000;}</style>
</head>
<body>
<canvas id="tilingCanvas" width="800" height="800"></canvas>
<script>
const canvas = document.getElementById('tilingCanvas');
const ctx = canvas.getContext('2d');
let generation = 1;
const maxGenerations = 5;
const scale = 1.4;
function drawRhombus(x, y, size) {
const halfSize = size / 2;
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + size / 2, y - halfSize);
ctx.lineTo(x + size, y);
ctx.lineTo(x + size / 2, y + halfSize);
ctx.closePath();
}
function drawThickRhombus(x, y, size) {
ctx.strokeStyle = 'black';
ctx.lineWidth = 3;
drawRhombus(x, y, size);
ctx.stroke();
}
function draw …Excerpt — the full answer is on the round page.
▶ R111 · Ant colony laying pheromone trails Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ant Colony Simulation</title>
<style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0;}canvas{border:2px solid #000;}</style>
</head>
<body>
<canvas id="antCanvas" width="800" height="600"></canvas>
<script>
const cvs=document.getElementById('antCanvas');
const ctx=cvs.getContext('2d');
const ants=[];
const nest={x:400,y:570};
const foodSource={x:400,y:30};
let pheromoneField=new Array(800).fill().map(()=>new Array(600).fill(0));
const antCountEl=document.createElement('div');
antCountEl.style.position='absolute';
antCountEl.style.top='10px';
antCountEl.style.left='10px';
document.body.appendChild(antCountEl);
let foodCarried=0;
function createAnt(){
ants.push({x:nest.x,y:nest.y,target:Math.random()>0.5?foodSource:nest,direction:{x:Math.random()-.5,y:Math. …Excerpt — the full answer is on the round page.
▶ R112 · Physarum slime-mould network Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Physarum Simulation</title><style>body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;background:#f0f0f0}canvas{border:1px solid #000}</style></head>
<body>
<canvas id="simulationCanvas" width="800" height="600"></canvas><script>
// Simulation parameters
const canvas = document.getElementById('simulationCanvas');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
const numAgents = 3000;
const trailMapSize = 100;
const stepRate = 0.5; // Step size per frame
let agents = [];
let trailMap = Array.from({ length: trailMapSize }, () => Array(trailMapSize).fill(0));
let stepCount = 0;
// Initialize agents
function initAgents() {
for (let i = 0; i < numAgents; i++) {
const x = Math.random() * width;
const y = Math.random() * he …Excerpt — the full answer is on the round page.
▶ R113 · Predator and prey on a shared field Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Predator-Prey Simulation</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#info { position: absolute; top: 10px; left: 10px; color: white; font-family: Arial, sans-serif; background: rgba(0, 0, 0, 0.5); padding: 10px; }
</style>
</head>
<body>
<canvas id="simulationCanvas" width="800" height="600"></canvas>
<div id="info">Prey: <span id="preyCount">0</span> Predators: <span id="predatorCount">0</span></div>
<script>
const canvas = document.getElementById('simulationCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
const preyCountElem = document.getElementById('preyCount');
const predatorCountElem = document.getElementById('predatorCount');
class Entity {
constructor(x, y) {
this.x = x;
this.y = y;
}
draw() {}
}
class Food …Excerpt — the full answer is on the round page.
▶ R114 · Traffic jam from nothingDNF Open round →
▶ R115 · Crowd leaving through a bottleneck Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Crowd Simulation</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#stats { position: absolute; top: 10px; left: 10px; color: white; font-size: 24px; }
</style>
<script>
function simulate() {
const canvas = document.getElementById('crowd');
const ctx = canvas.getContext('2d');
const width = canvas.width;
const height = canvas.height;
let people = [];
let insideCount = 0;
const doorX = width - 50;
const doorY = height / 2;
const doorWidth = 30;
const peopleCount = 500;
const maxSpeed = 2;
const repulsionForce = 1.5;
const wallRepulsion = 1;
function Person(x, y) {
this.x = x;
this.y = y;
this.vx = (Math.random() - 0.5) * 2;
this.vy = (Math.random() - 0.5) * 2;
this.update = function () …Excerpt — the full answer is on the round page.
▶ R116 · Bresenham circles and lines, pixel by pixel Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bresenham's Algorithm Canvas</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
function drawPixel(ctx, x, y) {
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
imageData.data[(y * canvas.width + x) * 4] = 255;
imageData.data[(y * canvas.width + x) * 4 + 1] = 255;
imageData.data[(y * canvas.width + x) * 4 + 2] = 255;
ctx.putImageData(imageData, 0, 0);
}
function midpointLine(ctx, x0, y0, x1, y1) {
let dx = Math.abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
let dy = -Math.abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
let err = dx + dy, e2;
while (true) {
drawPi …Excerpt — the full answer is on the round page.
▶ R117 · De Casteljau construction of a Bezier curve Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>De Casteljau Construction</title>
<style>
canvas { border: 1px solid black; }
#info { position: absolute; top: 10px; left: 10px; color: white; background: rgba(0, 0, 0, 0.5); padding: 5px; font-family: Arial, sans-serif; font-size: 14px; }
</style>
</head>
<body style="background-color:#000;">
<canvas id="bezierCanvas" width="800" height="600"></canvas>
<div id="info"></div>
<script>
const canvas = document.getElementById('bezierCanvas');
const ctx = canvas.getContext('2d');
const infoDiv = document.getElementById('info');
let controlPoints = [];
let t = 0;
let increment = 0.01;
function getRandomPoint() {
return { x: Math.random() * canvas.width, y: Math.random() * canvas.height };
}
function initControlPoints() {
controlPoints = [getRandomPoint(), getRandomPoint(), getRandomPoint(), getRandomPoint( …Excerpt — the full answer is on the round page.
▶ R118 · Sutherland-Hodgman polygon clipping Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sutherland-Hodgman Clipping</title>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body onload="start()">
<canvas id="canvas" width="600" height="400"></canvas>
<script>
function start(){
const canvas = document.getId("canvas");
const ctx = canvas.getContext("2d");
let polygon = [];
let window = { x: 150, y: 100, w: 300, h: 200 };
function randomPolygon() {
let vertices = [];
for (let i = 0; i < 6; i++) {
vertices.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height
});
}
return vertices;
}
polygon = randomPolygon();
function SutherlandHodgman(subject, clip) {
let outputList = subject.slice();
for (let edge of clip) {
let inputList …Excerpt — the full answer is on the round page.
▶ R119 · Floyd-Steinberg dithering a gradient Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Floyd-Steinberg Dithering</title>
<style>
body {margin: 0; overflow: hidden;}
canvas {display: block;}
div {position: absolute; top: 10px; left: 10px; color: white; font-size: 20px;}
</style>
</head>
<body>
<canvas id="canvas"></canvas><div id="info"></div>
<script>
function createImageData(canvas) {
const width = canvas.width;
const height = canvas.height;
return new ImageData(width, height);
}
function setPixel(data, x, y, value) {
data.data[(y * data.width + x) * 4] = value;
data.data[(y * data.width + x) * 4 + 1] = value;
data.data[(y * data.width + x) * 4 + 2] = value;
data.data[(y * data.width + x) * 4 + 3] = 255;
}
function getPixel(data, x, y) {
return data.data[(y * data.width + x) * 4];
}
function dither(imgData, paletteSize) {
con …Excerpt — the full answer is on the round page.
▶ R120 · Scanline fill of a self-intersecting polygon Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Scanline Fill</title></head>
<body onload='start()'>
<style>
canvas{display:block;background:#222;}
</style>
<canvas id=c width=600 height=400></canvas>
<script>
function start(){
let ctx=document.getElementById('c').getContext('2d'),w=ctx.canvas.width,h=ctx.canvas.height,t=0;
const N=8,m={x:300,y:200},v=[];
for(let i=0;i<N;i+=1)v.push({x:i*75+Math.random()*50-25,y:(i%4)*10+Math.random()*40});
function draw(){
t+=.02,t%=6.283;
ctx.clearRect(0,0,w,h);
const pts=v.map(p=>({x:p.x+Math.cos(t+i*.71)*p.y*1.5,y:p.y+Math.sin(t+i*.9)*p.x*.5}));
pts.push(pts[0]);
let scanlines=0,spans=0;
for(let y=0;y<h;y++){
scanlines++;
let intersections=[];
for(let i=0;i<pts.length-1;i+=1){
const p0=pts[i],p1=pts[i+1];
if(p0.y>p1.y){[p0,p1]=[p1,p0];}
if(y>=Math.min(p0.y,p1.y)&&y<=Math.max(p0.y,p1.y)){
let x=(y-p0.y)*(p1.x-p0.x)/(p1.y-p0 …Excerpt — the full answer is on the round page.
▶ R121 · A* pathfinding search across an obstacle grid Open round →
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>A* Search Algorithm Animation</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');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
class Node {
constructor(x, y) {
this.x = x;
this.y = y;
this.g = Infinity;
this.h = 0;
this.f = Infinity;
this.parent = null;
}
}
function heuristic(a, b) {
return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
}
function getNeighbors(node, grid) {
const neighbors = [];
const directions = [[-1, 0], [1, 0], [0, -1], [0, 1]];
for (const dir of directions) {
const nx …Excerpt — the full answer is on the round page.
▶ R122 · Randomized maze generation via recursive backtrackingDNF Open round →
▶ R123 · Breadth-first flood fill spreading through a regionDNF Open round →
▶ R124 · Dijkstra's shortest path over weighted terrainDNF Open round →
▶ R125 · Voronoi diagram growing by multi-source flood fillDNF Open round →
▶ R126 · Bubble sort sweeping bars into order Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bubble Sort Animation</title>
<style>
body {margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0;}
canvas {border: 1px solid black;}
</style>
</head>
<body>
<canvas id="bubbleSortCanvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('bubbleSortCanvas');
const ctx = canvas.getContext('2d');
let bars = [];
let comparisons = 0;
let sortStepInterval = null;
function generateBars() {bars = Array.from({length: 80}, () => Math.floor(Math.random() * 500) + 10);}
function drawBars() {ctx.clearRect(0, 0, canvas.width, canvas.height); bars.forEach((bar, i) => ctx.fillStyle = (i >= bars.length - comparisons || !sortStepInterval) ? 'green' : 'blue');bars.forEach((bar, i) => {ctx.beginPath();ctx.rect(i * 10 + 5, canvas.height - b …Excerpt — the full answer is on the round page.
▶ R127 · Quicksort partitioning around glowing pivots Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Quicksort Animation</title>
<style>
body{margin:0;display:flex;justify-content:center;align-items:center;height:100vh;}
canvas{border:1px solid black;}
#swaps{position:absolute;top:20px;left:20px;font-size:24px;}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="swaps">Swaps: 0</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const bars = Array.from({ length: 80 }, () => Math.random() * 450 + 50);
let swapCount = 0;
function drawBars(activeRange, pivot) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (let i = 0; i < bars.length; i++) {
const x = i * 10 + 5;
const y = 550 - bars[i];
ctx.fillStyle = activeRange && i >= activeRange[0] && i <= activeRange[1] ? 'lightblue' : 'orange'; …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 { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; }
canvas { border: 1px solid #000; }
#info { position: absolute; top: 20px; left: 20px; font-size: 20px; }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<div id="info">Pass: 1, Run Length: 1</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let bars = Array.from({ length: 80 }, () => Math.floor(Math.random() * 500));
const barWidth = canvas.width / bars.length;
let pass = 1, runLength = 1;
function drawBars() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (let i = 0; i < bars.length; i++) {
const colo …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 Animation</title>
<style>
body { margin: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="heapSortCanvas" width="800" height="600"></canvas>
<script>
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
let canvas = document.getById('heapSortCanvas');
let ctx = canvas.getContext('2d');
let width = canvas.width;
let height = canvas.height;
let bars = Array.from({ length: 80 }, () => randomInt(50, height - 50));
let swaps = 0;
function drawBars() {
ctx.clearRect(0, 0, width, height);
for (let i = 0; i < bars.length; i++) {
let barHeight = bars[i];
let x = i * 10 + 20;
let y = height - barHeight;
let color = 'blue';
if …Excerpt — the full answer is on the round page.
▶ R130 · Radix sort ordering by one digit at a time Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Radix Sort Visualization</title>
<style>
body { margin: 0; overflow: hidden;}
canvas { display: block; }
</style>
</head>
<body>
<canvas id="sortCanvas"></canvas>
<script>
const canvas = document.getElementById('sortCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let bars = [];
let pass = 0;
let digitPlace = 1;
let sorting = true;
function createBars() {
bars = Array.from({ length: 80 }, () => Math.floor(Math.random() * 300));
}
function drawBars() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const barWidth = canvas.width / bars.length;
bars.forEach((bar, index) => {
const x = index * barWidth + barWidth / 2;
const y = canvas.height - bar;
const color = `hsl(${Math.floor(360 * (index / bars.len …Excerpt — the full answer is on the round page.
▶ R131 · Weekday riddle from two clues Open round →
To determine today's day of the week, let’s analyze the information provided. The statement says that "the day after tomorrow" is "two days before Thursday." This means: - If we call today T. - The day after tomorrow would be T+2 - Two days before Thursday would be Thursday - 2 = Tuesday Therefore, if the day after tomorrow (T + 2) is Tuesday, then: - Today (T) must be Sunday. So, today is **Sunday**.
▶ R132 · Fermi estimate: a lifetime of drinking water Open round →
To estimate this, we'll assume: - An average adult drinks about 2 liters of water per day. - The average lifespan is 75 years. Calculation: 1. Daily water intake: 2 liters/day 2. Annual water intake: 2 liters/day * 365 days/year = 730 liters/year 3. Lifetime water intake: 730 liters/year * 75 years = 54,750 liters Rounded number: 55,000 liters
▶ R133 · Three friends, three pets Open round →
Given the information: 1. Ana is allergic to animal fur, so she cannot own the cat or the dog; therefore, Ana must own the parrot. 2. Ben's pet cannot fly, so Ben cannot own the parrot; since Ana owns the parrot, Ben must own either the cat or the dog. 3. The dog's owner is older than Ben, implying that Cleo, being neither younger than Ben and not owning the dog, 4. Therefore, Cleo must be the one who owns the dog. So, the pet ownerships are: - Ana owns the parrot - Ben owns the cat - Cleo owns the dog
▶ R134 · Smallest number from three remainders Open round →
To find the smallest positive integer that satisfies the given conditions, we can use the Chinese Remainder Theorem or simply test numbers that fit the first two conditions and check if they satisfy the third.
Let's denote the number as \( n \).
1. \( n \equiv 1 \pmod{3} \)
2. \( n \equiv 2 \pmod{5} \)
3. \( n \equiv 3 \pmod{7} \)
First, we find numbers that satisfy \( n \equiv 1 \pmod{3} \) and \( n \equiv 2 \pmod{5} \).
- Numbers that leave a remainder of 1 when divided by 3 are: 1, 4, 7, 10, 13, 16, 19, 22, ...
- Among these, the numbers that also leave a remainder of 2 when divided by 5 are: 7, 22, ...
Now we check these candidates against \( n \equiv 3 \pmod{7} \):
- For \( n = 7 \):
- \( 7 \mod 7 = 0 \) (does not satisfy \( n \equiv 3 \pmod{7} \))
- For \( n = 22 \):
- \( 22 \mod 7 = 1 \) (does not satisfy \( n \equiv 3 \pmod{7} \))
We continue this process until we fin …Excerpt — the full answer is on the round page.
▶ R135 · Conditional dice probability Open round →
To solve this problem, we need to determine the probability that the sum of two dice is 9, given that at least one die shows a 4.
First, let's identify all possible outcomes where at least one die shows a 4:
- (4,1), (4,2), (4,3), (4,4), (4,5), (4,6)
- (1,4), (2,4), (3,4), (5,4), (6,4)
There are 11 such outcomes.
Next, we need to find which of these outcomes result in a sum of 9:
- (4,5) and (5,4)
There are 2 favorable outcomes.
Therefore, the probability that the two dice sum to 9, given that at least one die shows a 4, is:
\[ \frac{2}{11} \]▶ R136 · Double pendulum tracing a chaotic path Open round →
```html
<!DOCTYPE html>
<html><head><style>body{margin:0}canvas{border:1px solid black}</style></head><body><canvas id="pendulumCanvas"></canvas><script>
const canvas=document.getElementById('pendulumCanvas');
const ctx=canvas.getContext('2d');
const width=800,height=600;
canvas.width=width;canvas.height=height;
let time=0,trail=[],maxTrailLength=5000,restartTime=0,fadeSpeed=10;
function random(min,max){return Math.random()*(max-min)+min}function reset(){time=0;trail=[];
restartTime=Date.now();const theta1=random(-Math.PI*3/4,-Math.PI/4);
const theta2=random(-Math.PI*5/8,Math.PI/8);return[theta1,theta2]}
let [theta1,theta2]=reset();
function animate(){ctx.clearRect(0,0,width,height);}
function drawTrail(){if(trail.length>maxTrailLength){reset();animate();}
for(let i=0;i<trail.length;++i){
const alpha=fadeSpeed*i/trail.length;
ctx.strokeStyle=`rgba(0,0,255,${alpha})`;ctx.beginPath();
ctx. …Excerpt — the full answer is on the round page.
▶ R137 · Cloth mesh hanging and rippling in the wind Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hanging Cloth Animation</title>
<style>
body { margin: 0; overflow: hidden; }
#canvas { display: block; }
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
const cvs = document.getElementById('canvas');
cvs.width = window.innerWidth;
cvs.height = window.innerHeight;
const ctx = cvs.getContext('2d');
const cols = 15, rows = 10;
const points = [];
function initPoints() {
for (let j = 0; j < rows; j++) {
for (let i = 0; i < cols; i++) {
points.push({ x: i * 40 + Math.random() * 20, y: j * 40 + Math.random() * 20 });
}
}
}
function drawPoints() {
ctx.beginPath();
for (let p of points) {
ctx.moveTo(p.x, p.y);
if (p.index % cols < cols - 1) ctx.lineTo(points[p.index + 1].x, points[p.index + 1].y);
if (p.index >= cols && p.index % rows …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 Pattern</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; background: #000; }
#distance { position: absolute; top: 10px; left: 10px; color: #fff; font-size: 24px; }
</style>
<script>function init() {
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const distanceText = document.getElementById('distance');
let t = 0, separation = 150, dsep = 1, freq = 2.0;
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const w = canvas.width;
const h = canvas.height;
const centerX = w / 2;
const centerY = h / 2;
const s1 = { x: centerX - separation / 2, y: centerY };
const s2 = { x: centerX + separation / 2, y: …Excerpt — the full answer is on the round page.
▶ R139 · Small n-body system orbiting a central star Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>N-Body Simulation</title>
<style>
canvas { display: block; margin: auto; background: #000; }
</style>
</head>
<body onload="start()">
<canvas id="nbody" width="800" height="600"></canvas>
<script>
function start() {
let w = 800, h = 600;
let ctx = document.getElementById('nbody').getContext('2d');
let bodies = [];
let G = 1e-3; let dt = .5; let trailLen = 36;
let stars = 6;
function random(min, max) { return Math.random() * (max - min) + min; }
function dist(x1, y1, x2, y2) { return Math.sqrt((x2-x1)**2 + (y2-y1)**2); }
class Body {
constructor(mass, x, y, vx, vy) {
this.mass = mass;
this.x = x; this.y = y; this.vx = vx; this.vy = vy;
this.trail = [];
}}
function randomBody() { return new Body(random(50, 200), random(w/4, w*3/4), random(h/4, h*3/4), random(-1, 1), random(-1, 1)); }
for (let i=0; i<stars; ++i …Excerpt — the full answer is on the round page.
▶ R140 · Water sloshing in a tilting container Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Water Sloshing</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: #f0f0f0; }
canvas { border: 1px solid black; }
#angle { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 24px; color: black;}
</style>
</head>
<body>
<canvas id="waterCanvas" width="600" height="400"></canvas><div id="angle">Tilt Angle: 0°</div>
<script>
const canvas = document.getElementById('waterCanvas');
const ctx = canvas.getContext('2d');
const particles = [];
const gravity = { x: 0, y: 1 };
let tiltAngle = 0;
const angleSpeed = Math.PI / 4;
const tiltDirection = 1;
function Particle(x, y) {
this.x = x;
this.y = y;
this.vx = (Math.random() - 0.5);
this.vy = (Math.random() - 0.5);
this.update = function() { …Excerpt — the full answer is on the round page.
▶ R141 · Idiom-dense German into natural English Open round →
That was a complete failure—now we're in a tight spot, but giving up is out of the question.
▶ R142 · Register shift: casual complaint into formal Open round →
Subject: Urgent Replacement Request for Defective Blender Dear [Customer Service Team], I am writing to inform you that the blender I received recently (Order #XXXX) stopped working after just two days of use, with sparks emitting from it when turned on. This is clearly a defective product and needs immediate attention. Please arrange either a full refund or an urgent replacement at your earliest convenience. Thank you for your prompt action on this matter. Best regards, [Your Name]
▶ R143 · Bureaucratic German into plain English Open round →
You must submit the fully completed application on time to receive the service; otherwise, you will lose your claim.
▶ R144 · English apology into idiomatic Sie-German Open round →
Wir haben hier gründlich versagt – da lasse ich nichts schönreden. Aber wir werden das wieder in Ordnung bringen, und es wird Sie keinen Cent kosten.
▶ R145 · False-friend minefield German into English Open round →
We may need to postpone 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.50
},
{
"id": 2,
"name": "Tom Klein",
"notes": "Standard customer",
"amount": 75.00
},
{
"id": 3,
"name": "Lena Fuchs",
"notes": "Called twice, resolved",
"amount": 200.00
},
{
"id": 4,
"name": "Max Otto",
"notes": "VIP customer",
"amount": 50.00
}
]
```▶ R148 · Table QA: sum, filter, max over order data Open round →
1. 405.93 2. 1001, 1003, 1006 3. 1004, 149
▶ 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, at the Berlin office (3rd floor)",
"attendees": ["Sarah", "Tom", "Priya"]
}
```▶ R150 · Diff two near-identical config blocks Open round →
```diff timeout: 30 -> 45 debug: false -> true max_connections: 100 -> 150 ```
▶ R151 · Binary search tree growing node by node Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Binary Search Tree Animation</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas { border: 1px solid #000; }
#info { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-family: Arial, sans-serif; font-size: 24px; color: #333; }
</style>
</head>
<body>
<canvas id="treeCanvas" width="800" height="600"></canvas>
<div id="info">Node Count: 0</div>
<script>
const canvas = document.getElementById('treeCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let nodeCount = 0;
let nodes = [];
let values = Array(15).fill().map(() => Math.floor(Math.random() * 100));
let currentValueIndex = 0;
let s …Excerpt — the full answer is on the round page.
▶ R152 · Hash table with visible collision chains Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hash Table Animation</title>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="hashCanvas" width="800" height="600"></canvas>
<script>
// Canvas and context setup
const canvas = document.getElementById('hashCanvas');
const ctx = canvas.getContext('2d');
const buckets = Array(12).fill().map(() => []);
let keysInserted = 0;
let animationFrame;
// Drawing functions
function drawBucket(x, y, bucket) {
const fillLevel = bucket.length / 4;
ctx.fillStyle = fillLevel < 1 ? 'green' : fillLevel < 3 ? 'yellow' : 'red';
ctx.fillRect(x - 20, y, 40, 5 * (bucket.length + 1));
ctx.strokeRect(x - 20, y, 40, 5 * (bucket.length + 1));
for (let i = 0; i < bucket.length; i++) {
const textY = y + 30 + i * 60;
ctx.fillStyle = 'black';
ctx.fillText(bucket[i], …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 lang="en">
<head>
<meta charset="UTF-8">
<title>Binary Min-Heap Animation</title>
<style>
body { margin: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas { border: 1px solid #000; }
#info { position: absolute; top: 20px; left: 20px; font-family: Arial, sans-serif; color: #333; }
</style>
</head>
<body>
<div id="info"></div><canvas id="heapCanvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById('heapCanvas');
const ctx = canvas.getContext('2d');
const infoDiv = document.getElementById('info');
let insertCount = 0;
let extractCount = 0;
let heap = [];
let radius = 30;
function drawCircle(x, y, value, highlight) {
ctx.beginPath();
ctx.arc(x, y, radius, 0, Math.PI * 2);
ctx.fillStyle = highlight ? 'yellow' : 'white';
ctx.strokeStyle = ' …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>
<meta charset="UTF-8">
<title>Ring Buffer Animation</title>
<style>
body {display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0;}
canvas {border: 1px solid black;}
</style>
</head>
<body>
<canvas id="ringBuffer" width="400" height="400"></canvas>
<script>
const canvas = document.getElementById('ringBuffer');
const ctx = canvas.getContext('2d');
const slots = 18;
const radius = 150;
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
const angleStep = (Math.PI * 2) / slots;
let producerIndex = 0;
let consumerIndex = 0;
let filledSlots = 0;
let bufferFullFlash = false;
function drawSlot(index, color) {
const angle = index * angleStep;
ctx.beginPath();
ctx.arc(centerX + radius, centerY, 20, angle - Math.PI / 4, angle + Math.PI / 4);
ctx.lineTo(centerX + radius, centerY);
ctx.closePat …Excerpt — the full answer is on the round page.
▶ R155 · Linked list with animated pointer relinking Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Animated Linked List</title>
<style>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body><canvas id="linkedListCanvas" width="800" height="400"></canvas>
<script>
const canvas = document.getElementById('linkedListCanvas');
const ctx = canvas.getContext('2d');
// Node class
class Node {
constructor(value) {
this.value = value;
this.next = null;
}
}
// Linked List class
class LinkedList {
constructor() {
this.head = null;
this.length = 0;
}
insertAtRandom(value) {
const newNode = new Node(value);
if (this.length === 0) {
this.head = newNode;
} else {
let current = this.head;
const randomIndex = Math.floor(Math.random() * (this. …Excerpt — the full answer is on the round page.
▶ R156 · Invent 3 product names + taglines for a fictional object (no superlatives) Open round →
1. BagSeal Clip — Snap. Seal. Stand. 2. EasyLock BagClip — Clamp. Store. Enjoy. 3. SnackStand Clip—Keep your snacks fresh and handy
▶ R157 · Rewrite the same product text for two different audiences, facts unchangedDNF Open round →
▶ R158 · 5 email subject lines under 50 chars, no clickbait, no ALL-CAPS Open round →
1. November Jacket Sale: Save Big 2. Mobile App Survey: Share Your Thoughts 3. Free Returns Now Available 4. 20% Off Winter Jackets This Month 5. Updated Return Policy
▶ R159 · Micro-story: exactly 50 words (±5) with 3 mandatory elements Open round →
She rushed through the rain with her red umbrella, but still missed the train. As she waited for the next one, she noticed an old man painting a lighthouse on the platform's wall. His strokes were steady, his eyes calm. Suddenly, she felt no rush.
▶ R160 · Critique a generic slogan in 2 sentences + give 2 better alternatives Open round →
The slogan "Quality You Can Trust" is generic and interchangeable with any brand, as it doesn't highlight the unique features or benefits of solar-powered phone chargers for outdoor enthusiasts. 1. "Charge Your Adventure: Solar-Powered Reliability Anywhere." 2. "Never Miss a Moment: Eco-Friendly Power for Your Outdoor Journeys."
▶ R161 · Selection sort vs shell sort racing side by side Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting Race</title>
<style>
body{margin:0;font-family:Arial,sans-serif;}
canvas{border:1px solid black;display:block;margin-top:20px;}
#controls{text-align:center;padding:10px;}
#count{font-weight:bold;}
</style>
</head>
<body>
<div id="controls"><span id="count">Comparisons: 0 </span><span>(selection sort left, shell sort right)</div>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
const canvas=document.getElementById('canvas');
const ctx=canvas.getContext('2d');
let bars=[];
for(let i=30;--i >= 0;)bars.push(1+Math.floor(Math.random()*50));
let selectionSortBars=bars.slice();
let shellSortBars=bars.slice();
let selSortIdx=0;
let selMinIdx=0;
let selSwapIdx=0;
const selSwaps=[];
const selComparisons=[];
let shellGap=bars.length >> 1;
let shellCompIdx=0;
let shellSwapIdx=0;
const shellSwaps=[ …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 Canvas Animation</title><style>
body {margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0;}
canvas {border: 1px solid black;}
</style></head><body><canvas id="bfsCanvas" width="600" height="450"></canvas>
<script>
const canvas = document.getElementById('bfsCanvas');
const ctx = canvas.getContext('2d');
const cols = 20;
const rows = 15;
const cellSize = 30;
const walls = Math.floor(cols * rows * 0.25);
let grid, start, goal, frontier, visited, path;
function generateMaze() {
grid = Array.from({ length: rows }, () => Array(cols).fill(0));
start = { x: 0, y: 0 };
goal = { x: cols - 1, y: rows - 1 };
for (let i = 0; i < walls; ) {
let x = Math.floor(Math.random() * cols);
let y = Math.floor(Math.random() * rows); …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>
canvas {border:1px solid black;}
#info {font-family: Arial; font-size: 12px;}
</style>
</head>
<body>
<canvas id="graphCanvas" width="600" height="400"></canvas><br>
<div id="info">Edges Added: 0/25<br>Total Weight: 0</div>
<script>
const canvas = document.getElementById('graphCanvas');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
let nodes, edges, mst, treeWeight;
function randomInt(min, max) {return Math.floor(Math.random() * (max - min + 1)) + min;}
function distance(p1, p2) {return Math.sqrt((p1.x - p2.x)**2 + (p1.y - p2.y)**2);}
function getRandomNode() {return nodes[randomInt(0, nodes.length - 1)];}
function drawCircle(ctx, x, y, radius, color) {
ctx.beginPath();
ctx.arc(x, y, radius, 0, 2 * Math.PI);
ctx.fillStyle = color;
ctx.fil …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; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="boidCanvas"></canvas>
<script>
const canvas = document.getElementById('boidCanvas');
const ctx = canvas.getContext('2d');
const boids = [];
const predator = { x: Math.random() * canvas.width, y: Math.random() * canvas.height };
const predatorRadius = 50;
let boidCount = 60;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
function Boid(x, y) {
this.x = x;
this.y = y;
this.vx = (Math.random() - 0.5) * 2;
this.vy = (Math.random() - 0.5) * 2;
this.maxSpeed = 2;
this.perceptionRadius = 50;
this.update = function() {
const sep = this.separate(boids);
const ali = this.align(boids);
const coh = this.cohere(boids …Excerpt — the full answer is on the round page.
▶ R165 · Recursive backtracker carving a maze, then solving it Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Maze Generation and Solving</title>
<style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; }
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="mazeCanvas" width="625" height="378"></canvas>
<script>
function create2DArray(cols, rows) {
let arr = new Array(rows);
for (let i = 0; i < rows; i++) {
arr[i] = new Array(cols).fill(1)
}
return arr
}
function shuffle(a) {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
}
const canvas = document.getElementById('mazeCanvas');
const ctx = canvas.getContext('2d');
let mazeGrid;
let stack = [];
let carveCounter = 0;
let solveCounter = 0;
function …Excerpt — the full answer is on the round page.
▶ R166 · Faithful 3-sentence summary of a chaotic meeting transcript Open round →
The team decided to move the weekly status update to Monday mornings starting next week; Priya will update the shared labeling guide document with her new labeling scheme by Wednesday; Tom will send out the updated calendar invite reflecting the change in meeting times for the weekly status update by end of day Friday, and the office plant budget discussion was pushed to the next meeting.
▶ R167 · One-sentence TL;DR under 25 words Open round →
The legacy /v1/reports API endpoint is shutting down September 30, 2026, requiring migration to the new /v3/reports endpoint.
▶ R168 · Extract action items as a checklist Open round →
1. Maria -- chase client for logo colors confirmation -- today 2. Chen -- fix contact form bug -- Monday 3. Ben -- get updated privacy policy text to legal -- next Wednesday
▶ R169 · Neutral summary of a biased product rant Open round →
The blender jug leaks liquid from around the base seal when filled past the halfway line. The speed dial does not provide distinct differences between speeds 4 through 7. The motor shuts off automatically after approximately 90 seconds of continuous blending.
▶ R170 · Compress a how-to into exactly 5 numbered stepsDNF Open round →
▶ R171 · Fireworks bursting into fading sparks Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fireworks</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#counter { position: absolute; top: 10px; left: 10px; color: white; font-size: 24px; z-index: 1;}
</style>
</head>
<body><div id="counter">Active Particles: 0</div>
<canvas></canvas>
<script>
const c = document.querySelector('canvas');
c.width = window.innerWidth;
c.height = window.innerHeight;
const ctx = c.getContext('2d');
class Particle {
constructor(x, y, vx, vy, color) {
this.x = x;
this.y = y;
this.vx = vx;
this.vy = vy;
this.color = color;
this.size = Math.random() * 3 + 1;
this.alpha = 1;
}
update() {
this.x += this.vx;
this.y += this.vy;
this.vy += 0.2;
this.vx *= 0.98;
this.alpha -= 0.01;
if (thi …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 on Window Pane</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="rainCanvas"></canvas>
<script>
let canvas = document.getElementById('rainCanvas');
let ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let drops = [];
let dropCount = 0;
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
class Drop {
constructor(x, y) {
this.x = x;
this.y = y;
this.size = 2;
this.speedX = 0;
this.speedY = 0;
this.trail = [];
}
update() {
if (this.size < 10 && Math.random() < 0.3) {
this.size++;
} else if (this.size >= 10) {
this.x += this.speedX;
th …Excerpt — the full answer is on the round page.
▶ R173 · Metaball lava lamp with heating and cooling blobs Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"><title>Metaball Lava Lamp</title><style>*{margin:0;padding:0;box-sizing:border-box;}body{display:flex;flex-direction:column;align-items:center;font-family:Arial,Helvetica,sans-serif;background:#000;color:#fff;}#canvas{border:1px solid #fff;margin-top:20px;}</style>
</head><body>
<div>Blobs: <span id="blobCount">0</span></div><canvas id="canvas" width="300" height="600"></canvas>
<script>
const canvas=document.getElementById('canvas');
const ctx=canvas.getContext('2d');
const gridSize=10;
const blobCount=7;
let blobs=[];
let grid=[];
let colorGradient;
function init(){
for(let i=0;i<blobCount;i++){
blobs.push({
x:Math.random()*canvas.width,
y:Math.random()*canvas.height,
radius:30+Math.random()*50,
velocityY:(Math.random()-0.5)*2,
temp:1
}) …Excerpt — the full answer is on the round page.
▶ R174 · Recursive fractal tree growing branch by branch Open round →
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recursive Fractal Tree</title>
<style>
body {margin: 0; display:flex; justify-content:center; align-items:center; height:100vh; background:#f0f0f0;}
canvas {border:1px solid #000;}
</style>
</head>
<body>
<canvas id="treeCanvas" width="800" height="600"></canvas>
<div id="counter">Branches: 0</div>
<script>
const canvas = document.getElementById('treeCanvas');
const ctx = canvas.getContext('2d');
let branchCounter = 0;
let angleOffset = Math.PI / 4;
function drawTree(startX, startY, length, angle, branchingAngle, depth) {
if (depth === 0) return;
const endX = startX + length * Math.cos(angle);
const endY = startY - length * Math.sin(angle);
ctx.beginPath();
ctx.moveTo(startX, startY);
ctx.lineTo(endX, endY);
ctx.stroke();
if (depth > 1) {
drawTree(endX, endY, length * …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">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Perlin Noise Flowfield</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<canvas id="flowfield"></canvas>
<script>
function random(min, max) { return Math.random() * (max - min) + min; }
var canvas = document.getElementById('flowfield');
var ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var particles = [];
var particleCount = 300;
for (var i = 0; i < particleCount; i++) {
particles.push({ x: random(0, canvas.width), y: random(0, canvas.height), vx: 1, vy: 1 });
}
function hueToRGB(hue) { var r = Math.sin(hue * 6); return [Math.abs(r - .5) / .5, Math.sqrt(.75 - (r - .25) ** 2) / 2, Math.min(Math.abs(r + .5), 1)];
}
var noiseSeed = ra …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 consistentDNF Open round →
▶ R178 · Remove redundancy without losing facts Open round →
The neighborhood mobile clinic will open on April 8 at the Maple Community Center, located on Maple Street. The clinic will operate every Wednesday from 10 a.m. to 4 p.m., offering free blood pressure checks, vaccinations, and short medical consultations. Residents can book appointments by phone or in person; Spanish and Vietnamese interpreters will be available during clinic 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 kept looking toward the empty tracks. The loudspeaker crackled, and I heard a short apology for the delay. Then I walked to the ticket office, where the clerk handed over a paper voucher. I folded the voucher into my notebook and was thinking about the missed connection. I finally boarded the replacement bus, and sat near the back window. As the bus left town, I watched the station lights disappear behind the rain.