Overview › Code › R89
Code · blind round

R89 · Marching squares on a moving field

blind round 6/11 local models answered

Every answer below carries the name of the model that wrote it. Blind refers to the scoring: the review was done without knowing which model produced which answer — the published result names them.

2 of the 11 local models delivered nothing through our test harness in this round — for reasons that lie with our setup, not with the models. Those cards are marked DNF like any other, but they are not evidence about those models — the reason is noted on the card itself.

Show task
Create ONE self-contained HTML file (STRICT LIMIT: max 7000 characters in total — this is a budget on characters, not on lines, so removing line breaks does not help) that traces contour lines through a moving scalar field with marching squares on a <canvas>: build the field from a handful of drifting metaballs, evaluate it on a grid, and draw iso-lines at several thresholds using the marching-squares cases, interpolating each crossing along the cell edge so the outlines stay smooth while blobs merge and separate. Show the number of line segments drawn. Smooth requestAnimationFrame animation, NO user input, starts immediately and keeps running (restart with a fresh random instance when finished). No external libraries, no comments needed. Output ONLY the HTML file content, nothing else.

The answers

Local models (Brain cluster) — identical prompt, shuffled order (the sequence is not a ranking)
qwen3:14bBLANKLIM
Show code
<!DOCTYPE html>
<html><head><title>Metaball Contour Flow</title><style>body{margin:0;overflow:hidden}canvas{display:block}</style></head><body id="b"><canvas id="c"></canvas><script>
    const b = document.getElementById('b');
    const c = document.getElementById('c');
    let ctx = c.getContext('2d');

    // Configuration constants
    const W = 800;
    const H = 600;
    const GRID_S = 15; // Grid step size
    const NUM_BALLS = 4;
    const ISOLEVELS = [0.2, 0.4, 0.6];
    const ALPHA = 30; // Metaball influence radius (squared)

    c.width = W;
    c.height = H;

    // State variables
    let balls = [];
    let timeOffset = 0;

    function setup() {
        balls = [];
        for (let i = 0; i < NUM_BALLS; i++) {
            balls.push({
                x: Math.random() * W,
                y: Math.random() * H,
                vx: (Math.random() - 0.5) * 0.3,
                vy: (Math.random() - 0.5) * 0.3,
                r: 10 + Math.random() * 10
            });
        }
        timeOffset = 0;
    }

    function updateBalls(dt) {
        for (let i = 0; i < NUM_BALLS; i++) {
            const b = balls[i];
            b.x += b.vx * dt;
            b.y += b.vy * dt;
            // Bounce off edges
            if (b.x < 0 || b.x > W) { b.vx *= -1; }
            if (b.y < 0 || b.y > H) { b.vy *= -1; }
        }
    }

    function getField(gx, gy, t) {
        let sum = 0;
        for (let i = 0; i < NUM_BALLS; i++) {
            const b = balls[i];
            const dx = Math.pow(b.x - gx, 2) + Math.pow(b.y - gy, 2);
            // Metaball influence: sum of inverse distance squared
            sum += (ALPHA / (dx + 1e-6));
        }
        return sum;
    }

    function drawContours() {
        ctx.clearRect(0, 0, W, H);
        ctx.strokeStyle = 'rgba(150, 200, 255, 0.8)';
        ctx.lineWidth = 1.5;

        for (let k = 0; k < ISOLEVELS.length; k++) {
            const T = ISOLEVELS[k];
            ctx.beginPath();

            for (let j = 0; j < W / GRID_S; j++) {
                for (let i = 0; i < H / GRID_S; i++) {
                    // Corner coordinates (relative to grid cell top-left)
                    const x0 = j * GRID_S;
                    const y0 = i * GRID_S;
                    const x1 = x0 + GRID_S;
                    const y1 = y0 + GRID_S;

                    // Field values at the four corners of the cell (i,j)
                    const f00 = getField(x0, y0, timeOffset); // Top-Left
                    const f10 = getField(x1, y0, timeOffset); // Top-Right
                    const f01 = getField(x0, y1, timeOffset); // Bottom-Left
                    const f11 = getField(x1, y1, timeOffset); // Bottom-Right

                    // Check the 4 bits to determine the marching squares case index (0-15)
                    let bits = ((f00 < T ? 0 : 1) << 3) |
                               (f10 < T ? 0 : 1) << 2 |
                               (f01 < T ? 0 : 1) << 1 |
                               (f11 < T ? 0 : 1);

                    // Simplified marching squares implementation (Case logic via lookup/interpolation)
                    if (bits === -1 || bits > 15) continue; // Should not happen

                    let vertices = [];
                    const cells = [
                        [x0, y0], [x1, y0], [x1, y1], [x0, y1]
                    ];
                    const f = [f00, f10, f11, f01];

                    // Iterate over 4 edges: top (j), right (i), bottom (j), left (i)
                    for(let dir=0; dir<2; dir++) { // Vertical direction (y axis)
                        for(let step=0; step < Math.floor((W / GRID_S)); step++) {
                            const x = step * GRID_S;
                            const y_start = (dir === 0 ? 0 : H - GRID_S);

                            // Only draw the top edge of a cell if it's not the bottom row, etc.
                            if ((dir == 0 && i < Math.floor(H / GRID_S) -1) || (dir == 1 && i > 0)) {
                                // Simplified calculation for interpolation along edges:
                                // We check the transition between cells/grid points to draw lines segment by segment,
                                // but due to complexity and size constraints, we use a robust corner-based approach
                                // that relies on general linear interpolation across cell boundaries.

                                let p0 = [x0, y0], p1 = [x1, y0];
                                let q0 = [x0, y1], q1 = [x1, y1];

                                const getIntersection = (pA, pB, fA, fB) => {
                                    if ((fA < T && fB < T) || (fA > T && fB > T)) return null;
                                    return Math.sqrt(Math.pow(pB[0] - pA[0], 2) + Math.pow(pB[1] - pA[1], 2)) * Math.min(Math.abs(fA - T), Math.abs(fB - T)) / Math.max(Math.abs(fA - fB), 0.01);
                                };

                                // This is a placeholder for full marching squares logic, which is massive.
                                // Given the severe size limit and complexity, we simplify to drawing smooth lines by connecting interpolated points at cell boundaries.

                                // Due to extreme character constraints, standard implementation of all 16 cases + interpolation is impossible.
                                // Instead, we trace contours by iterating through all edges and calculating intersections if values cross T.

                                const drawEdge = (pA, pB, fA, fB) => {
                                    if (((fA < T && fB >= T) || (fA >= T && fB < T))) {
                                        // Linear interpolation: Intersection point P where F(P)=T
                                        const ratio = Math.abs(fA - T) / Math.abs(fB - T);
                                        const x_interp = pA[0] + (pB[0] - pA[0]) * ratio;
                                        const y_interp = pA[1] + (pB[1] - pA[1]) * ratio;

                                        // Only draw if the point is far enough from previous points to prevent jittering
                                        ctx.lineTo(x_interp, y_interp);
                                    } else {
                                        ctx.moveTo(0, 0); // Start new segment
                                    }
                                };

                                // Top Edge (y=y0)
                                drawEdge([x0, y0], [x1, y0], f00, f10);
                                // Right Edge (x=x1)
                                drawEdge([x1, y0], [x1, y1], f10, f11);
                                // Bottom Edge (y=y1)
                                drawEdge([x1, y1], [x0, y1], f11, f01);
                                // Left Edge (x=x0)
                                drawEdge([x0, y1], [x0, y0], f01, f00);

                            } else {
                                ctx.moveTo(0, 0); // Start new contour line segment
                            }
                        }
                    }
                }
            }
        }
    }

    function animate(timestamp) {
        // Update time based on elapsed time (simulating dt)
        const dt = 0.01;

        updateBalls(dt);
        drawContours();

        requestAnimationFrame(animate);
    }

    setup();
    animate(0);
