Model profile
Claude Sonnet
29/29answered (R1–R30)
0DNF / pending
8.7avg. score · 19 scored rounds (R1–R30)
Rounds & answers 24
▶ R6 · Extraction → JSON Open round →
{"name": "AquaPur X2 Trinkbrunnen", "brand": "PetFlow", "price_eur": 29.99, "weight_g": 800, "features": ["Dreifach-Filter", "extrem leises 2-Watt-Pumpsystem", "spülmaschinenfester Edelstahlaufsatz"], "in_stock": false}▶ R7 · Sentiment classification 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↔EN Open round →
That's old hat — those who arrive too late are punished by life. We've pulled the cart out of the mud, but now we mustn't put the cart before the horse. --- Am Ende zählt nur das Ergebnis: Unser Mini-Budget zwang uns, an einigen Stellen Abstriche zu machen, doch der Launch verlief völlig reibungslos.
▶ R9 · One-liner code Open round →
1. ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
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"]:not([href*="example.com"])
5. awk '{print $1}' access.log | sort -u | wc -l▶ R10 · Facts quiz Open round →
1. Canberra 2. 1989 3. W 4. I'm a teapot 5. Franz Kafka 6. Saturn 7. 101010 8. 443 9. Linus Torvalds 10. 97
▶ R11 · Micro-copy & slogans Open round →
1. Fresh, Flowing Water Your Cat Will Love 2. Fresh-Baked Love, From Our Family To Yours 3. Compare AI Models. Choose Smarter, Instantly. 4. Silence The Noise. Hear What Matters. 5. One Vault. Every Password. Total Peace Of Mind. result: Alle 6 Aufgaben (R6–R11) aus /home/webseitenmanager/projekte/blindtest-prototyp/tasks-r6-r11.txt beantwortet — JSON-Extraktion, Sentiment-Klassifikation, Übersetzung DE/EN, 5 Code-Einzeiler, 10 Quizantworten und 5 Werbeslogans.
▶ R13 · Image prompts Open round →
1. An ergonomic gaming chair glows under neon streaming-room lights, photorealistic, high detail, cinematic reflections, RGB ambiance, 8k product photography 2. A craft gin bottle sits on a polished bar, moody evening light, warm amber glow, photorealistic, condensation droplets, shallow depth of field 3. An e-scooter leans against a graffiti-covered wall, urban morning light, photorealistic, soft mist, gritty texture, wide-angle street photography
▶ R14 · Product names Open round →
1. HydroPing — Never miss a sip 2. AquaNudge — Gentle reminders, better hydration 3. SipWise — Smart drinking, made simple 4. FlowMind — Your hydration companion 5. DrinkWell — Stay refreshed, stay sharp
▶ R15 · CSS spinner Open round →
<div class="spinner"></div>
<style>
.spinner {
width: 40px;
height: 40px;
border: 4px solid #e0e0e0;
border-top-color: #3b82f6;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>▶ R16 · Explain it to a child (German) Open round →
Ein Akku ist wie ein kleiner Wasserspeicher, der Energie statt Wasser sammelt. Wenn du ihn auflädst, füllst du diesen Speicher wieder bis oben hin auf. Nutzt du dein Gerät, läuft die gespeicherte Energie langsam wieder heraus, so wie Wasser aus einem Eimer, wenn man ihn kippt. Ist der Eimer leer, muss der Akku wieder an die Steckdose, damit er sich erneut füllen kann. result: Alle 4 Aufgaben (R13–R16) aus tasks-r13-r16.txt exakt nach Vorgabe beantwortet: 3 Bildprompts, 5 Produktnamen, ein CSS-Spinner-Snippet und eine 4-Satz-Akku-Erklärung für Kinder.
▶ R17 · Logic riddle★ 9.5/10 Open round →
Ziehen Sie eine Frucht aus der mit "Gemischt" beschrifteten Kiste. Da diese Beschriftung falsch ist, enthält die Kiste tatsächlich nur die Sorte, die Sie ziehen (z. B. nur Äpfel), also gehört ihr das Etikett "Äpfel". Die Kiste, die bisher "Birnen" hieß, kann nicht Birnen enthalten (falsches Etikett) und auch nicht die gezogene Sorte, also erhält sie das Etikett "Gemischt". Die verbleibende Kiste, die bisher "Äpfel" hieß, muss dann die andere reine Sorte enthalten, also "Birnen".
▶ R18 · German registers & tone★ 9/10 Open round →
1. Sehr geehrte Damen und Herren, wir müssen Ihnen leider mitteilen, dass wir den vereinbarten Liefertermin nicht einhalten können. 2. Update: Der geplante Liefertermin wird nicht gehalten. 3. Hey, kurzer Hinweis – den Liefertermin schaffen wir leider nicht.
▶ R19 · Table QA★ 10/10 Open round →
1. VitaSip 2. 830 3. PureFlow 4. 19,51 5. 3
▶ R20 · JSON repair★ 10/10 Open round →
{"name": "Trinkflasche Pro", "price": 29.90, "tags": ["outdoor", "sport"], "stock": {"berlin": 12, "muenchen": 7, "hamburg": null}, "active": true}▶ R21 · Sorting race bubble/insertion/selectionOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Sorting Algorithm Race</title>
<style>
body{background:#111;color:#eee;font-family:sans-serif;text-align:center;margin:0;padding:20px}
h1{margin:0 0 20px}
.wrap{display:flex;justify-content:center;gap:20px;flex-wrap:wrap}
.panel{background:#1b1b1b;border-radius:8px;padding:10px}
h3{margin:0 0 8px;font-weight:normal;color:#8ab4ff}
canvas{background:#000;border-radius:4px;display:block}
</style>
</head>
<body>
<h1>Sorting Algorithm Race — Bubble vs Insertion vs Selection</h1>
<div class="wrap">
<div class="panel"><h3>Bubble Sort</h3><canvas id="c0" width="280" height="220"></canvas></div>
<div class="panel"><h3>Insertion Sort</h3><canvas id="c1" width="280" height="220"></canvas></div>
<div class="panel"><h3>Selection Sort</h3><canvas id="c2" width="280" height="220"></canvas></div>
</div>
<script>
const N = 40;
function shuffled() {
let a = Array.from({length: N}, (_, i) => i + 1);
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 base = shuffled();
const arrs = [base.slice(), base.slice(), base.slice()];
const highlights = [[], [], []];
const done = [false, false, false];
const canvases = [0, 1, 2].map(i => document.getElementById('c' + i));
const ctxs = canvases.map(c => c.getContext('2d'));
function* bubbleSort(a, hi) {
for (let i = 0; i < a.length - 1; i++) {
for (let j = 0; j < a.length - 1 - i; j++) {
hi[0] = j; hi[1] = j + 1;
yield;
if (a[j] > a[j + 1]) { [a[j], a[j + 1]] = [a[j + 1], a[j]]; yield; }
}
}
}
function* insertionSort(a, hi) {
for (let i = 1; i < a.length; i++) {
let key = a[i], j = i - 1;
hi[0] = i; hi[1] = -1;
yield;
while (j >= 0 && a[j] > key) {
a[j + 1] = a[j]; hi[1] = j; j--;
yield;
}
a[j + 1] = key;
yield;
}
}
function* selectionSort(a, hi) {
for (let i = 0; i < a.length - 1; i++) {
let min = i;
for (let j = i + 1; j < a.length; j++) {
hi[0] = j; hi[1] = min;
yield;
if (a[j] < a[min]) min = j;
}
[a[i], a[min]] = [a[min], a[i]];
yield;
}
}
const gens = [
bubbleSort(arrs[0], highlights[0]),
insertionSort(arrs[1], highlights[1]),
selectionSort(arrs[2], highlights[2])
];
function draw(i) {
const ctx = ctxs[i], w = canvases[i].width, h = canvases[i].height, a = arrs[i];
ctx.clearRect(0, 0, w, h);
const bw = w / a.length;
for (let k = 0; k < a.length; k++) {
const barH = (a[k] / N) * (h - 10);
ctx.fillStyle = highlights[i].includes(k) ? '#ff5555' : '#4da3ff';
ctx.fillRect(k * bw, h - barH, bw - 1, barH);
}
if (done[i]) {
ctx.fillStyle = 'rgba(0,0,0,0.65)';
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = '#3dff6e';
ctx.font = 'bold 30px sans-serif';
ctx.textAlign = 'center';
ctx.fillText('DONE', w / 2, h / 2 + 10);
}
}
function step() {
let allDone = true;
for (let i = 0; i < 3; i++) {
if (!done[i]) {
const r = gens[i].next();
if (r.done) { done[i] = true; highlights[i] = []; }
}
draw(i);
if (!done[i]) allDone = false;
}
if (!allDone) requestAnimationFrame(step);
}
requestAnimationFrame(step);
</script>
</body>
</html>▶ R22 · Hexagon ballsOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Hexagon Bounce</title>
<style>html,body{margin:0;overflow:hidden;background:#111}canvas{display:block}</style>
</head><body>
<canvas id="c"></canvas>
<script>
const cv=document.getElementById('c'),ctx=cv.getContext('2d');
function resize(){cv.width=innerWidth;cv.height=innerHeight;}
resize();addEventListener('resize',resize);
const cx=()=>cv.width/2, cy=()=>cv.height/2;
const R=280, omega=0.25;
let theta=0;
const G=900;
const colors=['#ff5252','#ffb142','#ffe66d','#3ac569','#4fc3f7','#7e57c2','#ec407a','#26a69a'];
const balls=[];
for(let i=0;i<8;i++){
const a=Math.random()*Math.PI*2, r=Math.random()*100;
balls.push({x:cx()+Math.cos(a)*r, y:cy()+Math.sin(a)*r, vx:(Math.random()-0.5)*200, vy:(Math.random()-0.5)*200, rad:16+Math.random()*8, color:colors[i]});
}
function hexVerts(t){
const v=[];
for(let i=0;i<6;i++){ const ang=t+i*Math.PI/3; v.push({x:cx()+R*Math.cos(ang), y:cy()+R*Math.sin(ang)}); }
return v;
}
let last=performance.now();
function step(now){
const dt=Math.min((now-last)/1000,0.02); last=now;
theta+=omega*dt;
const verts=hexVerts(theta);
for(const b of balls){ b.vy+=G*dt; b.x+=b.vx*dt; b.y+=b.vy*dt; }
for(const b of balls){
for(let i=0;i<6;i++){
const p1=verts[i], p2=verts[(i+1)%6];
const ex=p2.x-p1.x, ey=p2.y-p1.y, len=Math.hypot(ex,ey);
const nx=ey/len, ny=-ex/len;
const midx=(p1.x+p2.x)/2, midy=(p1.y+p2.y)/2;
const inx=cx()-midx, iny=cy()-midy;
const sign=(nx*inx+ny*iny)>0?1:-1;
const nix=nx*sign, niy=ny*sign;
const dx=b.x-p1.x, dy=b.y-p1.y;
const dist=dx*nix+dy*niy;
if(dist<b.rad){
const overlap=b.rad-dist;
b.x+=nix*overlap; b.y+=niy*overlap;
const vn=b.vx*nix+b.vy*niy;
if(vn<0){
b.vx-=2*vn*nix; b.vy-=2*vn*niy;
const wallVx=-omega*(b.y-cy()), wallVy=omega*(b.x-cx());
b.vx+=wallVx*0.3; b.vy+=wallVy*0.3;
b.vx*=0.995; b.vy*=0.995;
}
}
}
}
for(let i=0;i<balls.length;i++){
for(let j=i+1;j<balls.length;j++){
const a=balls[i], b=balls[j];
const dx=b.x-a.x, dy=b.y-a.y, dist=Math.hypot(dx,dy), minD=a.rad+b.rad;
if(dist<minD && dist>0){
const nx=dx/dist, ny=dy/dist, overlap=(minD-dist)/2;
a.x-=nx*overlap; a.y-=ny*overlap; b.x+=nx*overlap; b.y+=ny*overlap;
const dvx=b.vx-a.vx, dvy=b.vy-a.vy, rel=dvx*nx+dvy*ny;
if(rel<0){ const imp=-rel; a.vx-=imp*nx; a.vy-=imp*ny; b.vx+=imp*nx; b.vy+=imp*ny; }
}
}
}
draw(verts);
requestAnimationFrame(step);
}
function draw(verts){
ctx.clearRect(0,0,cv.width,cv.height);
ctx.beginPath();
ctx.moveTo(verts[0].x,verts[0].y);
for(let i=1;i<6;i++) ctx.lineTo(verts[i].x,verts[i].y);
ctx.closePath();
ctx.strokeStyle='#eee'; ctx.lineWidth=4; ctx.stroke();
for(const b of balls){ ctx.beginPath(); ctx.arc(b.x,b.y,b.rad,0,Math.PI*2); ctx.fillStyle=b.color; ctx.fill(); }
}
requestAnimationFrame(step);
</script>
</body></html>▶ R23 · Pendulum waveOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Pendulum Wave</title>
<style>html,body{margin:0;background:#0b0b16;overflow:hidden}canvas{display:block}</style>
</head><body>
<canvas id="c"></canvas>
<script>
const cv=document.getElementById('c'), ctx=cv.getContext('2d');
function resize(){cv.width=innerWidth; cv.height=innerHeight;}
resize(); addEventListener('resize',resize);
const N=15, g=900, theta0=0.55;
const pends=[];
for(let i=0;i<N;i++){
const L=140+i*9, T=2*Math.PI*Math.sqrt(L/g);
pends.push({L,T,hue:(i*24)%360});
}
const start=performance.now();
function frame(now){
const t=(now-start)/1000;
ctx.fillStyle='rgba(11,11,22,0.25)';
ctx.fillRect(0,0,cv.width,cv.height);
const marginX=cv.width*0.07, spacing=(cv.width*0.86)/(N-1), anchorY=70;
for(let i=0;i<N;i++){
const p=pends[i], ax=marginX+i*spacing;
const ang=theta0*Math.cos(2*Math.PI*t/p.T);
const bx=ax+p.L*Math.sin(ang), by=anchorY+p.L*Math.cos(ang);
ctx.strokeStyle='rgba(255,255,255,0.5)'; ctx.lineWidth=2;
ctx.beginPath(); ctx.moveTo(ax,anchorY); ctx.lineTo(bx,by); ctx.stroke();
ctx.beginPath(); ctx.arc(ax,anchorY,3,0,Math.PI*2); ctx.fillStyle='#888'; ctx.fill();
ctx.beginPath(); ctx.arc(bx,by,14,0,Math.PI*2); ctx.fillStyle=`hsl(${p.hue},80%,60%)`; ctx.fill();
}
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script>
</body></html>▶ R24 · Maze race BFS/DFS/A*STAT★ 8/10 Open round →
📝 3 clean panels, DONE, full visited coloring; final path barely stands out (8.0)
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Maze Race</title>
<style>
body{margin:0;background:#111;color:#eee;font-family:sans-serif;display:flex;justify-content:center;gap:20px;padding:20px}
.panel{text-align:center}
canvas{background:#222;border:1px solid #555}
.status{margin-top:6px;font-weight:bold;height:20px;color:#4caf50}
</style></head><body>
<div class="panel"><h3>BFS</h3><canvas id="c0" width="300" height="300"></canvas><div class="status" id="s0"></div></div>
<div class="panel"><h3>DFS</h3><canvas id="c1" width="300" height="300"></canvas><div class="status" id="s1"></div></div>
<div class="panel"><h3>A*</h3><canvas id="c2" width="300" height="300"></canvas><div class="status" id="s2"></div></div>
<script>
const cols=25, rows=25, cs=12;
function idx(r,c){return r*cols+c;}
const walls=[];
for(let i=0;i<cols*rows;i++) walls.push({N:1,E:1,S:1,W:1});
(function carve(){
const seen=new Array(cols*rows).fill(false);
const stack=[0]; seen[0]=true;
const dirs=[[-1,0,'N','S'],[0,1,'E','W'],[1,0,'S','N'],[0,-1,'W','E']];
while(stack.length){
const cur=stack[stack.length-1], r=(cur/cols)|0, c=cur%cols, opts=[];
for(const [dr,dc,w1,w2] of dirs){
const nr=r+dr, nc=c+dc;
if(nr>=0&&nr<rows&&nc>=0&&nc<cols&&!seen[idx(nr,nc)]) opts.push([idx(nr,nc),w1,w2]);
}
if(opts.length){
const [ni,w1,w2]=opts[Math.floor(Math.random()*opts.length)];
walls[cur][w1]=0; walls[ni][w2]=0; seen[ni]=true; stack.push(ni);
} else stack.pop();
}
})();
function neighbors(i){
const r=(i/cols)|0, c=i%cols, res=[];
if(!walls[i].N) res.push(idx(r-1,c));
if(!walls[i].E) res.push(idx(r,c+1));
if(!walls[i].S) res.push(idx(r+1,c));
if(!walls[i].W) res.push(idx(r,c-1));
return res;
}
const start=0, goal=cols*rows-1;
function heur(i){ const r=(i/cols)|0, c=i%cols; return Math.abs(r-(rows-1))+Math.abs(c-(cols-1)); }
function* bfsGen(){
const visited=new Set([start]), queue=[start], parent={};
while(queue.length){
const cur=queue.shift();
if(cur===goal){ yield {cur,visited,parent,done:true}; return; }
yield {cur,visited};
for(const n of neighbors(cur)) if(!visited.has(n)){visited.add(n);parent[n]=cur;queue.push(n);}
}
}
function* dfsGen(){
const visited=new Set([start]), stack=[start], parent={};
while(stack.length){
const cur=stack.pop();
if(cur===goal){ yield {cur,visited,parent,done:true}; return; }
yield {cur,visited};
for(const n of neighbors(cur)) if(!visited.has(n)){visited.add(n);parent[n]=cur;stack.push(n);}
}
}
function* astarGen(){
const visited=new Set(), parent={}, g={[start]:0}, open=[[heur(start),start]];
while(open.length){
open.sort((a,b)=>a[0]-b[0]);
const [,cur]=open.shift();
if(visited.has(cur)) continue;
visited.add(cur);
if(cur===goal){ yield {cur,visited,parent,done:true}; return; }
yield {cur,visited};
for(const n of neighbors(cur)){
const ng=g[cur]+1;
if(g[n]===undefined||ng<g[n]){ g[n]=ng; parent[n]=cur; open.push([ng+heur(n),n]); }
}
}
}
const panels=[
{ctx:document.getElementById('c0').getContext('2d'), gen:bfsGen(), status:document.getElementById('s0'), color:'#4fc3f7'},
{ctx:document.getElementById('c1').getContext('2d'), gen:dfsGen(), status:document.getElementById('s1'), color:'#ffb142'},
{ctx:document.getElementById('c2').getContext('2d'), gen:astarGen(), status:document.getElementById('s2'), color:'#7e57c2'}
];
for(const p of panels){ p.visited=new Set(); p.cur=start; p.done=false; p.parent={}; }
function drawPanel(p){
const ctx=p.ctx; ctx.clearRect(0,0,300,300);
ctx.fillStyle=p.color;
for(const v of p.visited){ const r=(v/cols)|0, c=v%cols; ctx.fillRect(c*cs+1,r*cs+1,cs-2,cs-2); }
ctx.strokeStyle='#666'; ctx.lineWidth=1; ctx.beginPath();
for(let i=0;i<cols*rows;i++){
const r=(i/cols)|0, c=i%cols, x=c*cs, y=r*cs;
if(walls[i].N){ctx.moveTo(x,y);ctx.lineTo(x+cs,y);}
if(walls[i].W){ctx.moveTo(x,y);ctx.lineTo(x,y+cs);}
if(r===rows-1&&walls[i].S){ctx.moveTo(x,y+cs);ctx.lineTo(x+cs,y+cs);}
if(c===cols-1&&walls[i].E){ctx.moveTo(x+cs,y);ctx.lineTo(x+cs,y+cs);}
}
ctx.stroke();
ctx.fillStyle='#4caf50'; ctx.fillRect(1,1,cs-2,cs-2);
ctx.fillStyle='#f44336'; ctx.fillRect((cols-1)*cs+1,(rows-1)*cs+1,cs-2,cs-2);
if(p.done){
ctx.fillStyle='#ffeb3b';
let n=goal;
while(n!==undefined && n!==start){ const r=(n/cols)|0, c=n%cols; ctx.fillRect(c*cs+3,r*cs+3,cs-6,cs-6); n=p.parent[n]; }
p.status.textContent='DONE';
}
}
function tick(){
for(const p of panels){
if(p.done) continue;
for(let k=0;k<4;k++){
const res=p.gen.next();
if(res.done){ break; }
p.visited=res.value.visited; p.cur=res.value.cur;
if(res.value.done){ p.parent=res.value.parent; p.done=true; break; }
}
}
for(const p of panels) drawPanel(p);
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
</script>
</body></html>▶ R25 · Sorting race quick/merge/heapSTAT★ 8.5/10 Open round →
📝 3× sorted + DONE, left edge slightly clipped (8.5)
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Sort Race</title>
<style>
body{margin:0;background:#111;color:#eee;font-family:sans-serif;display:flex;justify-content:center;gap:20px;padding:20px}
.panel{text-align:center}
canvas{background:#222;border:1px solid #555}
.status{margin-top:6px;font-weight:bold;height:20px;color:#4caf50}
</style></head><body>
<div class="panel"><h3>Quicksort</h3><canvas id="c0" width="300" height="220"></canvas><div class="status" id="s0"></div></div>
<div class="panel"><h3>Mergesort</h3><canvas id="c1" width="300" height="220"></canvas><div class="status" id="s1"></div></div>
<div class="panel"><h3>Heapsort</h3><canvas id="c2" width="300" height="220"></canvas><div class="status" id="s2"></div></div>
<script>
const N=60;
const base=[];
for(let i=0;i<N;i++) base.push(10+Math.floor(Math.random()*200));
function shuffled(){ const a=base.slice(); 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 order=shuffled();
function quicksort(arr,lo,hi,steps){
if(lo>=hi) return;
const pivot=arr[hi]; let i=lo;
for(let j=lo;j<hi;j++){
if(arr[j]<pivot){ [arr[i],arr[j]]=[arr[j],arr[i]]; steps.push([0,i,j]); i++; }
}
[arr[i],arr[hi]]=[arr[hi],arr[i]]; steps.push([0,i,hi]);
quicksort(arr,lo,i-1,steps); quicksort(arr,i+1,hi,steps);
}
function mergesort(arr,lo,hi,steps){
if(hi-lo<1) return;
const mid=(lo+hi)>>1;
mergesort(arr,lo,mid,steps); mergesort(arr,mid+1,hi,steps);
const merged=[]; let i=lo,j=mid+1;
while(i<=mid&&j<=hi) merged.push(arr[i]<=arr[j]?arr[i++]:arr[j++]);
while(i<=mid) merged.push(arr[i++]);
while(j<=hi) merged.push(arr[j++]);
for(let k=0;k<merged.length;k++){ arr[lo+k]=merged[k]; steps.push([1,lo+k,merged[k]]); }
}
function heapify(arr,n,i,steps){
let largest=i, l=2*i+1, r=2*i+2;
if(l<n&&arr[l]>arr[largest]) largest=l;
if(r<n&&arr[r]>arr[largest]) largest=r;
if(largest!==i){ [arr[i],arr[largest]]=[arr[largest],arr[i]]; steps.push([0,i,largest]); heapify(arr,n,largest,steps); }
}
function heapsort(arr,steps){
const n=arr.length;
for(let i=(n>>1)-1;i>=0;i--) heapify(arr,n,i,steps);
for(let i=n-1;i>0;i--){ [arr[0],arr[i]]=[arr[i],arr[0]]; steps.push([0,0,i]); heapify(arr,i,0,steps); }
}
const steps0=[], steps1=[], steps2=[];
quicksort(order.slice(),0,N-1,steps0);
mergesort(order.slice(),0,N-1,steps1);
heapsort(order.slice(),steps2);
const panels=[
{ctx:document.getElementById('c0').getContext('2d'), steps:steps0, status:document.getElementById('s0')},
{ctx:document.getElementById('c1').getContext('2d'), steps:steps1, status:document.getElementById('s1')},
{ctx:document.getElementById('c2').getContext('2d'), steps:steps2, status:document.getElementById('s2')}
];
for(const p of panels){ p.arr=order.slice(); p.i=0; p.hi=[]; }
function applyStep(p){
const s=p.steps[p.i];
if(!s) return;
if(s[0]===0){ const a=s[1], b=s[2]; [p.arr[a],p.arr[b]]=[p.arr[b],p.arr[a]]; p.hi=[a,b]; }
else { const a=s[1], v=s[2]; p.arr[a]=v; p.hi=[a]; }
p.i++;
}
function drawPanel(p){
const ctx=p.ctx, w=300/N;
ctx.clearRect(0,0,300,220);
for(let k=0;k<N;k++){
const val=p.arr[k], h=val*0.9;
ctx.fillStyle=p.hi.includes(k)?'#ffeb3b':(p.i>=p.steps.length?'#4caf50':'#4fc3f7');
ctx.fillRect(k*w+1,220-h,w-2,h);
}
if(p.i>=p.steps.length) p.status.textContent='DONE';
}
function tick(){
for(const p of panels){
if(p.i<p.steps.length){ for(let k=0;k<3&&p.i<p.steps.length;k++) applyStep(p); }
}
for(const p of panels) drawPanel(p);
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
</script>
</body></html>▶ R26 · Projectile ballisticsOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Projectiles</title>
<style>body{margin:0;background:#0a0e1a;overflow:hidden}canvas{display:block}</style></head>
<body><canvas id="c"></canvas>
<script>
const cvs=document.getElementById('c'),ctx=cvs.getContext('2d');
function resize(){cvs.width=innerWidth;cvs.height=innerHeight}
resize();addEventListener('resize',resize);
const g=400,v0=280,angles=[20,35,50,65,75];
const colors=['#ff5555','#ffb347','#ffe066','#66ff99','#66ccff'];
let originX,groundY,balls,t0,restarting=false;
function init(){
originX=80;groundY=cvs.height-60;
balls=angles.map((a,i)=>({a:a*Math.PI/180,color:colors[i],trail:[],landed:false,landX:0}));
t0=performance.now();restarting=false;
}
init();
function frame(now){
const t=(now-t0)/1000;
ctx.fillStyle='rgba(10,14,26,0.25)';
ctx.fillRect(0,0,cvs.width,cvs.height);
ctx.strokeStyle='#334';ctx.beginPath();
ctx.moveTo(0,groundY);ctx.lineTo(cvs.width,groundY);ctx.stroke();
let allLanded=true;
balls.forEach(b=>{
const vx=v0*Math.cos(b.a),vy=v0*Math.sin(b.a);
let x=originX+vx*t, y=groundY-(vy*t-0.5*g*t*t);
if(t>0.05 && y>=groundY && !b.landed){b.landed=true;b.landX=x;}
if(b.landed){x=b.landX;y=groundY;} else allLanded=false;
b.trail.push({x,y});
if(b.trail.length>400)b.trail.shift();
for(let i=0;i<b.trail.length;i++){
const p=b.trail[i];
ctx.globalAlpha=i/b.trail.length;
ctx.fillStyle=b.color;
ctx.fillRect(p.x-1.5,p.y-1.5,3,3);
}
ctx.globalAlpha=1;
ctx.beginPath();ctx.arc(x,y,6,0,7);ctx.fillStyle=b.color;ctx.fill();
if(b.landed){
ctx.strokeStyle=b.color;
ctx.beginPath();ctx.moveTo(b.landX,groundY-10);ctx.lineTo(b.landX,groundY+10);ctx.stroke();
ctx.fillStyle=b.color;ctx.font='12px sans-serif';
ctx.fillText(Math.round(b.landX-originX)+'m',b.landX-15,groundY+25);
}
});
ctx.beginPath();ctx.arc(originX,groundY,5,0,7);ctx.fillStyle='#fff';ctx.fill();
if(allLanded && t>1 && !restarting){restarting=true;setTimeout(init,1200);}
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script></body></html>▶ R27 · Double-pendulum chaosOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Double Pendulum Chaos</title>
<style>body{margin:0;background:#000;overflow:hidden}canvas{display:block}</style></head>
<body><canvas id="c"></canvas>
<script>
const cvs=document.getElementById('c'),ctx=cvs.getContext('2d');
function resize(){cvs.width=innerWidth;cvs.height=innerHeight}
resize();addEventListener('resize',resize);
const g=1200,l1=110,l2=110,m1=10,m2=10;
const cx=()=>cvs.width/2, cy=()=>cvs.height/3;
function makeP(offset,color){
return {a1:Math.PI/2+offset,a2:Math.PI/2,w1:0,w2:0,color,trail:[]};
}
let pends=[makeP(0,'#ff5577'),makeP(0.001,'#55ccff')];
function deriv(a1,a2,w1,w2){
const den=(2*m1+m2-m2*Math.cos(2*a1-2*a2));
const num1=-g*(2*m1+m2)*Math.sin(a1)-m2*g*Math.sin(a1-2*a2)-2*Math.sin(a1-a2)*m2*(w2*w2*l2+w1*w1*l1*Math.cos(a1-a2));
const dw1=num1/(l1*den);
const num2=2*Math.sin(a1-a2)*(w1*w1*l1*(m1+m2)+g*(m1+m2)*Math.cos(a1)+w2*w2*l2*m2*Math.cos(a1-a2));
const dw2=num2/(l2*den);
return [w1,w2,dw1,dw2];
}
function step(p,dt){
const [da1,da2,dw1,dw2]=deriv(p.a1,p.a2,p.w1,p.w2);
p.a1+=da1*dt;p.a2+=da2*dt;p.w1+=dw1*dt;p.w2+=dw2*dt;
}
function frame(){
ctx.fillStyle='rgba(0,0,0,0.12)';
ctx.fillRect(0,0,cvs.width,cvs.height);
const ox=cx(),oy=cy();
pends.forEach(p=>{
for(let i=0;i<10;i++)step(p,0.0015);
const x1=ox+l1*Math.sin(p.a1), y1=oy+l1*Math.cos(p.a1);
const x2=x1+l2*Math.sin(p.a2), y2=y1+l2*Math.cos(p.a2);
p.trail.push({x:x2,y:y2});
if(p.trail.length>600)p.trail.shift();
ctx.beginPath();
p.trail.forEach((pt,i)=>{
if(i===0)ctx.moveTo(pt.x,pt.y);else ctx.lineTo(pt.x,pt.y);
});
ctx.strokeStyle=p.color;ctx.globalAlpha=0.5;ctx.lineWidth=1.5;ctx.stroke();
ctx.globalAlpha=1;
ctx.beginPath();ctx.moveTo(ox,oy);ctx.lineTo(x1,y1);ctx.lineTo(x2,y2);
ctx.strokeStyle='#888';ctx.lineWidth=2;ctx.stroke();
ctx.beginPath();ctx.arc(x1,y1,5,0,7);ctx.fillStyle='#ccc';ctx.fill();
ctx.beginPath();ctx.arc(x2,y2,7,0,7);ctx.fillStyle=p.color;ctx.fill();
});
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script></body></html>▶ R28 · Particle fountainOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Particle Fountain</title>
<style>
body{margin:0;background:#0a1020;overflow:hidden;font-family:sans-serif}
#ui{position:fixed;top:10px;left:10px;color:#fff;z-index:2}
canvas{display:block}
</style></head>
<body>
<div id="ui">Wind: <span id="wv">0</span><br><input id="wind" type="range" min="-200" max="200" value="0"></div>
<canvas id="c"></canvas>
<script>
const cvs=document.getElementById('c'),ctx=cvs.getContext('2d');
function resize(){cvs.width=innerWidth;cvs.height=innerHeight}
resize();addEventListener('resize',resize);
const windEl=document.getElementById('wind'),wv=document.getElementById('wv');
let wind=0;
windEl.addEventListener('input',()=>{wind=+windEl.value;wv.textContent=wind;});
const g=500,floorY=()=>cvs.height-20;
const N=200,particles=[];
function spawn(p){
p.x=cvs.width/2;p.y=cvs.height-20;
const spread=0.5;
const ang=-Math.PI/2+(Math.random()-0.5)*spread;
const speed=250+Math.random()*150;
p.vx=Math.cos(ang)*speed;p.vy=Math.sin(ang)*speed;
p.energy=1;p.hue=180+Math.random()*80;
}
for(let i=0;i<N;i++){const p={};spawn(p);p.y-=Math.random()*400;particles.push(p);}
function frame(){
ctx.fillStyle='rgba(10,16,32,0.2)';
ctx.fillRect(0,0,cvs.width,cvs.height);
ctx.strokeStyle='#345';ctx.beginPath();
ctx.moveTo(0,floorY());ctx.lineTo(cvs.width,floorY());ctx.stroke();
const dt=0.016;
particles.forEach(p=>{
p.vy+=g*dt;p.vx+=wind*dt;
p.x+=p.vx*dt;p.y+=p.vy*dt;
if(p.y>floorY()){
p.y=floorY();
p.vy*=-0.55;p.vx*=0.85;
p.energy*=0.7;
}
if(Math.abs(p.vy)<15 && p.energy<0.15){spawn(p);}
if(p.x<0||p.x>cvs.width){spawn(p);}
ctx.beginPath();ctx.arc(p.x,p.y,2.5,0,7);
ctx.fillStyle=`hsla(${p.hue},90%,60%,0.85)`;
ctx.fill();
});
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script></body></html>▶ R29 · Orbital mechanicsOK★ 8.5/10 Open round →
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Orbital Mechanics</title>
<style>body{margin:0;background:#000;overflow:hidden}canvas{display:block}</style></head>
<body><canvas id="c"></canvas>
<script>
const cvs=document.getElementById('c'),ctx=cvs.getContext('2d');
function resize(){cvs.width=innerWidth;cvs.height=innerHeight}
resize();addEventListener('resize',resize);
const G=800000,M=1;
function cx(){return cvs.width/2}
function cy(){return cvs.height/2}
function circular(r,dir=1){
const v=Math.sqrt(G*M/r);
return {x:cx()+r,y:cy(),vx:0,vy:dir*v,color:'#fff',trail:[]};
}
let bodies=[
Object.assign(circular(90),{color:'#88ccff'}),
Object.assign(circular(150),{color:'#ffcc66'}),
Object.assign(circular(220),{color:'#88ff99'}),
];
const comet=(()=>{
const r=320,vcirc=Math.sqrt(G*M/r);
return {x:cx()+r,y:cy(),vx:0,vy:vcirc*0.45,color:'#ff6688',trail:[]};
})();
bodies.push(comet);
function frame(){
ctx.fillStyle='rgba(0,0,0,0.15)';
ctx.fillRect(0,0,cvs.width,cvs.height);
const steps=6,dt=0.004;
for(let s=0;s<steps;s++){
bodies.forEach(b=>{
const dx=cx()-b.x,dy=cy()-b.y;
const dist=Math.max(Math.hypot(dx,dy),8);
const a=G*M/(dist*dist);
b.vx+=a*(dx/dist)*dt;b.vy+=a*(dy/dist)*dt;
b.x+=b.vx*dt;b.y+=b.vy*dt;
});
}
ctx.beginPath();ctx.arc(cx(),cy(),14,0,7);
const grad=ctx.createRadialGradient(cx(),cy(),0,cx(),cy(),14);
grad.addColorStop(0,'#fff8dd');grad.addColorStop(1,'#ffaa00');
ctx.fillStyle=grad;ctx.fill();
bodies.forEach(b=>{
b.trail.push({x:b.x,y:b.y});
if(b.trail.length>500)b.trail.shift();
ctx.beginPath();
b.trail.forEach((p,i)=>{if(i===0)ctx.moveTo(p.x,p.y);else ctx.lineTo(p.x,p.y);});
ctx.strokeStyle=b.color;ctx.globalAlpha=0.4;ctx.lineWidth=1;ctx.stroke();
ctx.globalAlpha=1;
ctx.beginPath();ctx.arc(b.x,b.y,5,0,7);ctx.fillStyle=b.color;ctx.fill();
});
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script></body></html>▶ R30 · Spring-mass chainSTAT★ 8/10 Open round →
📝 chain settles correctly, anchor marked (8.0); drag not testable headless
Show code
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Spring Chain</title>
<style>body{margin:0;background:#101418;overflow:hidden}canvas{display:block;cursor:grab}</style></head>
<body><canvas id="c"></canvas>
<script>
const cvs=document.getElementById('c'),ctx=cvs.getContext('2d');
function resize(){cvs.width=innerWidth;cvs.height=innerHeight}
resize();addEventListener('resize',resize);
const N=12,k=180,damping=0.94,anchorK=400,mass=1;
let pts=[];
function layout(){
const margin=80,w=cvs.width-margin*2,y=cvs.height/2;
pts=[];
for(let i=0;i<N;i++){
const hx=margin+w*i/(N-1);
pts.push({x:hx,y,vx:0,vy:0,hx,hy:y});
}
}
layout();addEventListener('resize',layout);
let dragIdx=-1,mouse={x:0,y:0};
cvs.addEventListener('mousedown',e=>{
const mx=e.clientX,my=e.clientY;
let best=-1,bd=25;
pts.forEach((p,i)=>{const d=Math.hypot(p.x-mx,p.y-my);if(d<bd){bd=d;best=i;}});
dragIdx=best;
});
addEventListener('mousemove',e=>{mouse.x=e.clientX;mouse.y=e.clientY;});
addEventListener('mouseup',()=>{dragIdx=-1;});
function frame(){
ctx.fillStyle='#101418';
ctx.fillRect(0,0,cvs.width,cvs.height);
for(let i=0;i<N;i++){
const p=pts[i];
if(i===dragIdx){
p.vx=(mouse.x-p.x)*10;p.vy=(mouse.y-p.y)*10;
p.x=mouse.x;p.y=mouse.y;
continue;
}
let fx=0,fy=0;
if(i>0){
const q=pts[i-1],restLen=Math.hypot(q.hx-p.hx,q.hy-p.hy);
const dx=q.x-p.x,dy=q.y-p.y,len=Math.hypot(dx,dy)||1;
const f=k*(len-restLen);
fx+=f*dx/len;fy+=f*dy/len;
}
if(i<N-1){
const q=pts[i+1],restLen=Math.hypot(q.hx-p.hx,q.hy-p.hy);
const dx=q.x-p.x,dy=q.y-p.y,len=Math.hypot(dx,dy)||1;
const f=k*(len-restLen);
fx+=f*dx/len;fy+=f*dy/len;
}
if(i===0||i===N-1){
fx+=(p.hx-p.x)*anchorK;fy+=(p.hy-p.y)*anchorK;
}
p.vx+=fx/mass*0.016;p.vy+=fy/mass*0.016;
p.vx*=damping;p.vy*=damping;
p.x+=p.vx*0.016;p.y+=p.vy*0.016;
}
ctx.strokeStyle='#5a7';ctx.lineWidth=2;
ctx.beginPath();
for(let i=0;i<N-1;i++){
ctx.moveTo(pts[i].x,pts[i].y);ctx.lineTo(pts[i+1].x,pts[i+1].y);
}
ctx.stroke();
pts.forEach((p,i)=>{
ctx.beginPath();ctx.arc(p.x,p.y,i===dragIdx?12:8,0,7);
ctx.fillStyle=i===dragIdx?'#ffcc33':(i===0||i===N-1?'#ff6666':'#66ccff');
ctx.fill();
});
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script></body></html>Answer excerpts above cover R6–R30. Classic rounds R1–R5 live on their own round pages and aren't duplicated here.