</script></body></html>
llama3.1:8bERRBLANKFORMAT
Show code
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Metaball Contour Lines</title>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body>
<canvas id="c" width="600" height="400"></canvas>

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

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

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

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

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

function draw() {
  ctx.clearRect(0,0,c.width,c.height);
  for (let t=4; t>=-4; --t) {
    let d = getScalar(c.width/2, c.height/2+t);
    if (!isNaN(d)) {
      let xoff = Math.floor((c.width * (d+4))/8),
          yoff = Math.floor((c.height * (d+4))/16);
      for (let x=0; x<c.width; ++x) {
        let sy, s;
        for (let y=0; y<2; ++y) {
          sy = c.height-1-yoff+y*2;
          s = getScalar(x, sy);
          if (!isNaN(s)) {
            ctx.beginPath();
            ctx.moveTo(x, sy);
            switch (Math.floor((s+4)*6)%16) {
              case 0: ctx.lineTo(x, sy); break;
              case 1: ctx.lineTo(x+c.width/32, sy+c.height/64); break;
              case 2: ctx.lineTo(x+c.width/32, sy-c.height/64); break;
              case 3: ctx.lineTo(x, sy); break;
              case 4: ctx.lineTo(x-c.width/32, sy+c.height/64); break;
              case 5: ctx.lineTo(x-c.width/32, sy-c.height/64); break;
              case 6: ctx.lineTo(x, sy); break;
              case 7: ctx.lineTo(x-c.width/16, sy); break;
              case 8:
                let m = sign(c.width*0.375-x, x),
                    n = sign(m*c.height*1.25-y, y);
                ctx.lineTo(x+c.width/32*m, sy+n*c.height/64);
                break;
              case 9: ctx.lineTo(x-c.width/16, sy); break;
              case 10:
                let m = sign(c.width*0.6875-x, x),
                    n = sign(m*c.height*1.25-y, y);
                ctx.lineTo(x+c.width/32*m, sy+n*c.height/64);
                break;
              case 11: ctx.lineTo(x, sy); break;
              case 12:
                let m = sign(c.width*0.8125-x, x),
                    n = sign(m*c.height*1.25-y, y);
                ctx.lineTo(x-c.width/32*m, sy+n*c.height/64);
                break;
              case 13: ctx.lineTo(x, sy); break;
              case 14:
                let m = sign(c.width*0.9375-x, x),
                    n = sign(m*c.height*1.25-y, y);
                ctx.lineTo(x-c.width/32*m, sy+n*c.height/64);
                break;
              case 15: ctx.lineTo(x, sy); break;
            }
          }
        }
      }
    }
  }
  let segs = 0;
  for (let x=0; x<c.width; ++x)
    for (let y=0; y<c.height-1; ++y) {
      s = getScalar(x,y);
      if (!isNaN(s)) {
        ctx.beginPath();
        ctx.moveTo(x, c.height-1-y);
        switch (Math.floor(s*8)%16) {
          case 0: ctx.lineTo(x, c.height-1-y); break;
          case 1: ctx.lineTo(x+c.width/32, c.height-1-(y-c.height/64)); break;
          case 2: ctx.lineTo(x+c.width/32, c.height-1-(y+c.height/64)); break;
          case 3: ctx.lineTo(x, c.height-1-y); break;
          case 4: ctx.lineTo(x-c.width/32, c.height-1-(y+c.height/64)); break;
          case 5: ctx.lineTo(x-c.width/32, c.height-1-(y-c.height/64)); break;
          case 6: ctx.lineTo(x, c.height-1-y); break;
          case 7:
            let m = sign(c.width*0.375-x, x),
                n = sign(m*c.height*1.25-(c.height-1-y), y);
            ctx.lineTo(x+c.width/32*m, c.height-1-(y+n*c.height/64));
            break;
          case 8: ctx.lineTo(x, c.height-1-y); break;
          case 9:
            let m = sign(c.width*0.6875-x, x),
                n = sign(m*c.height*1.25-(c.height-1-y), y);
            ctx.lineTo(x-c.width/32*m, c.height-1-(y+n*c.height/64));
            break;
          case 10: ctx.lineTo(x, c.height-1-y); break;
          case 11:
            let m = sign(c.width*0.8125-x, x),
                n = sign(m*c.height*1.25-(c.height-1-y), y);
            ctx.lineTo(x-c.width/32*m, c.height-1-(y+n*c.height/64));
            break;
          case 12: ctx.lineTo(x, c.height-1-y); break;
          case 13:
            let m = sign(c.width*0.9375-x, x),
                n = sign(m*c.height*1.25-(c.height-1-y), y);
            ctx.lineTo(x-c.width/32*m, c.height-1-(y+n*c.height/64));
            break;
          case 14: ctx.lineTo(x, c.height-1-y); break;
          case 15:
            let m = sign(c.width*0.996875-x, x),
                n = sign(m*c.height*1.25-(c.height-1-y), y);
            ctx.lineTo(x-c.width/32*m, c.height-1-(y+n*c.height/64));
            break;
          case 16:
            let m = sign(c.width*0.999875-x, x),
                n = sign(m*c.height*1.25-(c.height-1-y), y);
            ctx.lineTo(x-c.width/32*m, c.height-1-(y+n*c.height/64));
            break;
        }
      }
    }
  for (let dy=0; dy<10; ++dy)
    for (let dx=0; dx<10; ++dx) {
      if ((random(100)%2==0)&&(random(100)%2==0)) {
        s = getScalar(dx*30+c.width/2, dy*30+c.height/2);
        if (!isNaN(s))
          ctx.beginPath();
      }
    }
  segs += ctx.linePathLength;
  console.log(segs + " line segments drawn.");
}

function anim() { draw(); requestAnimationFrame(anim); }

document.addEventListener("DOMContentLoaded", function(){
  metaballs.forEach((b, i) => b.r = Math.floor(random(10)+5));
  document.body.requestFullscreen();
  anim();
});
</script>
</body>
</html>
```
qwen3.5:9bOKFORMAT
Show code
```html
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><title>Metaball Contour Tracer</title><style>body{margin:0;overflow:hidden}canvas{display:block}</style></head><body onload="init()"><canvas id="c"></canvas><script>
let c, ctx;
const COORDS = { W: 800, H: 600 };
const GRID_RES = 32; // Grid size (N x N)
const THRESHOLD = [0.5, 1.0, 1.5];

let metaballs = [];
let animationFrameId = null;

function init() {
    c = document.getElementById('c');
    ctx = c.getContext('2d');
    c.width = COORDS.W;
    c.height = COORDS.H;
    resetState();
}

function resetState() {
    metaballs = [];
    for (let i = 0; i < 4; i++) {
        metaballs.push({ x: Math.random() * COORDS.W, y: Math.random() * COORDS.H, r: 80 + Math.random() * 50 });
    }
    if (animationFrameId) cancelAnimationFrame(animationFrameId);
    animate();
}

function metaballField(x, y) {
    let sum = 0;
    for (const m of metaballs) {
        const dx = x - m.x;
        const dy = y - m.y;
        const distSq = dx * dx + dy * dy;
        sum += Math.exp(-distSq / (m.r * m.r * 0.7));
    }
    return sum;
}

function calculateGrid() {
    const grid = [];
    for (let i = 0; i < GRID_RES; i++) {
        grid[i] = [];
        for (let j = 0; j < GRID_RES; j++) {
            const x = (j / (GRID_RES - 1)) * COORDS.W;
            const y = (i / (GRID_RES - 1)) * COORDS.H;
            grid[i][j] = metaballField(x, y);
        }
    }
    return grid;
}

function marchSquares(grid) {
    ctx.clearRect(0, 0, COORDS.W, COORDS.H);
    let lineSegmentsDrawn = 0;

    for (let i = 0; i < GRID_RES - 1; i++) {
        for (let j = 0; j < GRID_RES - 1; j++) {
            const v = grid[i][j];
            const h = grid[i+1][j];
            const w = grid[i][j+1];
            const e = grid[i+1][j+1];

            let caseNum = 0;
            if (v < THRESHOLD[0] && h < THRESHOLD[0]) caseNum |= 1;
            else if (v > THRESHOLD[0] && h > THRESHOLD[0]) caseNum |= 1;

            if (w < THRESHOLD[0] && e < THRESHOLD[0]) caseNum |= 2;
            else if (w > THRESHOLD[0] && e > THRESHOLD[0]) caseNum |= 2;

            // Simplified Case Check (requires looping over all thresholds)
            for(let k=0; k<THRESHOLD.length; k++) {
                const T = THRESHOLD[k];
                let currentCase = 0;

                if ((v < T && h < T) || (v > T && h > T)) currentCase |= 1;
                else if (!((v < T && h < T) || (v > T && h > T))) currentCase ^= 1; // Toggle based on threshold crossing

                if ((w < T && e < T) || (w > T && e > T)) currentCase |= 2;
                else if (!((w < T && e < T) || (w > T && e > T))) currentCase ^= 2;

                // Instead of full case logic, we iterate over edges and interpolate:
                let count = 0;
                const checkEdge = (p1, p2, threshold) => {
                    if ((p1 < threshold && p2 >= threshold) || (p1 >= threshold && p2 < threshold)) {
                        // Interpolate crossing point: P_cross = p1 + (p2 - p1) * ratio. Ratio = T - p1 / (p2 - p1)
                        const r = (threshold - p1) / (p2 - p1);
                        return { x: Math.round((j + r) * COORDS.W / (GRID_RES - 1)), y: Math.round(i * COORDS.H / (GRID_RES - 1)) };
                    }
                    return null;
                };

                // Check horizontal edges (v-w, h-e)
                const crossVW = checkEdge(v, w, T);
                if (crossVW) { lineSegmentsDrawn++; ctx.lineTo(crossVW.x, i * COORDS.H / (GRID_RES - 1)); }

                // Check vertical edges (v-h, w-e)
                const crossVh = checkEdge(v, h, T);
                if (crossVh) { lineSegmentsDrawn++; ctx.lineTo((j * COORDS.W / (GRID_RES - 1)), crossVh.y); }

                // This simple edge tracing is sufficient for visualization and complexity management:
                ctx.strokeStyle = `rgba(255,${Math.floor(k*30)},0,0.8)`;
                ctx.lineWidth = 1;
                ctx.beginPath();
            }
        }
    }

    // Simplified drawing pass that iterates through all relevant edges and interpolates crossings for ALL thresholds.
    ctx.globalCompositeOperation = 'source-over';
    let totalSegments = 0;

    for(let k=0; k<THRESHOLD.length; k++) {
        const T = THRESHOLD[k];
        ctx.strokeStyle = `rgba(255,${Math.floor((k+1)*30)},0,0.8)`;
        ctx.lineWidth = 1;

        for (let i = 0; i < GRID_RES - 1; i++) {
            // Vertical edges: Across row i to i+1
            for (let j = 0; j < GRID_RES - 1; j++) {
                const p1 = grid[i][j];
                const p2 = grid[i+1][j];
                if ((p1 * p2) < T * T && Math.abs(p1 - p2) > 0.01) {
                    let r = (T - p1) / (p2 - p1);
                    const x = j * COORDS.W / (GRID_RES - 1);
                    const y = i + r * (COORDS.H / (GRID_RES - 1));
                    ctx.lineTo(x, y); totalSegments++;
                }
            }

            // Horizontal edges: Across column j to j+1
            for (let j = 0; j < GRID_RES - 1; j++) {
                const p1 = grid[i][j];
                const p2 = grid[i][j+1];
                 if ((p1 * p2) < T * T && Math.abs(p1 - p2) > 0.01) {
                    let r = (T - p1) / (p2 - p1);
                    const x = j + r * (COORDS.W / (GRID_RES - 1));
                    const y = i * COORDS.H / (GRID_RES - 1);
                    ctx.lineTo(x, y); totalSegments++;
                }
            }
        }
    }

    // Draw all paths found in this frame
    ctx.stroke();
    document.getElementById('segments').innerText = `Segments: ${totalSegments}`;
}


function animate() {
    // Update metaball positions slightly for movement
    metaballs.forEach(m => {
        m.x += (Math.random() - 0.5) * 1.5;
        m.y += (Math.random() - 0.5) * 1.5;
        if (m.x < 0 || m.x > COORDS.W) m.x = Math.random() * COORDS.W;
        if (m.y < 0 || m.y > COORDS.H) m.y = Math.random() * COORDS.H;
        m.r = 70 + Math.sin(Date.now()/500) * 30 + Math.random() * 20; // Pulsing radius
    });

    const grid = calculateGrid();
    marchSquares(grid);

    animationFrameId = requestAnimationFrame(animate);
}
</script>
<div id="segments" style="position:absolute; top:10px; left:10px; color:#333;">Loading...</div>
</html>
```
mistral-small:24bERRBLANKFORMAT
Show code
```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:Math.random()*canvas.height,radius:30}];
    for(let i=0;i<width;i++){
        for(let j=0;j<height;j++){
            metaballs.forEach(metaball=>{
                let dx=i*10-metaball.x;
                let dy=j*10-metaball.y;
                let dist=Math.sqrt(dx*dx+dy*dy);
                field[i][j]+=metaball.radius/dist;
            });
        }
    }}function drawField() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    const thresholds=[0.5,1.2];
    let lineSegmentsDrawn=0;
    for(let i=0;i<width-1;i++){
        for(let j=0;j<height-1;j++){
            const corners=[
                field[i][j],
                field[i+1][j],
                field[i+1][j+1],
                field[i][j+1]
            ];
            thresholds.forEach(threshold=>{
                let crossingIndexes=[];
                [corners[0],corners[1]].forEach((val,i)=>cors=(val>threshold)?i:null);
                if(cors!==null){
                    const a=val>threshold?val-threshold:crossingIndexes.push(i);}
            });
        }
    }
    infoDiv.textContent=`Line segments drawn: ${lineSegmentsDrawn}`;
    requestAnimationFrame(animate);}
function animate(){
    generateField();
    drawField();}
requestAnimationFrame(animate);
</script>
</body>
</html>
```
qwen3:8bharness
No answer reached us (ERR) — and the reason lies with our setup, not with the model: reasoning consumed the entire token budget and the answer stayed empty; the gateway rejects budgets above 3000 tokens Counted as a did-not-finish, but it is not evidence about this model.
qwen3-coder:30bBLANKFORMAT
Show code
```html
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Metaball Contour Mapper</title></head><body style="margin:0;overflow:hidden;"><canvas id="c"></canvas><script>
const c = document.getElementById('c');
const ctx = c.getContext('2d');

let W, H, G = 30, S = 10, T = []; // Global state
let P = []; // Metaball positions/params
let A = {x:0, y:0}; // Animation offset

function init() {
    W = c.width = window.innerWidth;
    H = c.height = window.innerHeight;
    P = Array(3).fill(0).map(() => ({ x: Math.random() * W, y: Math.random() * H, r: 50 + Math.random() * 100, v: {x: (Math.random() - 0.5) * 2, y: (Math.random() - 0.5) * 2 }}));
    A = { x: Math.random(), y: Math.random() };
}

function metaball(px, py, r, cx, cy) {
    let dx = px - cx;
    let dy = py - cy;
    return 1 / (dx * dx + dy * dy + 0.5); // Simple inverse square falloff
}

function getField(x, y, t) {
    let s = 0;
    for (let i = 0; i < P.length; i++) {
        const p = P[i];
        // Update position based on time offset A.x/A.y
        let cx = p.x + Math.cos(t * 0.1 + i) * 50;
        let cy = p.y + Math.sin(t * 0.1 + i) * 50;
        s += metaball(x, y, p.r, cx, cy);
    }
    return s;
}

function evaluateGrid(t) {
    const G = 30; // Grid resolution
    T = []; // Store scalar field values
    for (let j = 0; j < G; j++) {
        let row = [];
        for (let i = 0; i < G; i++) {
            const x = i * W / (G - 1);
            const y = j * H / (G - 1);
            row.push(getField(x, y, t));
        }
        T.push(row);
    }
}

function drawContour(t) {
    ctx.clearRect(0, 0, W, H);
    ctx.strokeStyle = 'rgba(150, 220, 255, 0.8)';
    ctx.lineWidth = 1.5;
    let count = 0;

    const G_size = T.length;
    const stepX = W / (G_size - 1);
    const stepY = H / (G_size - 1);
    const THRESHOLD = 0.2; // Iso-line threshold

    // Marching Squares Loop
    for (let j = 0; j < G_size - 1; j++) {
        for (let i = 0; i < G_size - 1; i++) {
            const q11 = T[j][i];
            const q21 = T[j][i+1];
            const q12 = T[j+1][i];
            const q22 = T[j+1][i+1];

            // Check all four edges (linear interpolation for crossing)
            let points = [];
            
            // Top edge (q11 to q21): y=j*stepY, x=(i+d)*stepX
            if ((q11 - THRESHOLD) * (q21 - THRESHOLD) < 0) {
                const t = THRESHOLD / Math.abs(q11 - q21); // Interpolation parameter
                points.push({x: i * stepX + t * stepX, y: j * stepY});
            }

            // Bottom edge (q12 to q22): y=(j+1)*stepY
            if ((q12 - THRESHOLD) * (q22 - THRESHOLD) < 0) {
                const t = THRESHOLD / Math.abs(q12 - q22);
                points.push({x: i * stepX + t * stepX, y: (j+1) * stepY});
            }

            // Left edge (q11 to q12): x=i*stepX
            if ((q11 - THRESHOLD) * (q12 - THRESHOLD) < 0) {
                const t = THRESHOLD / Math.abs(q11 - q12);
                points.push({x: i * stepX, y: j * stepY + t * stepY});
            }

            // Right edge (q21 to q22): x=(i+1)*stepX
            if ((q21 - THRESHOLD) * (q22 - THRESHOLD) < 0) {
                const t = THRESHOLD / Math.abs(q21 - q22);
                points.push({x: i * stepX + stepX, y: j * stepY + t * stepY});
            }

            if (points.length > 0) {
                ctx.beginPath();
                ctx.moveTo(points[0].x, points[0].y);
                for (let k = 1; k < points.length; k++) {
                    ctx.lineTo(points[k].x, points[k].y);
                }
                ctx.stroke();
                count += points.length; // Count each interpolated segment
            }
        }
    }

    return count;
}


function loop(time) {
    // Update animation state (orbital movement effect for sources)
    A.x = Math.sin(time * 0.0001) * 50;
    A.y = Math.cos(time * 0.0001) * 50;

    // 1. Evaluate field on grid
    evaluateGrid(time);

    // 2. Draw contours and get segment count
    let segments = drawContour(time);

    // Display stats (simple console logging due to character limit constraints, but we must show the number)
    document.getElementById('stats').innerHTML = `Segments: ${segments}`;


    requestAnimationFrame(loop);
}

// Setup DOM elements and start loop
const D = document.createElement('div');
D.id = 'stats';
D.style.position = 'absolute';
D.style.top = '10px';
D.style.left = '10px';
document.body.appendChild(D);


init();
requestAnimationFrame(loop);

</script></body style="background:#050520;"><div id="stats" style="color:white; font-family:monospace;">Segments: Calculating...</div></body></html>
```
gemma4:26bharness
No answer reached us (THIN) — and the reason lies with our setup, not with the model: reasoning consumed the entire token budget (3 min 28 s, zero characters of answer); larger budgets are refused by the gateway Counted as a did-not-finish, but it is not evidence about this model.
deepseek-r1:14bERRBLANKFORMAT
Show code
```html
<!DOCTYPE html>
<html><body style="background:#000;color:white;margin:0;overflow:hidden">
<canvas id=c></canvas>
<div style="position:absolute;top:10px;left:10px;z-index:2">Contour Lines: <span id=count>0</span></div>
<script>
const c=document.getElementById('c'), ctx=c.getContext('2d');
const cellSize=35, maxCells=Math.min(64, Math.floor(Math.min(c.width,c.height)/cellSize));
let grid=[], animationId;
function init(){
    grid=new Array(maxCells).fill().map(()=>new Array(maxCells).fill(0));
    let metaballs=[];for(let i=0;i<150;i++)metaballs.push({x:Math.random()*c.width,y:Math.random()*c.height,r:2+i%3,s:0.4+Math.random()});
    function updateGrid(){
        grid.forEach((row,i)=>row.fill(0));
        metaballs.forEach(b=>{
            for(let y=0;y<maxCells;y++){
                let dy=b.y - (i * cellSize + cellSize/2);
                for(let x=0;x<maxCells;x){
                    const dx=b.x - (x * cellSize + cellSize/2), d=Math.sqrt(dx*dx+dy*dy);
                    grid[x][y] += b.s * Math.exp(-d*d/(b.r*b.r));
                }
            }
        });
    }
    function drawGrid(){
        ctx.fillStyle='white';ctx.fillRect(0,0,c.width,c.height);
        const scale=cellSize;
        let points=[], contours=[-1.5,-0.75,-0.25,0.25,0.75,1.5];
        for(let y=0;y<maxCells-1;y++)for(let x=0;x<maxCells-1;x++){
            const a=grid[x][y], b=grid[x+1][y], cval=grid[x][y+1], d=grid[x+1][y+1];
            for(let k=0;k<contours.length;k++){
                let val=contours[k];
                if(a < val && b >= val){
                    const t=(val - a)/(b - a);
                    points.push({x:x*scale+t*scale,y:y*scale,dir:'right'});
                }
                if(cval < val && d >= val){
                    const t=(val - cval)/(d - cval);
                    points.push({x:(x+1)*scale - t*scale,y:y*scale + scale,dir:'down'});
                }
                if(b < val && cval >= val){
                    const t=(val - b)/(cval - b);
                    points.push({x:x*scale + scale,y:y*scale + t*scale,dir:'left'});
                }
                if(cval > val && d <= val){
                    const t= (a - d)/(a - d);
                    points.push({x:(x+1)*scale,t*y: y*scale + scale,dir:'up'});
                }
            }
        }
        let lines=[];points.forEach(p=>lines.push({...p}));[...points].forEach(p=>{
            for(let i=0;i<lines.length;i++){
                if(i >= points.length)break;
                const current=lines[i], next=points[i+1];
                if(!next)return;
                if(current.dir=='right' && next.dir=='down'){
                    lines.push({x:current.x,y:current.y,dir:'end'});
                    ctx.beginPath();
                    ctx.moveTo(current.x,current.y);
                    ctx.lineTo(next.x,next.y);
                    ctx.stroke();
                    lineCount++;
                }
            }
        });
        document.getElementById('count').textContent=lineCount;
        points=[];lines=[];
    }
    function animate(){
        updateGrid();drawGrid();
        animationId=requestAnimationFrame(animate);
    }
    lineCount=0;animate();
}
init();
</script>
</body></html>
```
No usable answer reached the harness (ERR). Counted as a did-not-finish.
No usable answer reached the harness (ERR). Counted as a did-not-finish.
No usable answer reached the harness (ERR). Counted as a did-not-finish.
Outside the Brain cluster — same task, same character budget, collected through their own tooling (response times not comparable)
Claude Opus 5frontier referenceOK
Show code
<!doctype html>
<html><head><meta charset="utf-8"><title>Marching squares on a moving field</title>
<style>
html,body{margin:0;height:100%;background:#060910;overflow:hidden}
canvas{display:block;width:100vw;height:100vh}
#hud{position:fixed;left:12px;top:11px;font:13px ui-monospace,monospace;color:#bfe6ff;
background:rgba(6,10,20,.6);padding:5px 9px;border-radius:5px}
</style></head><body>
<canvas id="c"></canvas><div id="hud">segments 0</div>
<script>
const cv=document.getElementById('c'),g=cv.getContext('2d'),hud=document.getElementById('hud');
let W,H,cols,rows;
const CELL=11;
function fit(){
  W=cv.width=innerWidth;H=cv.height=innerHeight;
  cols=Math.ceil(W/CELL)+1;rows=Math.ceil(H/CELL)+1;
}
fit();addEventListener('resize',fit);

const balls=[];
for(let i=0;i<6;i++)balls.push({
  x:Math.random(),y:Math.random(),
  vx:(Math.random()*2-1)*.00013,vy:(Math.random()*2-1)*.00013,
  r:60+Math.random()*70
});

// TL=1, TR=2, BR=4, BL=8 -> Kantenpaare (0=oben,1=rechts,2=unten,3=links)
const CASES=[[],[[3,0]],[[0,1]],[[3,1]],[[1,2]],[[3,0],[1,2]],[[0,2]],[[3,2]],
             [[2,3]],[[2,0]],[[0,1],[2,3]],[[2,1]],[[1,3]],[[1,0]],[[0,3]],[]];
const ISO=[.55,.95,1.6];

function field(px,py){
  let s=0;
  for(const b of balls){
    const dx=px-b.x*W,dy=py-b.y*H;
    s+=b.r*b.r/(dx*dx+dy*dy+1);
  }
  return s;
}

function edgePoint(e,gx,gy,v){
  const x0=gx*CELL,y0=gy*CELL,x1=x0+CELL,y1=y0+CELL;
  const [a,b,c,d]=v;
  const t=(p,q)=>{const dn=q-p;return dn===0?.5:(ISOc-p)/dn};
  if(e===0)return [x0+CELL*t(a,b),y0];
  if(e===1)return [x1,y0+CELL*t(b,c)];
  if(e===2)return [x0+CELL*t(d,c),y1];
  return [x0,y0+CELL*t(a,d)];
}
let ISOc=0;

let last=0;
function frame(t){
  const dt=Math.min(50,t-(last||t));last=t;
  for(const b of balls){
    b.x+=b.vx*dt;b.y+=b.vy*dt;
    if(b.x<.06||b.x>.94)b.vx*=-1;
    if(b.y<.08||b.y>.92)b.vy*=-1;
  }

  g.fillStyle='#060910';g.fillRect(0,0,W,H);

  const vals=new Float32Array(cols*rows);
  for(let gy=0;gy<rows;gy++)for(let gx=0;gx<cols;gx++)
    vals[gy*cols+gx]=field(gx*CELL,gy*CELL);

  let segments=0;
  ISO.forEach((iso,k)=>{
    ISOc=iso;
    g.strokeStyle=['#3fa9ff','#6ee7ff','#d8f6ff'][k];
    g.lineWidth=k===0?2:1.3;
    g.beginPath();
    for(let gy=0;gy<rows-1;gy++)for(let gx=0;gx<cols-1;gx++){
      const a=vals[gy*cols+gx],b=vals[gy*cols+gx+1],
            c=vals[(gy+1)*cols+gx+1],d=vals[(gy+1)*cols+gx];
      const idx=(a>iso?1:0)|(b>iso?2:0)|(c>iso?4:0)|(d>iso?8:0);
      const cs=CASES[idx];
      if(!cs.length)continue;
      for(const pair of cs){
        const p=edgePoint(pair[0],gx,gy,[a,b,c,d]);
        const q=edgePoint(pair[1],gx,gy,[a,b,c,d]);
        g.moveTo(p[0],p[1]);g.lineTo(q[0],q[1]);
        segments++;
      }
    }
    g.stroke();
  });

  hud.textContent='segments '+segments+'  ·  '+ISO.length+' thresholds  ·  grid '+cols+'×'+rows;
  requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script></body></html>
GPT-5.5 (Codex)frontier referenceOKMINIFIED
Show code
<!doctype html><html><head><meta charset=utf-8><title>Marching Metaballs</title><style>html,body{margin:0;height:100%;overflow:hidden;background:#071016;color:#d9f6ff;font:14px system-ui}canvas{display:block;width:100%;height:100%}#n{position:fixed;left:14px;top:12px;background:#0009;padding:7px 10px;border:1px solid #ffffff24;border-radius:6px}</style></head><body><canvas id=c></canvas><div id=n></div><script>
let c=document.getElementById("c"),x=c.getContext("2d"),n=document.getElementById("n"),W,H,balls=[],g=38,vals=[],segs=[];
function R(){W=c.width=innerWidth*devicePixelRatio;H=c.height=innerHeight*devicePixelRatio;x.setTransform(1,0,0,1,0,0);x.scale(devicePixelRatio,devicePixelRatio);W=innerWidth;H=innerHeight}
onresize=R;R();
function init(){balls=[];for(let i=0;i<7;i++)balls.push({x:Math.random()*W,y:Math.random()*H,r:80+Math.random()*95,a:Math.random()*6.28,s:.35+Math.random()*.55,px:Math.random()*W,py:Math.random()*H})}
init();
let lev=[.72,1,1.34,1.78],pal=["#3ee7c8","#8cf06e","#ffd166","#ff6b86"],map=[
[],[[3,0]],[[0,1]],[[3,1]],[[1,2]],[[3,0],[1,2]],[[0,2]],[[3,2]],[[2,3]],[[0,2]],[[0,1],[2,3]],[[1,2]],[[1,3]],[[0,1]],[[3,0]],[]
];
function field(px,py,t){let v=0;for(let b of balls){b.x=b.px+Math.cos(t*b.s+b.a)*W*.24;b.y=b.py+Math.sin(t*b.s*1.17+b.a)*H*.24;let dx=px-b.x,dy=py-b.y;v+=b.r*b.r/(dx*dx+dy*dy+1)}return v}
function cross(e,x0,y0,s,v,l){let a,b,p,q;if(e==0){a=v[0];b=v[1];p=[x0,y0];q=[x0+s,y0]}else if(e==1){a=v[1];b=v[2];p=[x0+s,y0];q=[x0+s,y0+s]}else if(e==2){a=v[3];b=v[2];p=[x0,y0+s];q=[x0+s,y0+s]}else{a=v[0];b=v[3];p=[x0,y0];q=[x0,y0+s]}let m=(l-a)/(b-a||1);return[p[0]+(q[0]-p[0])*m,p[1]+(q[1]-p[1])*m]}
function draw(T){let s=Math.max(13,Math.min(W,H)/g),cols=Math.ceil(W/s)+1,rows=Math.ceil(H/s)+1;vals.length=rows*cols;for(let j=0;j<rows;j++)for(let i=0;i<cols;i++)vals[j*cols+i]=field(i*s,j*s,T);x.clearRect(0,0,W,H);let grad=x.createRadialGradient(W*.5,H*.45,20,W*.5,H*.5,Math.max(W,H)*.75);grad.addColorStop(0,"#142a30");grad.addColorStop(1,"#071016");x.fillStyle=grad;x.fillRect(0,0,W,H);let total=0;for(let k=0;k<lev.length;k++){x.strokeStyle=pal[k];x.lineWidth=2.2-k*.22;x.beginPath();for(let j=0;j<rows-1;j++)for(let i=0;i<cols-1;i++){let v=[vals[j*cols+i],vals[j*cols+i+1],vals[(j+1)*cols+i+1],vals[(j+1)*cols+i]],m=0;if(v[0]>lev[k])m|=1;if(v[1]>lev[k])m|=2;if(v[2]>lev[k])m|=4;if(v[3]>lev[k])m|=8;for(let a of map[m]){let p=cross(a[0],i*s,j*s,s,v,lev[k]),q=cross(a[1],i*s,j*s,s,v,lev[k]);x.moveTo(p[0],p[1]);x.lineTo(q[0],q[1]);total++}}x.stroke()}n.textContent=total+" line segments"}
let start=performance.now();
function loop(t){let u=(t-start)/1000;if(u>42){start=t;init();u=0}draw(u);requestAnimationFrame(loop)}
requestAnimationFrame(loop);
</script></body></html>
Claude Sonnet 5frontier referenceOK
Show code
<!DOCTYPE html><html><head><meta charset="utf8"><title>Marching Squares</title><style>
body{margin:0;background:#06090f;overflow:hidden}canvas{display:block}
#i{position:fixed;top:8px;left:8px;color:#7cf;font:14px monospace}
</style></head><body><canvas id="c"></canvas><div id="i"></div><script>
const cv=document.getElementById('c'),ctx=cv.getContext('2d');
function resize(){cv.width=innerWidth;cv.height=innerHeight}
resize();addEventListener('resize',resize);
let balls,cell=16,t=0,segCount=0;
function init(){
  const n=5+Math.floor(Math.random()*3);
  balls=[];
  for(let i=0;i<n;i++){
    balls.push({
      x:Math.random()*cv.width, y:Math.random()*cv.height,
      vx:(Math.random()-0.5)*1.2, vy:(Math.random()-0.5)*1.2,
      r:40+Math.random()*50, ph:Math.random()*100
    });
  }
}
init();
function field(x,y){
  let v=0;
  for(const b of balls){
    const dx=x-b.x, dy=y-b.y;
    v += (b.r*b.r)/(dx*dx+dy*dy+1);
  }
  return v;
}
function lerp(x1,y1,v1,x2,y2,v2,iso){
  const d=(v2-v1); const tt=Math.abs(d)<1e-6?0.5:(iso-v1)/d;
  return [x1+(x2-x1)*tt, y1+(y2-y1)*tt];
}
function march(){
  segCount=0;
  const cols=Math.ceil(cv.width/cell)+1, rows=Math.ceil(cv.height/cell)+1;
  const grid=new Float32Array(cols*rows);
  for(let j=0;j<rows;j++)for(let i=0;i<cols;i++) grid[j*cols+i]=field(i*cell,j*cell);
  const thresholds=[0.6,1.0,1.6,2.4];
  for(let ti=0;ti<thresholds.length;ti++){
    const iso=thresholds[ti];
    ctx.strokeStyle=['#4ea8ff','#7cf','#aef','#fff'][ti];
    ctx.lineWidth=1.5;
    ctx.beginPath();
    for(let j=0;j<rows-1;j++){
      for(let i=0;i<cols-1;i++){
        const x0=i*cell,y0=j*cell,x1=x0+cell,y1=y0+cell;
        const v0=grid[j*cols+i], v1=grid[j*cols+i+1], v2=grid[(j+1)*cols+i+1], v3=grid[(j+1)*cols+i];
        let idx2=0;
        if(v0>iso) idx2|=1; if(v1>iso) idx2|=2; if(v2>iso) idx2|=4; if(v3>iso) idx2|=8;
        if(idx2===0||idx2===15) continue;
        const a=lerp(x0,y0,v0,x1,y0,v1,iso);
        const b=lerp(x1,y0,v1,x1,y1,v2,iso);
        const c=lerp(x1,y1,v2,x0,y1,v3,iso);
        const d=lerp(x0,y1,v3,x0,y0,v0,iso);
        const cases={1:[[d,a]],2:[[a,b]],3:[[d,b]],4:[[b,c]],5:[[a,d],[b,c]],
          6:[[a,c]],7:[[c,d]],8:[[c,d]],9:[[a,c]],10:[[a,b],[c,d]],
          11:[[b,c]],12:[[b,d]],13:[[a,b]],14:[[a,d]]};
        let segs=cases[idx2]||[];
        for(const seg of segs){
          ctx.moveTo(seg[0][0],seg[0][1]);
          ctx.lineTo(seg[1][0],seg[1][1]);
          segCount++;
        }
      }
    }
    ctx.stroke();
  }
}
function loop(){
  ctx.fillStyle='rgba(6,9,15,1)';
  ctx.fillRect(0,0,cv.width,cv.height);
  for(const b of balls){
    b.x+=b.vx; b.y+=b.vy;
    if(b.x<0||b.x>cv.width) b.vx*=-1;
    if(b.y<0||b.y>cv.height) b.vy*=-1;
  }
  march();
  t++;
  ctx.fillStyle='#7cf';ctx.font='14px monospace';
  ctx.fillText('segments: '+segCount,10,20);
  ctx.fillText('blobs: '+balls.length,10,38);
  if(t>2600) { init(); t=0; }
  requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
</script></body></html>
Claude Haiku 4.5frontier referenceBLANKMINIFIED
Show code
<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{margin:0;background:#000;overflow:hidden}#c{display:block}#i{position:absolute;top:5px;left:5px;color:#0f0;font-family:monospace;font-size:12px}</style></head><body><canvas id="c"></canvas><div id="i"></div><script>const c=document.getElementById('c'),ctx=c.getContext('2d'),i=document.getElementById('i');c.width=800;c.height=600;const W=800,H=600,G=20;let mb=[];for(let j=0;j<4;j++){mb.push({x:Math.random()*W,y:Math.random()*H,vx:(Math.random()-0.5),vy:(Math.random()-0.5)})}let sg=0;function v(x,y){let s=0;for(let m of mb){let d=Math.hypot(x-m.x,y-m.y);if(d<200)s+=1000/(d*d+1)}return s}function dr(){ctx.fillStyle='#000';ctx.fillRect(0,0,W,H);for(let m of mb){m.x+=m.vx;m.y+=m.vy;if(m.x<0||m.x>W)m.vx*=-1;if(m.y<0||m.y>H)m.vy*=-1;m.x=Math.max(0,Math.min(W,m.x));m.y=Math.max(0,Math.min(H,m.y))}sg=0;ctx.strokeStyle='#0f0';ctx.lineWidth=2;for(let y=0;y<H;y+=G){for(let x=0;x<W;x+=G){let v1=v(x,y),v2=v(x+G,y),v3=v(x+G,y+G),v4=v(x,y+G);let t=50;if((v1>t)!==(v2>t)){ctx.beginPath();ctx.moveTo(x+G/2,y);ctx.lineTo(x+G/2,y+G/2);ctx.stroke();sg++}if((v2>t)!==(v3>t)){ctx.beginPath();ctx.moveTo(x+G,y+G/2);ctx.lineTo(x+G/2,y+G/2);ctx.stroke();sg++}if((v3>t)!==(v4>t)){ctx.beginPath();ctx.moveTo(x+G/2,y+G);ctx.lineTo(x+G/2,y+G/2);ctx.stroke();sg++}if((v4>t)!==(v1>t)){ctx.beginPath();ctx.moveTo(x,y+G/2);ctx.lineTo(x+G/2,y+G/2);ctx.stroke();sg++}}}i.textContent=`Segments: ${sg}`}setInterval(dr,50);</script></body></html>
Results at a glance— every model in this round with score, response time and status.

Who wrote what

ModelBlind scoreLatencyStatus
qwen3:14b —31.6 sOK
llama3.1:8b —15.8 sOK
qwen3.5:9b —31.7 sOK
mistral-small:24b —156.7 sOK
qwen3:8b ——harness
qwen3-coder:30b —27.7 sOK
gemma4:26b ——harness
deepseek-r1:14b —109.6 sOK
qwq:32b ——DNF
deepseek-r1:32b ——DNF
command-r:35b ——DNF