{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A navigator's station displays a bubble sextant with a curved graduated frame, viewing telescope, circular bubble chamber, index arm, and adjustment knobs."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n position: \"relative\",\n background: \"#111719\"\n });\n\n const polar = (cx, cy, r, deg) => {\n const a = deg * Math.PI / 180;\n return [cx + r * Math.cos(a), cy + r * Math.sin(a)];\n };\n\n let graduations = \"\";\n for (let a = 42; a <= 138; a += 1) {\n const major = a % 10 === 0;\n const medium = a % 5 === 0;\n const r1 = major ? 225 : medium ? 228 : 231;\n const r2 = 239;\n const [x1, y1] = polar(248, 202, r1, a);\n const [x2, y2] = polar(248, 202, r2, a);\n graduations += ``;\n }\n\n let labels = \"\";\n [50, 60, 70, 80, 90, 100, 110, 120, 130].forEach(a => {\n const [x, y] = polar(248, 202, 215, a);\n labels += `${Math.abs(90 - a)}`;\n });\n\n let knurl = \"\";\n for (let i = 0; i < 18; i++) {\n knurl += ``;\n }\n\n stage.innerHTML = `\n `;\n}"}], "metadata": {"id": "val-v1-broad-v2-entity-validation-000", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 6399, "code_sha256": "1ce01e11ec28c17f0cda9f589895c846eba0a92aed8e993ff34febb3ef67909d"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A wooden Davis backstaff is shown in profile, with two curved graduated arcs, sliding sight vanes, and a straight central staff."}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n position: \"relative\",\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n background: \"#d9d4ca\"\n });\n\n const NS = \"http://www.w3.org/2000/svg\";\n const svg = document.createElementNS(NS, \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 512 512\");\n svg.setAttribute(\"width\", \"512\");\n svg.setAttribute(\"height\", \"512\");\n svg.setAttribute(\"role\", \"img\");\n svg.setAttribute(\"aria-label\", \"Antique wooden Davis backstaff with graduated arcs and sliding sight vanes\");\n\n const point = (cx, cy, r, deg) => {\n const a = deg * Math.PI / 180;\n return [cx + r * Math.cos(a), cy + r * Math.sin(a)];\n };\n\n const polyArc = (cx, cy, r, start, end, steps = 40) => {\n let d = \"\";\n for (let i = 0; i <= steps; i++) {\n const a = start + (end - start) * i / steps;\n const [x, y] = point(cx, cy, r, a);\n d += `${i ? \"L\" : \"M\"}${x.toFixed(2)} ${y.toFixed(2)} `;\n }\n return d;\n };\n\n let bigTicks = \"\";\n for (let deg = 2; deg <= 70; deg += 2) {\n const major = deg % 10 === 0;\n const medium = deg % 5 === 0;\n const inner = 217 - (major ? 10 : medium ? 8 : 5);\n const outer = 217 + 7;\n const [x1, y1] = point(226, 230, inner, deg);\n const [x2, y2] = point(226, 230, outer, deg);\n bigTicks += ``;\n if (major) {\n const [tx, ty] = point(226, 230, 196, deg);\n bigTicks += `${deg}`;\n }\n }\n\n let smallTicks = \"\";\n for (let i = 0; i <= 30; i++) {\n const deg = 180 + i * (40 / 30);\n const major = i % 5 === 0;\n const [x1, y1] = point(226, 230, 145 - (major ? 9 : 5), deg);\n const [x2, y2] = point(226, 230, 152, deg);\n smallTicks += ``;\n if (major) {\n const [tx, ty] = point(226, 230, 128, deg);\n smallTicks += `${i}`;\n }\n }\n\n svg.innerHTML = `\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n\n \n \n \n \n \n\n \n \n \n\n \n \n\n \n \n \n\n \n \n \n \n \n\n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n ${bigTicks}\n ${smallTicks}\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n\n \n \n \n `;\n\n stage.appendChild(svg);\n}"}], "metadata": {"id": "val-v1-broad-v2-entity-validation-002", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 5778, "code_sha256": "50534f595acefaf76d8a9644181ff32e4de9a2faee35263c06ffc8eb1cbf2659"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A brass universal equinoctial ring dial hangs from its suspension loop, with two hinged circular rings, engraved hour numbers, and a sliding pinhole bar."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n position: \"relative\",\n overflow: \"hidden\",\n background: \"#171612\"\n });\n\n const canvas = document.createElement(\"canvas\");\n canvas.width = 1024;\n canvas.height = 1024;\n canvas.style.width = \"512px\";\n canvas.style.height = \"512px\";\n canvas.style.display = \"block\";\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(2, 2);\n\n const W = 512, H = 512;\n const TAU = Math.PI * 2;\n let seed = 428193;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n\n function ellipsePath(cx, cy, rx, ry, rot = 0, a0 = 0, a1 = TAU) {\n ctx.beginPath();\n ctx.ellipse(cx, cy, rx, ry, rot, a0, a1);\n }\n\n function line(x1, y1, x2, y2) {\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n }\n\n function rotatedPoint(cx, cy, x, y, rot) {\n const c = Math.cos(rot), s = Math.sin(rot);\n return {\n x: cx + x * c - y * s,\n y: cy + x * s + y * c\n };\n }\n\n function brassLinear(x1, y1, x2, y2) {\n const g = ctx.createLinearGradient(x1, y1, x2, y2);\n g.addColorStop(0, \"#5b3d13\");\n g.addColorStop(.09, \"#9c7127\");\n g.addColorStop(.22, \"#e0bd65\");\n g.addColorStop(.34, \"#8f621e\");\n g.addColorStop(.52, \"#d7ad4d\");\n g.addColorStop(.68, \"#f0d17b\");\n g.addColorStop(.82, \"#805719\");\n g.addColorStop(1, \"#3f2a0e\");\n return g;\n }\n\n function metalBandEllipse(cx, cy, rx, ry, rot, width) {\n ctx.save();\n ctx.lineCap = \"round\";\n\n ctx.shadowColor = \"rgba(0,0,0,.8)\";\n ctx.shadowBlur = 13;\n ctx.shadowOffsetX = 6;\n ctx.shadowOffsetY = 9;\n ellipsePath(cx, cy, rx, ry, rot);\n ctx.strokeStyle = \"#171006\";\n ctx.lineWidth = width + 5;\n ctx.stroke();\n\n ctx.shadowColor = \"transparent\";\n ellipsePath(cx, cy, rx, ry, rot);\n ctx.strokeStyle = brassLinear(cx - rx, cy, cx + rx, cy);\n ctx.lineWidth = width;\n ctx.stroke();\n\n ellipsePath(cx, cy, rx, ry, rot);\n ctx.strokeStyle = \"rgba(255,230,143,.65)\";\n ctx.lineWidth = 1.5;\n ctx.stroke();\n\n ellipsePath(cx, cy, rx - width * .38, ry - width * .38, rot);\n ctx.strokeStyle = \"rgba(45,24,5,.66)\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n\n ellipsePath(cx, cy, rx + width * .38, ry + width * .38, rot);\n ctx.strokeStyle = \"rgba(38,22,7,.5)\";\n ctx.lineWidth = 1.3;\n ctx.stroke();\n ctx.restore();\n }\n\n // Background\n let bg = ctx.createRadialGradient(244, 222, 35, 255, 265, 405);\n bg.addColorStop(0, \"#575044\");\n bg.addColorStop(.32, \"#38352f\");\n bg.addColorStop(.72, \"#201f1b\");\n bg.addColorStop(1, \"#0c0e0d\");\n ctx.fillStyle = bg;\n ctx.fillRect(0, 0, W, H);\n\n const vignette = ctx.createRadialGradient(256, 255, 160, 256, 255, 370);\n vignette.addColorStop(0, \"rgba(0,0,0,0)\");\n vignette.addColorStop(.68, \"rgba(0,0,0,.14)\");\n vignette.addColorStop(1, \"rgba(0,0,0,.72)\");\n ctx.fillStyle = vignette;\n ctx.fillRect(0, 0, W, H);\n\n // Background grain and aged wall marks\n ctx.save();\n for (let i = 0; i < 2200; i++) {\n const x = rnd() * W, y = rnd() * H;\n const a = .012 + rnd() * .035;\n ctx.fillStyle = rnd() > .55\n ? `rgba(255,244,205,${a})`\n : `rgba(0,0,0,${a * 1.8})`;\n const d = .25 + rnd() * 1.1;\n ctx.fillRect(x, y, d, d);\n }\n ctx.globalAlpha = .08;\n ctx.strokeStyle = \"#b3a47c\";\n ctx.lineWidth = .45;\n for (let i = 0; i < 35; i++) {\n ctx.beginPath();\n const y = rnd() * H;\n ctx.moveTo(0, y);\n ctx.bezierCurveTo(130, y + rnd() * 8 - 4, 350, y + rnd() * 8 - 4, 512, y);\n ctx.stroke();\n }\n ctx.restore();\n\n // Instrument shadow\n ctx.save();\n ctx.translate(13, 17);\n ctx.filter = \"blur(16px)\";\n ctx.globalAlpha = .52;\n ctx.strokeStyle = \"#000\";\n ctx.lineWidth = 25;\n ellipsePath(256, 271, 166, 190, -.10);\n ctx.stroke();\n ctx.filter = \"none\";\n ctx.restore();\n\n // Suspension loop and crown\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.8)\";\n ctx.shadowBlur = 9;\n ctx.shadowOffsetX = 4;\n ctx.shadowOffsetY = 5;\n\n ellipsePath(238, 30, 15, 23, -.13);\n ctx.strokeStyle = \"#3b260b\";\n ctx.lineWidth = 11;\n ctx.stroke();\n ellipsePath(238, 30, 15, 23, -.13);\n ctx.strokeStyle = brassLinear(220, 17, 255, 45);\n ctx.lineWidth = 7;\n ctx.stroke();\n ellipsePath(238, 30, 9.5, 16, -.13);\n ctx.strokeStyle = \"rgba(245,213,119,.55)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n\n ctx.shadowColor = \"transparent\";\n ctx.beginPath();\n ctx.roundRect(229, 47, 19, 28, 5);\n ctx.fillStyle = brassLinear(227, 0, 250, 0);\n ctx.fill();\n ctx.strokeStyle = \"#49300d\";\n ctx.lineWidth = 2;\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(229, 61);\n ctx.lineTo(217, 78);\n ctx.lineTo(253, 75);\n ctx.lineTo(247, 59);\n ctx.closePath();\n ctx.fillStyle = brassLinear(216, 0, 255, 0);\n ctx.fill();\n ctx.strokeStyle = \"#52350e\";\n ctx.stroke();\n ctx.restore();\n\n const outerRot = -.105;\n metalBandEllipse(256, 269, 166, 190, outerRot, 18);\n\n // Outer meridian graduations and engraved numerals\n ctx.save();\n ctx.lineCap = \"butt\";\n for (let i = 0; i < 72; i++) {\n const t = i / 72 * TAU;\n const major = i % 6 === 0;\n const medium = i % 3 === 0;\n const x1 = Math.cos(t) * (166 - 4);\n const y1 = Math.sin(t) * (190 - 4);\n const x2 = Math.cos(t) * (166 - (major ? 13 : medium ? 9 : 6));\n const y2 = Math.sin(t) * (190 - (major ? 14 : medium ? 10 : 7));\n const p1 = rotatedPoint(256, 269, x1, y1, outerRot);\n const p2 = rotatedPoint(256, 269, x2, y2, outerRot);\n ctx.strokeStyle = major ? \"rgba(42,24,6,.86)\" : \"rgba(55,32,8,.65)\";\n ctx.lineWidth = major ? 1.15 : .65;\n line(p1.x, p1.y, p2.x, p2.y);\n if (major) {\n ctx.strokeStyle = \"rgba(255,224,135,.25)\";\n ctx.lineWidth = .5;\n line(p1.x + .7, p1.y, p2.x + .7, p2.y);\n }\n }\n\n const meridianLabels = [\n [-1.40, \"0\"], [-1.05, \"10\"], [-.70, \"20\"], [-.34, \"30\"],\n [.30, \"40\"], [.66, \"50\"], [1.02, \"60\"], [1.38, \"70\"],\n [1.91, \"80\"], [2.29, \"70\"], [2.68, \"60\"], [3.05, \"50\"],\n [3.45, \"40\"], [3.82, \"30\"], [4.18, \"20\"], [4.55, \"10\"]\n ];\n ctx.font = \"8px Georgia, serif\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n for (const [t, txt] of meridianLabels) {\n const p = rotatedPoint(256, 269, Math.cos(t) * 158, Math.sin(t) * 180, outerRot);\n ctx.save();\n ctx.translate(p.x, p.y);\n ctx.rotate(t + Math.PI / 2 + outerRot);\n ctx.fillStyle = \"rgba(43,24,5,.88)\";\n ctx.fillText(txt, 0, 0);\n ctx.fillStyle = \"rgba(255,225,145,.2)\";\n ctx.fillText(txt, .5, .6);\n ctx.restore();\n }\n ctx.restore();\n\n // Patina patches on outer ring\n ctx.save();\n ctx.globalCompositeOperation = \"multiply\";\n for (let i = 0; i < 105; i++) {\n const t = rnd() * TAU;\n const p = rotatedPoint(\n 256, 269,\n Math.cos(t) * (166 + (rnd() - .5) * 10),\n Math.sin(t) * (190 + (rnd() - .5) * 10),\n outerRot\n );\n ctx.fillStyle = rnd() > .6 ? \"rgba(36,73,55,.18)\" : \"rgba(65,35,9,.22)\";\n ctx.beginPath();\n ctx.ellipse(p.x, p.y, .5 + rnd() * 2.2, .25 + rnd(), rnd() * TAU, 0, TAU);\n ctx.fill();\n }\n ctx.restore();\n\n // Equatorial ring, strongly foreshortened\n const eqRot = -.115;\n const eqCx = 257, eqCy = 281, eqRx = 153, eqRy = 55;\n\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.85)\";\n ctx.shadowBlur = 10;\n ctx.shadowOffsetY = 8;\n ellipsePath(eqCx, eqCy, eqRx, eqRy, eqRot);\n ctx.strokeStyle = \"#1d1105\";\n ctx.lineWidth = 28;\n ctx.stroke();\n ctx.restore();\n\n ellipsePath(eqCx, eqCy, eqRx, eqRy, eqRot);\n ctx.strokeStyle = brassLinear(105, 245, 410, 312);\n ctx.lineWidth = 23;\n ctx.stroke();\n\n ellipsePath(eqCx, eqCy, eqRx, eqRy, eqRot);\n ctx.strokeStyle = \"rgba(255,231,151,.72)\";\n ctx.lineWidth = 1.5;\n ctx.stroke();\n\n ellipsePath(eqCx, eqCy, eqRx, eqRy - 10, eqRot);\n ctx.strokeStyle = \"rgba(50,27,5,.78)\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n ellipsePath(eqCx, eqCy, eqRx, eqRy + 10, eqRot);\n ctx.strokeStyle = \"rgba(48,27,7,.7)\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n\n // Equatorial hour divisions\n ctx.save();\n for (let i = 0; i < 48; i++) {\n const t = i / 48 * TAU;\n const major = i % 2 === 0;\n const ryi = eqRy - (major ? 11 : 7);\n const p1 = rotatedPoint(eqCx, eqCy, Math.cos(t) * (eqRx - 1), Math.sin(t) * (eqRy - 1), eqRot);\n const p2 = rotatedPoint(eqCx, eqCy, Math.cos(t) * (eqRx - 1), Math.sin(t) * ryi, eqRot);\n ctx.strokeStyle = major ? \"rgba(47,27,7,.92)\" : \"rgba(59,34,9,.65)\";\n ctx.lineWidth = major ? 1 : .55;\n line(p1.x, p1.y, p2.x, p2.y);\n }\n\n // Front-facing hour numbers\n const hours = [\"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"XII\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\"];\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.font = \"bold 9px Georgia, serif\";\n for (let i = 0; i < hours.length; i++) {\n const t = Math.PI - i * Math.PI / 12;\n const p = rotatedPoint(eqCx, eqCy, Math.cos(t) * 131, Math.sin(t) * 44, eqRot);\n ctx.save();\n ctx.translate(p.x, p.y);\n ctx.rotate(eqRot + Math.cos(t) * .04);\n ctx.fillStyle = \"rgba(45,24,5,.95)\";\n ctx.fillText(hours[i], 0, 0);\n ctx.fillStyle = \"rgba(255,232,154,.22)\";\n ctx.fillText(hours[i], .45, .6);\n ctx.restore();\n }\n ctx.restore();\n\n // Side hinges\n const hingeL = rotatedPoint(eqCx, eqCy, -151, 0, eqRot);\n const hingeR = rotatedPoint(eqCx, eqCy, 151, 0, eqRot);\n for (const p of [hingeL, hingeR]) {\n ctx.save();\n ctx.translate(p.x, p.y);\n ctx.rotate(eqRot);\n ctx.shadowColor = \"rgba(0,0,0,.65)\";\n ctx.shadowBlur = 4;\n ctx.shadowOffsetY = 3;\n ctx.beginPath();\n ctx.roundRect(-9, -13, 18, 26, 4);\n ctx.fillStyle = brassLinear(-10 + p.x, p.y, 10 + p.x, p.y);\n ctx.fill();\n ctx.strokeStyle = \"#4b2e09\";\n ctx.lineWidth = 1.8;\n ctx.stroke();\n ctx.shadowColor = \"transparent\";\n ctx.beginPath();\n ctx.arc(0, 0, 5.2, 0, TAU);\n ctx.fillStyle = \"#76501a\";\n ctx.fill();\n ctx.strokeStyle = \"#efcb6d\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n ctx.beginPath();\n ctx.arc(-1.2, -1.3, 1.2, 0, TAU);\n ctx.fillStyle = \"rgba(255,243,178,.7)\";\n ctx.fill();\n ctx.restore();\n }\n\n // Central declination/pinhole bar\n ctx.save();\n ctx.translate(256, 269);\n ctx.rotate(outerRot);\n\n ctx.shadowColor = \"rgba(0,0,0,.8)\";\n ctx.shadowBlur = 8;\n ctx.shadowOffsetX = 5;\n ctx.shadowOffsetY = 5;\n ctx.beginPath();\n ctx.roundRect(-9.5, -160, 19, 320, 5);\n ctx.fillStyle = \"#352107\";\n ctx.fill();\n\n ctx.shadowColor = \"transparent\";\n ctx.beginPath();\n ctx.roundRect(-7.5, -160, 15, 320, 4);\n ctx.fillStyle = brassLinear(-9, 0, 9, 0);\n ctx.fill();\n ctx.strokeStyle = \"#53350d\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n\n ctx.fillStyle = \"rgba(255,231,151,.5)\";\n ctx.fillRect(-5.3, -155, 1, 310);\n ctx.fillStyle = \"rgba(50,27,6,.55)\";\n ctx.fillRect(5.2, -155, .8, 310);\n\n // Calendar scale\n ctx.font = \"6px Georgia, serif\";\n ctx.textBaseline = \"middle\";\n ctx.textAlign = \"left\";\n const months = [\"JAN\", \"FEB\", \"MAR\", \"APR\", \"MAY\", \"JUN\", \"JUL\", \"AUG\", \"SEP\", \"OCT\", \"NOV\", \"DEC\"];\n for (let i = 0; i <= 36; i++) {\n const y = -145 + i * (290 / 36);\n const major = i % 3 === 0;\n ctx.strokeStyle = major ? \"rgba(49,27,6,.9)\" : \"rgba(61,34,8,.66)\";\n ctx.lineWidth = major ? .8 : .45;\n line(-6, y, major ? 1.2 : -1.2, y);\n if (major && i < 36) {\n ctx.fillStyle = \"rgba(47,26,5,.9)\";\n ctx.fillText(months[i / 3], 1.5, y);\n }\n }\n\n // Decorative terminals\n for (const y of [-160, 160]) {\n ctx.beginPath();\n ctx.roundRect(-12, y - 7, 24, 14, 5);\n ctx.fillStyle = brassLinear(-12, y, 12, y);\n ctx.fill();\n ctx.strokeStyle = \"#4c2e09\";\n ctx.lineWidth = 1.4;\n ctx.stroke();\n ctx.beginPath();\n ctx.arc(0, y, 3.4, 0, TAU);\n ctx.fillStyle = \"#745019\";\n ctx.fill();\n ctx.strokeStyle = \"#e6c267\";\n ctx.stroke();\n }\n\n // Sliding pinhole carriage\n ctx.shadowColor = \"rgba(0,0,0,.75)\";\n ctx.shadowBlur = 7;\n ctx.shadowOffsetX = 4;\n ctx.shadowOffsetY = 5;\n ctx.beginPath();\n ctx.roundRect(-19, -40, 38, 44, 5);\n ctx.fillStyle = brassLinear(-20, -20, 20, -20);\n ctx.fill();\n ctx.strokeStyle = \"#4c2d08\";\n ctx.lineWidth = 2;\n ctx.stroke();\n\n ctx.shadowColor = \"transparent\";\n ctx.beginPath();\n ctx.roundRect(-14, -35, 28, 34, 3);\n ctx.strokeStyle = \"rgba(255,224,131,.65)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n\n const pg = ctx.createRadialGradient(-1, -19, 1, -1, -19, 13);\n pg.addColorStop(0, \"#050403\");\n pg.addColorStop(.25, \"#211505\");\n pg.addColorStop(.53, \"#b68730\");\n pg.addColorStop(.78, \"#5d3b10\");\n pg.addColorStop(1, \"#d6ad51\");\n ctx.beginPath();\n ctx.arc(-1, -19, 11, 0, TAU);\n ctx.fillStyle = pg;\n ctx.fill();\n ctx.strokeStyle = \"#3c2408\";\n ctx.lineWidth = 1.4;\n ctx.stroke();\n\n ctx.beginPath();\n ctx.arc(-1, -19, 2.4, 0, TAU);\n ctx.fillStyle = \"#030302\";\n ctx.fill();\n ctx.beginPath();\n ctx.arc(-1.8, -19.8, .65, 0, TAU);\n ctx.fillStyle = \"rgba(255,230,154,.65)\";\n ctx.fill();\n\n ctx.font = \"5px Georgia, serif\";\n ctx.textAlign = \"center\";\n ctx.fillStyle = \"rgba(49,27,6,.9)\";\n ctx.fillText(\"SOL\", 0, -5.5);\n ctx.restore();\n\n // Fine scratches and tarnish across brass\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n ctx.strokeStyle = \"rgba(255,226,145,.16)\";\n ctx.lineWidth = .45;\n for (let i = 0; i < 125; i++) {\n const t = rnd() * TAU;\n const p = rotatedPoint(\n 256, 269,\n Math.cos(t) * (161 + rnd() * 10),\n Math.sin(t) * (184 + rnd() * 11),\n outerRot\n );\n const len = 2 + rnd() * 8;\n ctx.beginPath();\n ctx.moveTo(p.x, p.y);\n ctx.lineTo(p.x + len * Math.cos(t + 1.5), p.y + len * Math.sin(t + 1.5));\n ctx.stroke();\n }\n ctx.restore();\n\n // Small maker's inscription\n ctx.save();\n ctx.translate(258, 417);\n ctx.rotate(outerRot);\n ctx.textAlign = \"center\";\n ctx.font = \"italic 7px Georgia, serif\";\n ctx.fillStyle = \"rgba(40,23,5,.84)\";\n ctx.fillText(\"LONDINI\", 0, 0);\n ctx.fillStyle = \"rgba(255,226,141,.18)\";\n ctx.fillText(\"LONDINI\", .5, .6);\n ctx.restore();\n\n // Subtle foreground glints\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n let glint = ctx.createLinearGradient(116, 115, 400, 410);\n glint.addColorStop(0, \"rgba(255,244,190,0)\");\n glint.addColorStop(.47, \"rgba(255,235,160,.12)\");\n glint.addColorStop(.52, \"rgba(255,250,213,.35)\");\n glint.addColorStop(.57, \"rgba(255,235,160,.08)\");\n glint.addColorStop(1, \"rgba(255,244,190,0)\");\n ctx.strokeStyle = glint;\n ctx.lineWidth = 2;\n ellipsePath(256, 269, 166, 190, outerRot, 3.65, 5.4);\n ctx.stroke();\n ctx.restore();\n}"}], "metadata": {"id": "val-v1-broad-v2-entity-validation-003", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 6439, "code_sha256": "0c3da122941f3bdd18dd7e0722a0a22282f90021bdd8e1d09f0ced30929f059e"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A wooden cross-staff lies beside a sea chart, with a long graduated staff and a sliding perpendicular vane fully visible."}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n position: \"relative\",\n overflow: \"hidden\",\n width: \"512px\",\n height: \"512px\",\n background: \"#6d4528\"\n });\n\n const canvas = document.createElement(\"canvas\");\n const dpr = Math.max(2, window.devicePixelRatio || 1);\n canvas.width = 512 * dpr;\n canvas.height = 512 * dpr;\n Object.assign(canvas.style, {\n width: \"512px\",\n height: \"512px\",\n display: \"block\"\n });\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(dpr, dpr);\n\n let seed = 184729;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n\n const line = (x1, y1, x2, y2) => {\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n };\n\n const ellipse = (x, y, rx, ry, rot = 0) => {\n ctx.beginPath();\n ctx.ellipse(x, y, rx, ry, rot, 0, Math.PI * 2);\n };\n\n // Wooden tabletop\n const table = ctx.createLinearGradient(0, 0, 512, 512);\n table.addColorStop(0, \"#8a603c\");\n table.addColorStop(0.45, \"#725035\");\n table.addColorStop(1, \"#56371f\");\n ctx.fillStyle = table;\n ctx.fillRect(0, 0, 512, 512);\n\n const boards = [\n [0, 111], [111, 227], [227, 345], [345, 512]\n ];\n for (const [y0, y1] of boards) {\n const g = ctx.createLinearGradient(0, y0, 0, y1);\n g.addColorStop(0, \"rgba(255,220,164,.055)\");\n g.addColorStop(0.5, \"rgba(60,24,8,.025)\");\n g.addColorStop(1, \"rgba(28,12,5,.13)\");\n ctx.fillStyle = g;\n ctx.fillRect(0, y0, 512, y1 - y0);\n }\n\n ctx.lineWidth = 1.3;\n for (const y of [110, 226, 344]) {\n ctx.strokeStyle = \"rgba(38,20,11,.55)\";\n line(0, y, 512, y + 1);\n ctx.strokeStyle = \"rgba(221,172,107,.13)\";\n line(0, y + 2.2, 512, y + 3);\n }\n\n ctx.lineCap = \"round\";\n for (let i = 0; i < 145; i++) {\n const y = rnd() * 512;\n const x = -30 + rnd() * 520;\n const length = 18 + rnd() * 150;\n ctx.strokeStyle = `rgba(${rnd() > .6 ? 43 : 231},${rnd() > .6 ? 22 : 174},${rnd() > .6 ? 9 : 104},${.018 + rnd() * .06})`;\n ctx.lineWidth = .35 + rnd() * 1.1;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.bezierCurveTo(\n x + length * .3, y + (rnd() - .5) * 4,\n x + length * .72, y + (rnd() - .5) * 4,\n x + length, y + (rnd() - .5) * 2\n );\n ctx.stroke();\n }\n\n // Knots in the table\n for (const [x, y, sx] of [[70, 74, 1], [442, 48, .75], [124, 333, .85], [408, 480, .8]]) {\n ctx.save();\n ctx.translate(x, y);\n ctx.scale(sx, .45 * sx);\n for (let k = 0; k < 4; k++) {\n ellipse(0, 0, 17 - k * 3.5, 9 - k * 1.5, -.08);\n ctx.strokeStyle = `rgba(49,25,11,${.12 + k * .045})`;\n ctx.lineWidth = 1.2;\n ctx.stroke();\n }\n ctx.restore();\n }\n\n // Sea chart\n ctx.save();\n ctx.translate(359, 271);\n ctx.rotate(0.064);\n\n ctx.shadowColor = \"rgba(24,13,7,.52)\";\n ctx.shadowBlur = 15;\n ctx.shadowOffsetX = 7;\n ctx.shadowOffsetY = 9;\n ctx.beginPath();\n ctx.moveTo(-145, -183);\n ctx.quadraticCurveTo(-8, -189, 143, -177);\n ctx.lineTo(139, 178);\n ctx.quadraticCurveTo(8, 183, -147, 172);\n ctx.closePath();\n ctx.fillStyle = \"#d9c28d\";\n ctx.fill();\n ctx.shadowColor = \"transparent\";\n\n ctx.save();\n ctx.beginPath();\n ctx.moveTo(-145, -183);\n ctx.quadraticCurveTo(-8, -189, 143, -177);\n ctx.lineTo(139, 178);\n ctx.quadraticCurveTo(8, 183, -147, 172);\n ctx.closePath();\n ctx.clip();\n\n const parchment = ctx.createRadialGradient(-30, -30, 30, 0, 0, 260);\n parchment.addColorStop(0, \"#ead9aa\");\n parchment.addColorStop(.67, \"#ddc58e\");\n parchment.addColorStop(1, \"#b8955d\");\n ctx.fillStyle = parchment;\n ctx.fillRect(-155, -195, 310, 390);\n\n // Paper mottling\n for (let i = 0; i < 380; i++) {\n const x = -148 + rnd() * 296;\n const y = -186 + rnd() * 374;\n const r = .3 + rnd() * 2.1;\n ctx.fillStyle = rnd() > .5\n ? `rgba(91,62,28,${.012 + rnd() * .035})`\n : `rgba(255,246,205,${.015 + rnd() * .04})`;\n ellipse(x, y, r * (1 + rnd()), r, rnd() * Math.PI);\n ctx.fill();\n }\n\n // Border\n ctx.strokeStyle = \"rgba(83,57,27,.52)\";\n ctx.lineWidth = 1;\n ctx.strokeRect(-137, -173, 270, 338);\n ctx.strokeStyle = \"rgba(83,57,27,.28)\";\n ctx.strokeRect(-133, -169, 262, 330);\n\n // Latitude and longitude grid\n ctx.strokeStyle = \"rgba(86,96,78,.25)\";\n ctx.lineWidth = .55;\n for (let x = -120; x <= 120; x += 24) {\n ctx.beginPath();\n ctx.moveTo(x, -169);\n ctx.bezierCurveTo(x - 9, -60, x + 9, 60, x, 165);\n ctx.stroke();\n }\n for (let y = -150; y <= 150; y += 25) {\n ctx.beginPath();\n ctx.moveTo(-133, y);\n ctx.bezierCurveTo(-50, y + 5, 52, y - 5, 129, y);\n ctx.stroke();\n }\n\n // Rhumb lines\n const hubs = [[-53, 36], [70, -57], [61, 96]];\n ctx.lineWidth = .48;\n for (let h = 0; h < hubs.length; h++) {\n const [hx, hy] = hubs[h];\n const colors = [\"rgba(128,63,44,.35)\", \"rgba(47,83,82,.32)\", \"rgba(118,91,34,.3)\"];\n ctx.strokeStyle = colors[h];\n for (let a = 0; a < Math.PI * 2; a += Math.PI / 8) {\n line(hx, hy, hx + Math.cos(a) * 230, hy + Math.sin(a) * 230);\n }\n }\n\n // Coastlines and colored coastal wash\n const coast = (points, fillSide) => {\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 1; i < points.length; i++) {\n const p = points[i];\n ctx.lineTo(p[0], p[1]);\n }\n if (fillSide === \"left\") {\n ctx.lineTo(-155, points[points.length - 1][1]);\n ctx.lineTo(-155, points[0][1]);\n } else {\n ctx.lineTo(155, points[points.length - 1][1]);\n ctx.lineTo(155, points[0][1]);\n }\n ctx.closePath();\n ctx.fillStyle = \"rgba(150,120,65,.18)\";\n ctx.fill();\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 1; i < points.length; i++) ctx.lineTo(points[i][0], points[i][1]);\n ctx.strokeStyle = \"rgba(64,64,43,.78)\";\n ctx.lineWidth = 1.15;\n ctx.stroke();\n };\n\n coast([\n [-132,-151],[-109,-145],[-101,-132],[-111,-120],[-95,-108],[-102,-93],\n [-86,-78],[-91,-61],[-77,-47],[-81,-29],[-67,-15],[-72,2],[-59,17],\n [-65,37],[-54,53],[-57,72],[-43,91],[-49,110],[-37,130],[-42,158]\n ], \"left\");\n\n coast([\n [128,-151],[109,-141],[114,-126],[96,-113],[103,-97],[88,-82],\n [94,-67],[78,-53],[83,-37],[67,-24],[76,-7],[61,8],[67,25],\n [52,40],[61,56],[47,72],[54,89],[39,104],[46,122],[31,139],[35,159]\n ], \"right\");\n\n // Islands\n ctx.fillStyle = \"rgba(143,112,60,.20)\";\n ctx.strokeStyle = \"rgba(61,64,43,.72)\";\n ctx.lineWidth = .8;\n for (const [x, y, rx, ry, r] of [\n [-15,-81,7,3,.3], [7,-57,3,7,-.2], [-9,-30,5,2,.4],\n [16,19,8,3,-.15], [-16,76,3,6,.1], [4,105,7,3,.15]\n ]) {\n ellipse(x, y, rx, ry, r);\n ctx.fill();\n ctx.stroke();\n }\n\n // Compass rose\n ctx.save();\n ctx.translate(27, -91);\n ctx.strokeStyle = \"rgba(56,67,60,.75)\";\n ctx.fillStyle = \"rgba(76,88,76,.55)\";\n ctx.lineWidth = .65;\n for (let i = 0; i < 16; i++) {\n ctx.save();\n ctx.rotate(i * Math.PI / 8);\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(i % 2 ? 2 : 3.5, -5);\n ctx.lineTo(0, i % 2 ? -18 : -27);\n ctx.lineTo(i % 2 ? -2 : -3.5, -5);\n ctx.closePath();\n if (i % 2 === 0) ctx.fill();\n ctx.stroke();\n ctx.restore();\n }\n ellipse(0, 0, 3, 3);\n ctx.fillStyle = \"#cfb77e\";\n ctx.fill();\n ctx.stroke();\n ctx.font = \"bold 8px Georgia, serif\";\n ctx.fillStyle = \"rgba(55,51,35,.8)\";\n ctx.textAlign = \"center\";\n ctx.fillText(\"N\", 0, -31);\n ctx.restore();\n\n ctx.fillStyle = \"rgba(62,69,61,.6)\";\n ctx.textAlign = \"center\";\n ctx.font = \"italic 12px Georgia, serif\";\n ctx.fillText(\"MARE ATLANTICVM\", 0, 5);\n ctx.font = \"italic 7px Georgia, serif\";\n ctx.fillText(\"Insulae et litora maris\", 1, 18);\n\n ctx.textAlign = \"left\";\n ctx.font = \"6px Georgia, serif\";\n ctx.fillStyle = \"rgba(73,61,39,.65)\";\n ctx.fillText(\"Terra Occidentalis\", -127, -118);\n ctx.fillText(\"Costa Orientalis\", 61, 132);\n\n // Scale cartouche\n ctx.strokeStyle = \"rgba(76,56,31,.62)\";\n ctx.lineWidth = .8;\n ctx.strokeRect(-103, 140, 79, 15);\n for (let i = 0; i < 8; i++) {\n ctx.fillStyle = i % 2\n ? \"rgba(79,59,33,.55)\"\n : \"rgba(230,210,158,.45)\";\n ctx.fillRect(-99 + i * 9, 145, 9, 5);\n }\n ctx.font = \"5px Georgia, serif\";\n ctx.fillStyle = \"rgba(73,54,31,.75)\";\n ctx.fillText(\"Scala leucarum\", -96, 143);\n\n // Darkened aged edges\n const edge = ctx.createLinearGradient(-150, 0, 150, 0);\n edge.addColorStop(0, \"rgba(76,45,17,.22)\");\n edge.addColorStop(.08, \"rgba(76,45,17,0)\");\n edge.addColorStop(.92, \"rgba(76,45,17,0)\");\n edge.addColorStop(1, \"rgba(76,45,17,.23)\");\n ctx.fillStyle = edge;\n ctx.fillRect(-150, -190, 300, 380);\n\n ctx.restore();\n\n // Slight curled lower-right corner\n ctx.beginPath();\n ctx.moveTo(114, 153);\n ctx.quadraticCurveTo(132, 153, 139, 177);\n ctx.quadraticCurveTo(122, 169, 114, 153);\n const curl = ctx.createLinearGradient(115, 152, 139, 178);\n curl.addColorStop(0, \"#ead9aa\");\n curl.addColorStop(1, \"#977442\");\n ctx.fillStyle = curl;\n ctx.fill();\n ctx.strokeStyle = \"rgba(75,50,25,.25)\";\n ctx.stroke();\n ctx.restore();\n\n // Cross-staff\n ctx.save();\n ctx.translate(220, 270);\n ctx.rotate(-0.86);\n\n // Object shadow\n ctx.save();\n ctx.translate(6, 8);\n ctx.shadowColor = \"rgba(21,11,5,.62)\";\n ctx.shadowBlur = 12;\n ctx.fillStyle = \"rgba(35,18,7,.55)\";\n ctx.fillRect(-216, -10, 432, 22);\n ctx.fillRect(-39, -105, 22, 210);\n ctx.restore();\n\n // Main graduated staff\n const beam = ctx.createLinearGradient(0, -11, 0, 12);\n beam.addColorStop(0, \"#6b3b19\");\n beam.addColorStop(.13, \"#bb7a3d\");\n beam.addColorStop(.42, \"#9a5929\");\n beam.addColorStop(.75, \"#70401d\");\n beam.addColorStop(1, \"#41230f\");\n ctx.fillStyle = beam;\n ctx.beginPath();\n ctx.moveTo(-216, -10);\n ctx.lineTo(211, -10);\n ctx.lineTo(217, -5);\n ctx.lineTo(217, 8);\n ctx.lineTo(211, 12);\n ctx.lineTo(-216, 12);\n ctx.closePath();\n ctx.fill();\n\n ctx.strokeStyle = \"rgba(42,20,7,.9)\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n ctx.strokeStyle = \"rgba(255,200,119,.38)\";\n ctx.lineWidth = .8;\n line(-210, -8.5, 210, -8.5);\n ctx.strokeStyle = \"rgba(38,17,6,.72)\";\n line(-212, 9.5, 212, 9.5);\n\n // Grain along staff\n for (let i = 0; i < 32; i++) {\n const y = -7 + rnd() * 15;\n const x = -205 + rnd() * 370;\n const len = 13 + rnd() * 72;\n ctx.strokeStyle = `rgba(${rnd() > .7 ? 237 : 49},${rnd() > .7 ? 158 : 24},${rnd() > .7 ? 79 : 8},${.04 + rnd() * .11})`;\n ctx.lineWidth = .35 + rnd() * .45;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.bezierCurveTo(x + len * .35, y + (rnd() - .5) * 2, x + len * .7, y + (rnd() - .5) * 2, x + len, y);\n ctx.stroke();\n }\n\n // Graduation marks and numerals\n ctx.strokeStyle = \"rgba(35,18,8,.88)\";\n ctx.fillStyle = \"rgba(37,18,7,.9)\";\n ctx.textAlign = \"center\";\n ctx.font = \"5px Georgia, serif\";\n for (let x = -195, n = 0; x <= 195; x += 10, n++) {\n const major = n % 5 === 0;\n const medium = n % 5 === 0 || n % 5 === 2;\n ctx.lineWidth = major ? 1 : .65;\n line(x, -9, x, -9 + (major ? 8 : medium ? 5.5 : 3.5));\n if (major && x > -190 && x < 190) ctx.fillText(String(n * 5), x, 5.5);\n }\n\n // End cap\n const cap = ctx.createLinearGradient(207, 0, 219, 0);\n cap.addColorStop(0, \"#6a3a19\");\n cap.addColorStop(1, \"#2e1709\");\n ctx.fillStyle = cap;\n ctx.fillRect(211, -8, 7, 17);\n ctx.strokeStyle = \"rgba(29,14,5,.8)\";\n ctx.strokeRect(211, -8, 7, 17);\n\n // Sliding vane\n const vx = -30;\n const vane = ctx.createLinearGradient(vx - 11, 0, vx + 12, 0);\n vane.addColorStop(0, \"#45230d\");\n vane.addColorStop(.13, \"#754019\");\n vane.addColorStop(.45, \"#b06c31\");\n vane.addColorStop(.73, \"#865022\");\n vane.addColorStop(1, \"#3d200d\");\n ctx.fillStyle = vane;\n ctx.beginPath();\n ctx.moveTo(vx - 11, -105);\n ctx.lineTo(vx + 10, -105);\n ctx.lineTo(vx + 12, 104);\n ctx.lineTo(vx - 10, 104);\n ctx.closePath();\n ctx.fill();\n ctx.strokeStyle = \"rgba(37,18,6,.92)\";\n ctx.lineWidth = 1.2;\n ctx.stroke();\n\n // Vane bevels\n ctx.strokeStyle = \"rgba(255,196,109,.32)\";\n ctx.lineWidth = .8;\n line(vx - 8.5, -101, vx - 8.5, 99);\n ctx.strokeStyle = \"rgba(34,15,5,.55)\";\n line(vx + 8.5, -100, vx + 9.5, 99);\n\n // Vane grain\n for (let i = 0; i < 23; i++) {\n const y = -96 + rnd() * 188;\n ctx.strokeStyle = `rgba(42,19,6,${.05 + rnd() * .13})`;\n ctx.lineWidth = .45;\n line(vx - 7 + rnd() * 4, y, vx + 7 - rnd() * 3, y + (rnd() - .5) * 3);\n }\n\n // Sliding block around intersection\n ctx.shadowColor = \"rgba(20,10,4,.35)\";\n ctx.shadowBlur = 3;\n ctx.shadowOffsetY = 2;\n const block = ctx.createLinearGradient(0, -15, 0, 16);\n block.addColorStop(0, \"#c07c3b\");\n block.addColorStop(.42, \"#89501f\");\n block.addColorStop(1, \"#4d280f\");\n ctx.fillStyle = block;\n ctx.beginPath();\n ctx.roundRect(vx - 15, -15, 30, 30, 3);\n ctx.fill();\n ctx.shadowColor = \"transparent\";\n ctx.strokeStyle = \"rgba(40,19,6,.9)\";\n ctx.lineWidth = 1.25;\n ctx.stroke();\n ctx.strokeStyle = \"rgba(246,182,93,.28)\";\n line(vx - 12, -12, vx + 12, -12);\n\n // Peg in slider\n const peg = ctx.createRadialGradient(vx - 2, -2, 1, vx, 0, 7);\n peg.addColorStop(0, \"#e0a15d\");\n peg.addColorStop(.5, \"#875023\");\n peg.addColorStop(1, \"#371b09\");\n ctx.fillStyle = peg;\n ellipse(vx, 0, 6, 6);\n ctx.fill();\n ctx.strokeStyle = \"rgba(31,14,5,.75)\";\n ctx.stroke();\n\n // Wear and small nicks\n ctx.strokeStyle = \"rgba(232,162,82,.32)\";\n ctx.lineWidth = .7;\n line(-180, 8, -168, 7);\n line(121, -7, 136, -8);\n line(vx - 8, 67, vx + 2, 64);\n ctx.restore();\n\n // Soft ambient vignette\n const vignette = ctx.createRadialGradient(256, 245, 175, 256, 256, 385);\n vignette.addColorStop(0, \"rgba(0,0,0,0)\");\n vignette.addColorStop(.72, \"rgba(22,10,3,.03)\");\n vignette.addColorStop(1, \"rgba(18,8,2,.26)\");\n ctx.fillStyle = vignette;\n ctx.fillRect(0, 0, 512, 512);\n\n await new Promise(resolve => requestAnimationFrame(resolve));\n}"}], "metadata": {"id": "val-v1-broad-v2-entity-validation-005", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 6546, "code_sha256": "619d232f9fda267e542b7e8ca39d93d1d560dee287014465573c2675e635a07e"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A migrating island assembled from giant clock hands glides over autumn forests, supporting a marble temple and dozens of fluttering copper banners."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n position: \"relative\",\n overflow: \"hidden\",\n width: \"512px\",\n height: \"512px\",\n background: \"#9bb5bd\"\n });\n\n const canvas = document.createElement(\"canvas\");\n canvas.width = 1024;\n canvas.height = 1024;\n canvas.style.width = \"512px\";\n canvas.style.height = \"512px\";\n canvas.setAttribute(\"aria-label\", \"A migrating island built from giant clock hands carrying a marble temple and copper banners above autumn forests\");\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(2, 2);\n\n let seed = 981237;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n const rr = (a, b) => a + rnd() * (b - a);\n\n const path = (pts, close = true) => {\n ctx.beginPath();\n ctx.moveTo(pts[0][0], pts[0][1]);\n for (let i = 1; i < pts.length; i++) ctx.lineTo(pts[i][0], pts[i][1]);\n if (close) ctx.closePath();\n };\n\n const ellipse = (x, y, rx, ry, fill, stroke, lw = 1) => {\n ctx.beginPath();\n ctx.ellipse(x, y, rx, ry, 0, 0, Math.PI * 2);\n if (fill) {\n ctx.fillStyle = fill;\n ctx.fill();\n }\n if (stroke) {\n ctx.lineWidth = lw;\n ctx.strokeStyle = stroke;\n ctx.stroke();\n }\n };\n\n // Sky\n let g = ctx.createLinearGradient(0, 0, 0, 400);\n g.addColorStop(0, \"#698b9c\");\n g.addColorStop(0.38, \"#a9c0c1\");\n g.addColorStop(0.72, \"#d5c9ad\");\n g.addColorStop(1, \"#d6ad79\");\n ctx.fillStyle = g;\n ctx.fillRect(0, 0, 512, 512);\n\n // Soft sun and atmospheric haze\n const sun = ctx.createRadialGradient(401, 105, 2, 401, 105, 95);\n sun.addColorStop(0, \"rgba(255,241,188,.9)\");\n sun.addColorStop(.22, \"rgba(252,220,152,.38)\");\n sun.addColorStop(1, \"rgba(255,220,160,0)\");\n ctx.fillStyle = sun;\n ctx.fillRect(300, 3, 205, 205);\n ellipse(401, 106, 22, 22, \"rgba(255,231,171,.48)\");\n\n // Wispy clouds\n ctx.save();\n ctx.globalAlpha = .22;\n for (let i = 0; i < 20; i++) {\n const x = rr(-40, 500), y = rr(35, 215), w = rr(35, 105);\n const cg = ctx.createLinearGradient(x, y, x, y + 14);\n cg.addColorStop(0, \"rgba(255,255,244,.8)\");\n cg.addColorStop(1, \"rgba(215,219,208,0)\");\n ctx.fillStyle = cg;\n ctx.beginPath();\n ctx.ellipse(x, y, w, rr(2, 7), rr(-.08, .08), 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n // Distant birds\n ctx.strokeStyle = \"rgba(55,61,57,.55)\";\n ctx.lineWidth = 1;\n for (let i = 0; i < 14; i++) {\n const x = 35 + i * 8 + rr(-5, 5);\n const y = 104 + Math.sin(i * .7) * 11 + rr(-2, 2);\n ctx.beginPath();\n ctx.moveTo(x - 4, y + 1);\n ctx.quadraticCurveTo(x - 2, y - 2, x, y);\n ctx.quadraticCurveTo(x + 2, y - 3, x + 5, y - 1);\n ctx.stroke();\n }\n\n // Far hills\n const hills = [\n { y: 327, color: \"#65766c\", alpha: .28, amp: 25 },\n { y: 353, color: \"#5e6957\", alpha: .43, amp: 35 },\n { y: 385, color: \"#594f3e\", alpha: .65, amp: 26 }\n ];\n hills.forEach((h, n) => {\n ctx.save();\n ctx.globalAlpha = h.alpha;\n ctx.fillStyle = h.color;\n ctx.beginPath();\n ctx.moveTo(0, 512);\n ctx.lineTo(0, h.y);\n for (let x = 0; x <= 512; x += 12) {\n const yy = h.y - Math.sin(x * .015 + n) * h.amp * .4 - rr(0, h.amp);\n ctx.lineTo(x, yy);\n }\n ctx.lineTo(512, 512);\n ctx.closePath();\n ctx.fill();\n ctx.restore();\n });\n\n // Autumn forest layers\n function drawTree(x, base, scale, color, dark) {\n ctx.fillStyle = dark;\n ctx.fillRect(x - scale * .06, base - scale * .72, scale * .12, scale * .72);\n ctx.fillStyle = color;\n const crowns = [\n [x, base - scale * .86, scale * .34],\n [x - scale * .21, base - scale * .65, scale * .27],\n [x + scale * .22, base - scale * .64, scale * .3],\n [x - scale * .07, base - scale * .43, scale * .32],\n [x + scale * .11, base - scale * .98, scale * .22]\n ];\n crowns.forEach(c => {\n ctx.beginPath();\n ctx.arc(c[0], c[1], c[2], 0, Math.PI * 2);\n ctx.fill();\n });\n }\n\n const palettes = [\n [\"#8e6432\", \"#9b793e\", \"#735330\", \"#a46c31\"],\n [\"#a85625\", \"#c2762f\", \"#835a27\", \"#b14c25\"],\n [\"#7d3520\", \"#a14321\", \"#d07a28\", \"#6d4825\"]\n ];\n for (let layer = 0; layer < 3; layer++) {\n const base = 435 + layer * 35;\n const count = 44 + layer * 12;\n for (let i = 0; i < count; i++) {\n const x = rr(-20, 532);\n const s = rr(18, 39) * (1 + layer * .23);\n drawTree(\n x,\n base + rr(-9, 10),\n s,\n palettes[layer][Math.floor(rnd() * palettes[layer].length)],\n layer === 2 ? \"#493424\" : \"#5b4930\"\n );\n }\n }\n\n // Mist over canopy\n g = ctx.createLinearGradient(0, 380, 0, 485);\n g.addColorStop(0, \"rgba(222,211,184,.28)\");\n g.addColorStop(.5, \"rgba(221,190,150,.08)\");\n g.addColorStop(1, \"rgba(61,39,24,0)\");\n ctx.fillStyle = g;\n ctx.fillRect(0, 360, 512, 135);\n\n // Floating island shadow\n ctx.save();\n ctx.filter = \"blur(11px)\";\n ellipse(258, 406, 150, 19, \"rgba(39,32,25,.28)\");\n ctx.restore();\n\n // Long clock hands forming the flying structure\n function clockHand(points, fillA = \"#3c3329\", fillB = \"#9a7140\") {\n ctx.save();\n ctx.shadowColor = \"rgba(17,15,13,.45)\";\n ctx.shadowBlur = 8;\n ctx.shadowOffsetY = 7;\n path(points);\n g = ctx.createLinearGradient(0, 242, 0, 350);\n g.addColorStop(0, fillB);\n g.addColorStop(.48, fillA);\n g.addColorStop(1, \"#1f1d1a\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.strokeStyle = \"#211c17\";\n ctx.lineWidth = 2;\n ctx.stroke();\n ctx.restore();\n }\n\n clockHand([[244,276],[48,326],[39,338],[236,305],[257,294]], \"#44372a\", \"#ac814b\");\n clockHand([[273,277],[472,240],[488,247],[281,307],[254,298]], \"#3b3229\", \"#957146\");\n clockHand([[255,286],[318,400],[311,425],[244,307]], \"#2c2823\", \"#81613b\");\n clockHand([[248,285],[165,206],[158,195],[260,270]], \"#42372b\", \"#a17a48\");\n\n // Hand cutouts/rivets\n [[76,329],[108,320],[143,312],[184,302],[360,282],[403,267],[447,254],[298,364],[308,395]].forEach(p => {\n ellipse(p[0], p[1], 3.5, 2.3, \"#201d19\", \"#b18853\", .7);\n });\n\n // Clockwork island body\n ctx.save();\n ctx.shadowColor = \"rgba(12,12,10,.5)\";\n ctx.shadowBlur = 14;\n ctx.shadowOffsetY = 9;\n path([[100,271],[133,251],[196,239],[273,236],[356,244],[409,265],[397,304],[357,337],[286,362],[218,352],[148,321],[111,295]]);\n g = ctx.createLinearGradient(0, 240, 0, 366);\n g.addColorStop(0, \"#a27645\");\n g.addColorStop(.16, \"#574534\");\n g.addColorStop(.6, \"#292722\");\n g.addColorStop(1, \"#151817\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.strokeStyle = \"#201b17\";\n ctx.lineWidth = 3;\n ctx.stroke();\n ctx.restore();\n\n // Rocky/mechanical underside facets\n const facets = [\n [[121,284],[172,298],[153,326],[113,295],\"#493a2d\"],\n [[172,298],[219,304],[218,351],[153,326],\"#252420\"],\n [[219,304],[276,308],[286,361],[218,351],\"#343027\"],\n [[276,308],[337,296],[356,337],[286,361],\"#1f211e\"],\n [[337,296],[402,279],[397,304],[356,337],\"#443529\"]\n ];\n facets.forEach(f => {\n path(f.slice(0,4));\n ctx.fillStyle = f[4];\n ctx.fill();\n ctx.strokeStyle = \"rgba(173,130,75,.35)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n });\n\n // Hanging gears\n function gear(x, y, r, teeth) {\n ctx.save();\n ctx.translate(x, y);\n ctx.fillStyle = \"#2c2822\";\n ctx.strokeStyle = \"#a07743\";\n ctx.lineWidth = 2;\n ctx.beginPath();\n for (let i = 0; i < teeth * 2; i++) {\n const a = i * Math.PI / teeth;\n const rad = i % 2 ? r * .82 : r;\n const px = Math.cos(a) * rad, py = Math.sin(a) * rad;\n i ? ctx.lineTo(px, py) : ctx.moveTo(px, py);\n }\n ctx.closePath();\n ctx.fill();\n ctx.stroke();\n ellipse(0, 0, r * .56, r * .56, \"#171817\", \"#725638\", 1.4);\n ellipse(0, 0, r * .16, r * .16, \"#a17843\", \"#231d18\", 1);\n ctx.restore();\n }\n gear(169, 322, 22, 12);\n gear(348, 311, 27, 14);\n gear(231, 344, 16, 10);\n gear(302, 337, 13, 9);\n\n // Top clock face platform\n ellipse(256, 266, 158, 43, \"#312d26\", \"#b78a4e\", 4);\n ellipse(256, 260, 148, 34, \"#857054\", \"#29251f\", 2);\n ellipse(256, 257, 137, 29, \"#b2a17f\", \"#5d4931\", 2);\n\n // Clock face radial lines and numerals-like marks\n ctx.save();\n ctx.translate(256, 257);\n for (let i = 0; i < 24; i++) {\n const a = i * Math.PI * 2 / 24;\n ctx.strokeStyle = i % 2 ? \"#695438\" : \"#40382d\";\n ctx.lineWidth = i % 3 ? 1 : 2.2;\n ctx.beginPath();\n ctx.moveTo(Math.cos(a) * 112, Math.sin(a) * 23);\n ctx.lineTo(Math.cos(a) * 132, Math.sin(a) * 28);\n ctx.stroke();\n }\n ctx.restore();\n ellipse(256, 261, 10, 6, \"#392f25\", \"#d0a969\", 2);\n\n // Temple foundation\n ctx.shadowColor = \"rgba(25,20,16,.3)\";\n ctx.shadowBlur = 5;\n ctx.shadowOffsetY = 3;\n const marble = ctx.createLinearGradient(0, 0, 340, 0);\n marble.addColorStop(0, \"#9e9b8e\");\n marble.addColorStop(.25, \"#e5dfcd\");\n marble.addColorStop(.56, \"#b8b5a8\");\n marble.addColorStop(.82, \"#f0ead7\");\n marble.addColorStop(1, \"#898b82\");\n ctx.fillStyle = marble;\n ctx.strokeStyle = \"#77776e\";\n ctx.lineWidth = 1;\n ctx.fillRect(168, 238, 176, 13);\n ctx.strokeRect(168, 238, 176, 13);\n ctx.fillRect(177, 227, 158, 11);\n ctx.strokeRect(177, 227, 158, 11);\n ctx.shadowColor = \"transparent\";\n\n // Temple inner darkness\n ctx.fillStyle = \"#343630\";\n ctx.fillRect(193, 160, 126, 68);\n for (let i = 0; i < 5; i++) {\n const x = 207 + i * 25;\n ctx.fillStyle = i % 2 ? \"#454740\" : \"#292d2a\";\n ctx.fillRect(x, 174, 11, 54);\n }\n\n // Columns\n function column(x, y, h, w) {\n const cg = ctx.createLinearGradient(x, 0, x + w, 0);\n cg.addColorStop(0, \"#888a83\");\n cg.addColorStop(.18, \"#ddd9ca\");\n cg.addColorStop(.46, \"#f2ecdc\");\n cg.addColorStop(.72, \"#aaa99e\");\n cg.addColorStop(1, \"#73776f\");\n ctx.fillStyle = cg;\n ctx.fillRect(x, y, w, h);\n ctx.strokeStyle = \"rgba(91,91,83,.65)\";\n ctx.lineWidth = .7;\n ctx.strokeRect(x, y, w, h);\n for (let j = 1; j < 4; j++) {\n ctx.strokeStyle = \"rgba(112,111,102,.28)\";\n ctx.beginPath();\n ctx.moveTo(x + j * w / 4, y + 2);\n ctx.lineTo(x + j * w / 4, y + h - 2);\n ctx.stroke();\n }\n ctx.fillStyle = marble;\n ctx.fillRect(x - 3, y - 5, w + 6, 6);\n ctx.fillRect(x - 4, y + h - 2, w + 8, 6);\n }\n [184,207,230,253,276,299,322].forEach(x => column(x, 164, 65, 12));\n\n // Entablature\n ctx.fillStyle = marble;\n ctx.fillRect(176, 151, 167, 14);\n ctx.strokeStyle = \"#70736d\";\n ctx.strokeRect(176, 151, 167, 14);\n ctx.fillRect(183, 143, 153, 9);\n ctx.strokeRect(183, 143, 153, 9);\n\n // Pediment\n path([[177,143],[259,100],[342,143]]);\n ctx.fillStyle = marble;\n ctx.fill();\n ctx.strokeStyle = \"#6d706b\";\n ctx.lineWidth = 2;\n ctx.stroke();\n path([[194,139],[259,108],[325,139]]);\n ctx.fillStyle = \"#787970\";\n ctx.fill();\n path([[206,136],[259,113],[312,136]]);\n ctx.fillStyle = \"#b7b2a3\";\n ctx.fill();\n\n // Pediment relief\n ellipse(259, 126, 8, 6, \"#8a867b\");\n ctx.strokeStyle = \"#77756e\";\n ctx.lineWidth = 1.2;\n for (let i = 0; i < 6; i++) {\n const x = 223 + i * 14;\n ctx.beginPath();\n ctx.moveTo(x, 137);\n ctx.lineTo(x + 6, 123 + Math.abs(3 - i) * 3);\n ctx.stroke();\n }\n\n // Roof cap and statue\n ctx.fillStyle = \"#d9d3c2\";\n ctx.fillRect(173, 140, 172, 5);\n ellipse(259, 98, 4, 4, \"#c7c0ae\", \"#67665f\");\n ctx.fillStyle = \"#aaa89c\";\n ctx.fillRect(257, 99, 4, 12);\n path([[251,110],[259,101],[267,110]]);\n ctx.fill();\n\n // Marble weathering\n ctx.save();\n ctx.globalAlpha = .22;\n ctx.strokeStyle = \"#666c68\";\n ctx.lineWidth = .7;\n for (let i = 0; i < 30; i++) {\n const x = rr(180, 338), y = rr(145, 240);\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.lineTo(x + rr(-5, 8), y + rr(2, 12));\n ctx.stroke();\n }\n ctx.restore();\n\n // Copper banner poles and fluttering banners\n function banner(x, y, dir, size, phase) {\n ctx.strokeStyle = \"#4c3827\";\n ctx.lineWidth = 1.5;\n ctx.beginPath();\n ctx.moveTo(x, y + 38);\n ctx.lineTo(x, y);\n ctx.stroke();\n ellipse(x, y - 2, 2, 2, \"#d49a54\", \"#523a27\");\n\n const len = size;\n ctx.beginPath();\n ctx.moveTo(x + dir, y + 4);\n ctx.bezierCurveTo(\n x + dir * len * .3, y + phase,\n x + dir * len * .67, y + 4 - phase,\n x + dir * len, y + 8\n );\n ctx.lineTo(x + dir * len * .82, y + 15);\n ctx.bezierCurveTo(\n x + dir * len * .55, y + 11 + phase,\n x + dir * len * .25, y + 17 - phase,\n x + dir, y + 13\n );\n ctx.closePath();\n const bg = ctx.createLinearGradient(x, y, x + dir * len, y + 15);\n bg.addColorStop(0, \"#7c321d\");\n bg.addColorStop(.42, \"#cf7133\");\n bg.addColorStop(.72, \"#9b4323\");\n bg.addColorStop(1, \"#e69a4d\");\n ctx.fillStyle = bg;\n ctx.fill();\n ctx.strokeStyle = \"#6a2c1d\";\n ctx.lineWidth = .6;\n ctx.stroke();\n ctx.strokeStyle = \"rgba(255,194,102,.55)\";\n ctx.beginPath();\n ctx.moveTo(x + dir * 4, y + 7);\n ctx.bezierCurveTo(x + dir * len * .35, y + phase + 3, x + dir * len * .65, y + 7 - phase, x + dir * len * .86, y + 10);\n ctx.stroke();\n }\n\n // Temple roof banners\n [\n [181,123,-1,26,3],[205,112,-1,24,-2],[230,101,1,26,3],\n [286,102,1,28,-3],[311,113,1,25,3],[337,126,1,30,-2]\n ].forEach(b => banner(...b));\n\n // Platform perimeter banners, dozens\n const bannerData = [];\n for (let i = 0; i < 9; i++) bannerData.push([118 + i * 18, 240 + Math.sin(i * .5) * 7, i < 3 ? -1 : 1, rr(16, 28), rr(-4, 4)]);\n for (let i = 0; i < 9; i++) bannerData.push([278 + i * 15, 239 + Math.sin(i * .65) * 8, 1, rr(17, 30), rr(-4, 4)]);\n bannerData.forEach(b => banner(...b));\n\n // Foreground cables, pendulum and hanging ornaments\n ctx.strokeStyle = \"#2b2924\";\n ctx.lineWidth = 1.2;\n [[196,291,188,373],[323,294,334,380],[270,311,270,398]].forEach(c => {\n ctx.beginPath();\n ctx.moveTo(c[0], c[1]);\n ctx.quadraticCurveTo((c[0] + c[2]) / 2 + 5, (c[1] + c[3]) / 2, c[2], c[3]);\n ctx.stroke();\n });\n ellipse(188, 376, 6, 9, \"#8c6538\", \"#27231f\", 1.5);\n ellipse(334, 384, 8, 12, \"#62482e\", \"#211f1b\", 1.5);\n ellipse(270, 405, 10, 14, \"#a8793d\", \"#25211c\", 2);\n ellipse(270, 405, 4, 7, \"#d9a558\");\n\n // Highlights and airborne leaves\n ctx.save();\n for (let i = 0; i < 35; i++) {\n const x = rr(35, 480), y = rr(190, 410);\n if (x > 105 && x < 410 && y > 225 && y < 350) continue;\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(rr(0, Math.PI));\n ctx.fillStyle = [\"#b86026\", \"#d68a35\", \"#7d3c23\", \"#cb9b48\"][Math.floor(rnd() * 4)];\n ctx.globalAlpha = rr(.45, .9);\n ctx.beginPath();\n ctx.ellipse(0, 0, rr(1.4, 3.2), rr(.5, 1.2), 0, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n }\n ctx.restore();\n\n // Overall cinematic vignette and warm light\n const light = ctx.createLinearGradient(0, 0, 512, 512);\n light.addColorStop(0, \"rgba(75,106,123,.12)\");\n light.addColorStop(.5, \"rgba(255,225,171,0)\");\n light.addColorStop(1, \"rgba(124,58,26,.14)\");\n ctx.fillStyle = light;\n ctx.fillRect(0, 0, 512, 512);\n\n const vignette = ctx.createRadialGradient(256, 240, 160, 256, 250, 390);\n vignette.addColorStop(.45, \"rgba(0,0,0,0)\");\n vignette.addColorStop(1, \"rgba(20,24,25,.42)\");\n ctx.fillStyle = vignette;\n ctx.fillRect(0, 0, 512, 512);\n\n // Fine grain\n ctx.save();\n ctx.globalAlpha = .035;\n for (let i = 0; i < 7500; i++) {\n const v = rnd() > .5 ? 255 : 0;\n ctx.fillStyle = `rgb(${v},${v},${v})`;\n ctx.fillRect(rnd() * 512, rnd() * 512, .5, .5);\n }\n ctx.restore();\n\n await new Promise(resolve => requestAnimationFrame(resolve));\n}"}], "metadata": {"id": "val-v1-broad-v2-imagination-validation-006", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 7383, "code_sha256": "117185ad1df4835b6d9c41291868615483dcc4cdf8b2eed5c576979a42e99ef5"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A slender sky island shaped like a mechanical seahorse drifts above the ocean, with a spiral village wrapped around its ticking central shaft."}, {"role": "assistant", "content": "async function render(stage) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = canvas.height = 1024;\n canvas.style.cssText = \"width:100%;height:100%;display:block\";\n stage.replaceChildren(canvas);\n\n const c = canvas.getContext(\"2d\");\n const W = 1024, H = 1024;\n let seed = 24731;\n const rnd = () => ((seed = (seed * 1664525 + 1013904223) >>> 0) / 4294967296);\n const lerp = (a, b, t) => a + (b - a) * t;\n\n function ellipse(x, y, rx, ry, fill, stroke, lw = 1) {\n c.beginPath();\n c.ellipse(x, y, rx, ry, 0, 0, Math.PI * 2);\n if (fill) { c.fillStyle = fill; c.fill(); }\n if (stroke) { c.strokeStyle = stroke; c.lineWidth = lw; c.stroke(); }\n }\n function line(points, stroke, lw = 1, close = false, fill = null) {\n c.beginPath();\n c.moveTo(points[0][0], points[0][1]);\n for (let i = 1; i < points.length; i++) c.lineTo(points[i][0], points[i][1]);\n if (close) c.closePath();\n if (fill) { c.fillStyle = fill; c.fill(); }\n if (stroke) { c.strokeStyle = stroke; c.lineWidth = lw; c.stroke(); }\n }\n function cloud(x, y, s, alpha) {\n c.save();\n c.globalAlpha = alpha;\n const g = c.createRadialGradient(x, y, 8, x, y, 115 * s);\n g.addColorStop(0, \"rgba(255,255,255,.95)\");\n g.addColorStop(.55, \"rgba(248,247,229,.62)\");\n g.addColorStop(1, \"rgba(255,255,255,0)\");\n c.fillStyle = g;\n for (let i = 0; i < 13; i++) {\n const a = rnd() * Math.PI * 2;\n const d = rnd() * 65 * s;\n ellipse(x + Math.cos(a) * d, y + Math.sin(a) * d * .33,\n (38 + rnd() * 60) * s, (18 + rnd() * 26) * s, g);\n }\n c.restore();\n }\n\n // Sky\n let sky = c.createLinearGradient(0, 0, 0, 760);\n sky.addColorStop(0, \"#326a91\");\n sky.addColorStop(.28, \"#78adc5\");\n sky.addColorStop(.62, \"#d4d8c7\");\n sky.addColorStop(1, \"#f1d6a4\");\n c.fillStyle = sky;\n c.fillRect(0, 0, W, H);\n\n // Sun and atmospheric glow\n let sun = c.createRadialGradient(795, 190, 0, 795, 190, 280);\n sun.addColorStop(0, \"rgba(255,250,207,.96)\");\n sun.addColorStop(.13, \"rgba(255,226,147,.48)\");\n sun.addColorStop(1, \"rgba(255,225,164,0)\");\n c.fillStyle = sun;\n c.fillRect(500, 0, 524, 530);\n ellipse(794, 190, 43, 43, \"rgba(255,247,207,.84)\");\n\n c.save();\n c.globalCompositeOperation = \"screen\";\n c.globalAlpha = .12;\n for (let i = 0; i < 6; i++) {\n line([[790, 185], [450 - i * 50, 725], [540 - i * 35, 725]], null, 0, true, \"#fff8d1\");\n }\n c.restore();\n\n cloud(120, 240, 1.05, .26);\n cloud(878, 386, .85, .26);\n cloud(250, 535, .62, .20);\n cloud(675, 500, .65, .18);\n\n // Distant horizon and ocean\n c.fillStyle = \"rgba(154,179,174,.45)\";\n c.fillRect(0, 690, W, 18);\n let sea = c.createLinearGradient(0, 690, 0, H);\n sea.addColorStop(0, \"#7fa7a9\");\n sea.addColorStop(.25, \"#467e8d\");\n sea.addColorStop(1, \"#173f55\");\n c.fillStyle = sea;\n c.fillRect(0, 700, W, 324);\n\n for (let i = 0; i < 420; i++) {\n const y = 705 + rnd() * 319;\n const perspective = (y - 700) / 324;\n const x = rnd() * W;\n const len = 3 + rnd() * (8 + 38 * perspective);\n c.globalAlpha = .08 + rnd() * .2;\n c.strokeStyle = rnd() > .35 ? \"#d6e2d6\" : \"#173d52\";\n c.lineWidth = .6 + perspective * 2;\n c.beginPath();\n c.moveTo(x, y);\n c.lineTo(x + len, y + (rnd() - .5) * 2);\n c.stroke();\n }\n c.globalAlpha = 1;\n\n // Island's immense cast shadow on ocean\n c.save();\n c.filter = \"blur(18px)\";\n ellipse(525, 880, 205, 35, \"rgba(8,24,31,.35)\");\n c.restore();\n\n // Hanging mist below island\n c.save();\n c.filter = \"blur(11px)\";\n for (let i = 0; i < 23; i++) {\n const x = 390 + rnd() * 275, y = 664 + rnd() * 125;\n ellipse(x, y, 35 + rnd() * 70, 8 + rnd() * 18, \"rgba(238,242,226,.13)\");\n }\n c.restore();\n\n // Seahorse silhouette: tail, body, neck, head\n c.save();\n c.shadowColor = \"rgba(19,29,27,.45)\";\n c.shadowBlur = 30;\n c.shadowOffsetY = 22;\n\n const bodyGrad = c.createLinearGradient(350, 200, 690, 650);\n bodyGrad.addColorStop(0, \"#7b7156\");\n bodyGrad.addColorStop(.28, \"#4c5145\");\n bodyGrad.addColorStop(.65, \"#272f2c\");\n bodyGrad.addColorStop(1, \"#111d1f\");\n\n c.beginPath();\n c.moveTo(540, 214);\n c.bezierCurveTo(502, 254, 477, 312, 482, 380);\n c.bezierCurveTo(488, 453, 449, 519, 426, 579);\n c.bezierCurveTo(404, 636, 428, 693, 493, 718);\n c.bezierCurveTo(560, 744, 636, 708, 644, 647);\n c.bezierCurveTo(652, 589, 605, 558, 568, 579);\n c.bezierCurveTo(539, 596, 542, 632, 568, 641);\n c.bezierCurveTo(590, 649, 608, 627, 595, 609);\n c.bezierCurveTo(621, 625, 620, 665, 592, 685);\n c.bezierCurveTo(549, 715, 486, 689, 478, 644);\n c.bezierCurveTo(469, 593, 531, 542, 558, 487);\n c.bezierCurveTo(593, 417, 579, 340, 608, 283);\n c.bezierCurveTo(625, 249, 600, 218, 540, 214);\n c.closePath();\n c.fillStyle = bodyGrad;\n c.fill();\n c.restore();\n\n // Head, crown, snout\n let headGrad = c.createLinearGradient(505, 110, 810, 300);\n headGrad.addColorStop(0, \"#8d815e\");\n headGrad.addColorStop(.42, \"#4c5549\");\n headGrad.addColorStop(1, \"#202b2b\");\n c.beginPath();\n c.moveTo(514, 238);\n c.bezierCurveTo(486, 207, 500, 148, 548, 120);\n c.bezierCurveTo(590, 95, 647, 115, 673, 143);\n c.bezierCurveTo(703, 176, 733, 179, 806, 184);\n c.bezierCurveTo(845, 187, 867, 203, 848, 220);\n c.bezierCurveTo(813, 249, 742, 225, 691, 232);\n c.bezierCurveTo(654, 237, 644, 274, 605, 283);\n c.bezierCurveTo(565, 292, 534, 270, 514, 238);\n c.closePath();\n c.fillStyle = headGrad;\n c.fill();\n\n // Crown fins / spines\n const spines = [\n [[526,152],[486,103],[544,124]],\n [[556,125],[538,63],[581,117]],\n [[594,118],[606,54],[622,126]],\n [[631,128],[677,81],[656,148]]\n ];\n for (const p of spines) {\n line(p, \"#202c2c\", 3, true, \"#6e694f\");\n line([p[0], p[1]], \"rgba(221,190,116,.4)\", 2);\n }\n\n // Snout plates\n line([[665,175],[800,188],[845,205],[798,213],[682,209]], \"#171f20\", 5, true, \"#4b5449\");\n line([[703,183],[700,211]], \"#a58c5e\", 3);\n line([[749,187],[746,214]], \"#a58c5e\", 3);\n line([[801,192],[795,214]], \"#a58c5e\", 3);\n ellipse(834, 205, 8, 5, \"#101819\", \"#aa8d55\", 2);\n\n // Eye assembly\n ellipse(619, 174, 31, 31, \"#25302d\", \"#b69759\", 6);\n ellipse(619, 174, 18, 18, \"#d7a84d\", \"#121b1b\", 4);\n ellipse(622, 171, 7, 9, \"#071414\");\n ellipse(617, 166, 3, 3, \"#fff6c5\");\n for (let i = 0; i < 12; i++) {\n const a = i * Math.PI / 6;\n line([[619 + Math.cos(a)*33,174 + Math.sin(a)*33],\n [619 + Math.cos(a)*39,174 + Math.sin(a)*39]], \"#b39459\", 4);\n }\n\n // Body riveted ribs\n c.save();\n c.globalAlpha = .8;\n for (let i = 0; i < 11; i++) {\n const y = 282 + i * 31;\n const x = 531 + Math.sin(i * .72) * 16;\n c.strokeStyle = i % 2 ? \"#141e1f\" : \"#91815c\";\n c.lineWidth = 6;\n c.beginPath();\n c.arc(x, y, 66 - i * 1.8, -.25, Math.PI * .88);\n c.stroke();\n ellipse(x + 61, y + 18, 4, 4, \"#c3a66a\");\n }\n c.restore();\n\n // Central ticking shaft\n let shaft = c.createLinearGradient(480, 0, 590, 0);\n shaft.addColorStop(0, \"#1b2828\");\n shaft.addColorStop(.22, \"#8f794b\");\n shaft.addColorStop(.47, \"#d0b271\");\n shaft.addColorStop(.58, \"#594727\");\n shaft.addColorStop(1, \"#182222\");\n c.fillStyle = shaft;\n c.fillRect(514, 232, 54, 365);\n c.strokeStyle = \"#101819\";\n c.lineWidth = 7;\n c.strokeRect(514, 232, 54, 365);\n for (let y = 249; y < 590; y += 25) {\n c.fillStyle = y % 50 ? \"#9f7d3f\" : \"#d3b570\";\n c.fillRect(520, y, 42, 5);\n ellipse(524, y + 2, 3, 3, \"#241e16\");\n ellipse(558, y + 2, 3, 3, \"#241e16\");\n }\n\n // Gears\n function gear(x, y, r, teeth, color, angle = 0) {\n c.save();\n c.translate(x, y); c.rotate(angle);\n c.beginPath();\n for (let i = 0; i < teeth * 2; i++) {\n const a = i * Math.PI / teeth;\n const rr = i % 2 ? r * .79 : r;\n const px = Math.cos(a) * rr, py = Math.sin(a) * rr;\n i ? c.lineTo(px, py) : c.moveTo(px, py);\n }\n c.closePath();\n c.fillStyle = color; c.fill();\n c.strokeStyle = \"#151b1a\"; c.lineWidth = 5; c.stroke();\n ellipse(0, 0, r * .46, r * .46, \"#2c3430\", \"#bc9959\", 4);\n ellipse(0, 0, r * .14, r * .14, \"#c5a461\", \"#171d1c\", 3);\n c.restore();\n }\n gear(500, 328, 44, 13, \"#907543\", .1);\n gear(577, 374, 34, 11, \"#b28c48\", .3);\n gear(496, 434, 30, 10, \"#745e37\", .5);\n gear(582, 499, 46, 14, \"#9f8046\", .15);\n\n // Clock face\n ellipse(539, 278, 46, 46, \"#2a3430\", \"#d0ad67\", 7);\n ellipse(539, 278, 35, 35, \"#d5c79e\", \"#594a31\", 3);\n for (let i = 0; i < 12; i++) {\n const a = i * Math.PI / 6 - Math.PI / 2;\n line([[539 + Math.cos(a)*27,278 + Math.sin(a)*27],\n [539 + Math.cos(a)*32,278 + Math.sin(a)*32]], \"#463b2c\", 3);\n }\n line([[539,278],[539,253]], \"#2d2922\", 4);\n line([[539,278],[557,287]], \"#2d2922\", 4);\n ellipse(539,278,5,5,\"#a67d35\");\n\n // Spiral terraces\n const terraces = [\n {x:526,y:245,rx:122,ry:30,a:-.12},\n {x:525,y:324,rx:157,ry:39,a:.07},\n {x:520,y:411,rx:139,ry:35,a:-.1},\n {x:522,y:499,rx:119,ry:31,a:.08},\n {x:518,y:574,rx:93,ry:25,a:-.06}\n ];\n for (const t of terraces) {\n c.save(); c.translate(t.x,t.y); c.rotate(t.a);\n c.beginPath();\n c.ellipse(0, 10, t.rx, t.ry, 0, Math.PI, Math.PI*2);\n c.lineTo(t.rx-8, 25);\n c.ellipse(0, 20, t.rx-8, t.ry*.66, 0, 0, Math.PI);\n c.closePath();\n let tg = c.createLinearGradient(0,-25,0,35);\n tg.addColorStop(0,\"#98906b\");\n tg.addColorStop(.4,\"#59604e\");\n tg.addColorStop(1,\"#202c29\");\n c.fillStyle=tg;c.fill();\n c.strokeStyle=\"#18211f\";c.lineWidth=6;c.stroke();\n c.beginPath();c.ellipse(0,0,t.rx,t.ry,0,Math.PI,Math.PI*2);\n c.strokeStyle=\"#c0a66d\";c.lineWidth=5;c.stroke();\n c.restore();\n }\n\n // Spiral rail wrapping shaft\n c.save();\n c.strokeStyle=\"#d0ad68\"; c.lineWidth=6;\n c.shadowColor=\"#151a19\"; c.shadowBlur=3; c.shadowOffsetY=3;\n c.beginPath();\n for (let i=0;i<=130;i++) {\n const t=i/130, y=226+t*373, a=t*Math.PI*9.2;\n const x=540+Math.cos(a)*(75-20*t);\n const yy=y+Math.sin(a)*15;\n i?c.lineTo(x,yy):c.moveTo(x,yy);\n }\n c.stroke(); c.restore();\n\n // Tiny village houses\n function house(x,y,s,wall,roof,flip=0) {\n c.save(); c.translate(x,y); c.scale(s,s);\n c.fillStyle=\"rgba(11,17,16,.28)\";\n c.beginPath(); c.ellipse(4,11,18,5,0,0,Math.PI*2); c.fill();\n c.fillStyle=wall;\n c.fillRect(-12,-17,24,27);\n c.strokeStyle=\"#252b26\";c.lineWidth=2;c.strokeRect(-12,-17,24,27);\n c.beginPath();\n c.moveTo(-17,-16);c.lineTo(flip?3:-3,-33);c.lineTo(17,-16);c.closePath();\n c.fillStyle=roof;c.fill();c.stroke();\n c.fillStyle=\"#ffd879\";\n c.fillRect(-7,-10,6,7);c.fillRect(4,-10,6,7);\n c.fillStyle=\"#403224\";c.fillRect(-3,0,7,10);\n c.fillStyle=\"#604b34\";c.fillRect(7,-30,4,12);\n c.restore();\n }\n const homes = [\n [420,225,.72,\"#aa946b\",\"#4d493b\",0],[470,212,.82,\"#c0a36e\",\"#633e31\",1],\n [585,216,.8,\"#9a8560\",\"#384840\",0],[635,235,.62,\"#c0a66e\",\"#56402f\",1],\n [386,301,.92,\"#9e8057\",\"#4e4237\",0],[448,291,.72,\"#c5aa75\",\"#66503a\",1],\n [608,294,.9,\"#a98c62\",\"#3c4944\",0],[671,321,.7,\"#bca273\",\"#5c3f34\",1],\n [399,389,.74,\"#a88f67\",\"#4b4b3f\",1],[458,378,.86,\"#c2a46a\",\"#684536\",0],\n [608,392,.74,\"#af9569\",\"#394844\",1],[646,420,.64,\"#c4a96f\",\"#5d4634\",0],\n [425,481,.72,\"#ae9468\",\"#4a4c41\",0],[476,468,.78,\"#c6aa72\",\"#694b37\",1],\n [596,484,.76,\"#9e845d\",\"#384640\",0],[612,553,.62,\"#b49a6d\",\"#554336\",1],\n [451,551,.62,\"#bca16e\",\"#424b43\",0]\n ];\n homes.forEach(h=>house(...h));\n\n // Towers and windmill\n c.fillStyle=\"#746b50\"; c.fillRect(359,276,19,50);\n line([[353,277],[369,251],[384,277]],\"#2b302b\",3,true,\"#554638\");\n ellipse(369,250,4,4,\"#d8b66f\");\n c.strokeStyle=\"#d1bd85\";c.lineWidth=3;\n c.beginPath();c.moveTo(369,250);c.lineTo(369,219);c.stroke();\n for(let i=0;i<4;i++){\n c.save();c.translate(369,232);c.rotate(i*Math.PI/2+.25);\n line([[0,0],[8,-25],[13,-24],[5,0]],\"#443d30\",2,true,\"#c8b27b\");\n c.restore();\n }\n\n // Vegetation tufts\n for(let i=0;i<95;i++){\n const tier=terraces[Math.floor(rnd()*terraces.length)];\n const a=Math.PI+rnd()*Math.PI;\n const x=tier.x+Math.cos(a)*tier.rx*(.52+rnd()*.43);\n const y=tier.y+Math.sin(a)*tier.ry+rnd()*6;\n const s=.5+rnd()*1.2;\n c.strokeStyle=rnd()>.4?\"#526b4b\":\"#7c7b4a\";\n c.lineWidth=1.5*s;\n c.beginPath();c.moveTo(x,y);\n c.quadraticCurveTo(x+(rnd()-.5)*8,y-8*s,x+(rnd()-.5)*10,y-15*s);\n c.stroke();\n }\n\n // Hanging roots, cables, waterfalls\n for(let i=0;i<18;i++){\n const x=430+rnd()*190, y=584+rnd()*43, len=22+rnd()*110;\n c.strokeStyle=rnd()>.3?\"rgba(33,41,34,.8)\":\"rgba(153,133,79,.65)\";\n c.lineWidth=1+rnd()*3;\n c.beginPath();c.moveTo(x,y);\n c.bezierCurveTo(x-12+rnd()*24,y+len*.3,x+18-rnd()*36,y+len*.65,x+(rnd()-.5)*30,y+len);\n c.stroke();\n }\n const falls=[[405,317,2],[653,338,1.5],[424,510,1.3]];\n falls.forEach(([x,y,w])=>{\n let fg=c.createLinearGradient(x,y,x+15,y+180);\n fg.addColorStop(0,\"rgba(197,231,225,.75)\");\n fg.addColorStop(1,\"rgba(210,237,233,0)\");\n c.strokeStyle=fg;c.lineWidth=w*4;\n c.beginPath();c.moveTo(x,y);\n c.bezierCurveTo(x-7,y+55,x+10,y+110,x-2,y+185);c.stroke();\n });\n\n // Tail rings and highlights\n c.strokeStyle=\"#a88b54\";c.lineWidth=5;\n for(let i=0;i<7;i++){\n const a=-.2+i*.24;\n c.beginPath();c.arc(548,638,53+i*3,a,a+.12);c.stroke();\n }\n\n // Birds for scale\n c.strokeStyle=\"rgba(35,48,46,.7)\";c.lineWidth=2.5;\n [[180,395,1],[840,500,.7],[232,170,.55],[740,365,.45]].forEach(([x,y,s])=>{\n c.beginPath();c.moveTo(x-12*s,y);c.quadraticCurveTo(x-5*s,y-8*s,x,y);\n c.quadraticCurveTo(x+6*s,y-8*s,x+13*s,y);c.stroke();\n });\n\n // Fine metallic highlights and rivets\n for(let i=0;i<80;i++){\n const y=238+rnd()*375;\n const x=495+rnd()*100;\n if(rnd()>.55) ellipse(x,y,1.6,1.6,\"rgba(232,196,119,.65)\");\n }\n\n // Foreground atmospheric grading\n let vignette=c.createRadialGradient(520,430,280,520,430,720);\n vignette.addColorStop(0,\"rgba(0,0,0,0)\");\n vignette.addColorStop(.72,\"rgba(8,23,29,.05)\");\n vignette.addColorStop(1,\"rgba(5,17,24,.38)\");\n c.fillStyle=vignette;c.fillRect(0,0,W,H);\n\n // Warm edge light\n c.save();\n c.globalCompositeOperation=\"screen\";\n c.strokeStyle=\"rgba(255,220,139,.25)\";\n c.lineWidth=4;\n c.beginPath();\n c.moveTo(548,119);\n c.bezierCurveTo(630,91,666,153,702,177);\n c.bezierCurveTo(743,184,802,181,843,200);\n c.stroke();\n c.restore();\n}"}], "metadata": {"id": "val-v1-broad-v2-imagination-validation-007", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 7453, "code_sha256": "b2daca319bcda60192707786383c715a82c82366e71da88a950de222aede9182"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "Cyanotype botanical study presenting four seaweed specimens in parallel rows, each with distinct branching fronds and translucent pale margins."}, {"role": "assistant", "content": "async function render(stage) {\n const NS = \"http://www.w3.org/2000/svg\";\n stage.replaceChildren();\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n background: \"#073d73\"\n });\n\n let seed = 1947;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n const n = (a, b) => a + (b - a) * rnd();\n\n const svg = document.createElementNS(NS, \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 512 512\");\n svg.setAttribute(\"width\", \"512\");\n svg.setAttribute(\"height\", \"512\");\n svg.setAttribute(\"aria-label\", \"Cyanotype botanical study of four seaweed specimens\");\n stage.appendChild(svg);\n\n svg.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `;\n\n const clouds = svg.querySelector(\"#clouds\");\n for (let i = 0; i < 20; i++) {\n const e = document.createElementNS(NS, \"ellipse\");\n e.setAttribute(\"cx\", n(-30, 542));\n e.setAttribute(\"cy\", n(-20, 532));\n e.setAttribute(\"rx\", n(25, 105));\n e.setAttribute(\"ry\", n(4, 18));\n e.setAttribute(\"fill\", rnd() > .5 ? \"#50a0bd\" : \"#001f50\");\n e.setAttribute(\"opacity\", n(.06, .19));\n e.setAttribute(\"filter\", \"url(#softEdge)\");\n clouds.appendChild(e);\n }\n\n const specimens = svg.querySelector(\"#specimens\");\n const surface = svg.querySelector(\"#surface\");\n\n function pathEl(d, attrs = {}, parent = specimens) {\n const p = document.createElementNS(NS, \"path\");\n p.setAttribute(\"d\", d);\n for (const [k, v] of Object.entries(attrs)) p.setAttribute(k, v);\n parent.appendChild(p);\n return p;\n }\n\n function layeredStroke(d, width, opacity = .72, parent = specimens) {\n pathEl(d, {\n fill: \"none\", stroke: \"#bce6df\", \"stroke-width\": width + 5,\n \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\",\n opacity: opacity * .19, filter: \"url(#softEdge)\"\n }, parent);\n pathEl(d, {\n fill: \"none\", stroke: \"#dff3e5\", \"stroke-width\": width + 1.6,\n \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\",\n opacity: opacity * .58\n }, parent);\n pathEl(d, {\n fill: \"none\", stroke: \"#8bc9d2\", \"stroke-width\": Math.max(.5, width - .5),\n \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\",\n opacity\n }, parent);\n pathEl(d, {\n fill: \"none\", stroke: \"#eef7e9\", \"stroke-width\": Math.max(.35, width * .2),\n \"stroke-linecap\": \"round\", opacity: opacity * .72\n }, parent);\n }\n\n function curve(x1, y1, x2, y2, bend = 0) {\n const dx = x2 - x1, dy = y2 - y1;\n return `M${x1.toFixed(1)},${y1.toFixed(1)} C${(x1 + dx * .31).toFixed(1)},${(y1 + dy * .31 + bend).toFixed(1)} ${(x1 + dx * .69).toFixed(1)},${(y1 + dy * .69 - bend).toFixed(1)} ${x2.toFixed(1)},${y2.toFixed(1)}`;\n }\n\n // Row one: long, finely pinnate feather weed.\n {\n const y = 76;\n const main = `M28,83 C105,70 176,81 252,74 C331,66 400,73 484,58`;\n layeredStroke(main, 3.5, .82);\n\n for (let x = 48, i = 0; x < 472; x += n(12, 18), i++) {\n const baseY = y + Math.sin(x * .045) * 4 - (x - 250) * .035;\n const side = i % 2 ? 1 : -1;\n const len = n(20, 43) * (0.72 + Math.sin((x - 30) / 450 * Math.PI) * .35);\n const tx = x + n(8, 19);\n const ty = baseY + side * len;\n const d = curve(x, baseY, tx, ty, side * n(-4, 5));\n layeredStroke(d, n(1.05, 1.8), n(.58, .86));\n\n const count = Math.floor(n(3, 6));\n for (let j = 1; j <= count; j++) {\n const t = j / (count + 1);\n const bx = x + (tx - x) * t;\n const by = baseY + (ty - baseY) * t;\n const smallSide = j % 2 ? -side : side;\n const sl = n(5, 11);\n layeredStroke(\n curve(bx, by, bx + n(3, 8), by + smallSide * sl, smallSide * 1.5),\n .55, n(.4, .68)\n );\n }\n }\n pathEl(\"M27,83 C17,84 13,88 9,93\", {\n fill: \"none\", stroke: \"#d8eee2\", \"stroke-width\": \"4\",\n \"stroke-linecap\": \"round\", opacity: \".62\"\n });\n }\n\n // Row two: broad forked ribbons with translucent, curled margins.\n {\n const branches = [\n \"M31,199 C91,191 145,205 205,192 C269,179 334,194 390,178 C430,167 458,168 487,156\",\n \"M110,196 C127,178 139,157 148,135 C153,123 163,118 176,113\",\n \"M151,196 C171,211 186,224 207,230 C224,235 237,232 251,223\",\n \"M229,189 C243,166 255,148 277,134 C290,126 303,121 319,118\",\n \"M286,188 C307,207 330,219 355,223 C374,226 389,222 406,212\",\n \"M366,183 C383,158 398,141 421,132 C435,126 449,126 464,128\"\n ];\n for (const d of branches) layeredStroke(d, n(5.5, 8.2), .7);\n\n const blades = [\n \"M54,196 C78,185 98,181 119,187 C100,192 79,203 55,205 Z\",\n \"M132,183 C137,159 145,136 164,119 C161,143 154,168 143,190 Z\",\n \"M178,202 C198,211 222,220 244,221 C226,234 200,226 174,211 Z\",\n \"M247,185 C258,159 279,137 307,123 C293,147 275,173 257,190 Z\",\n \"M306,194 C330,204 356,214 391,213 C368,229 335,219 301,203 Z\",\n \"M380,176 C399,147 425,132 457,131 C430,143 410,161 393,183 Z\",\n \"M427,169 C447,157 466,153 487,156 C471,169 450,177 430,178 Z\"\n ];\n for (const d of blades) {\n pathEl(d, {\n fill: \"#b8e0dc\", opacity: n(.28, .46),\n stroke: \"#e8f5e8\", \"stroke-width\": n(1.5, 2.6),\n \"stroke-linejoin\": \"round\", filter: \"url(#mottle)\"\n });\n pathEl(d, {\n fill: \"none\", stroke: \"#eff7e8\", \"stroke-width\": \"5\",\n opacity: \".13\", filter: \"url(#softEdge)\"\n });\n }\n for (const [x, y, r] of [[104,190,5], [204,192,4], [331,188,5.5], [395,176,4.5]]) {\n const e = document.createElementNS(NS, \"ellipse\");\n e.setAttribute(\"cx\", x); e.setAttribute(\"cy\", y);\n e.setAttribute(\"rx\", r * 1.5); e.setAttribute(\"ry\", r);\n e.setAttribute(\"fill\", \"#cce9df\"); e.setAttribute(\"opacity\", \".5\");\n e.setAttribute(\"stroke\", \"#edf7e8\"); e.setAttribute(\"stroke-width\", \"1.4\");\n specimens.appendChild(e);\n }\n }\n\n // Row three: delicate repeatedly forked filamentous specimen.\n {\n layeredStroke(\"M25,321 C105,314 173,320 250,309 C325,299 402,306 486,292\", 2.7, .78);\n\n function twig(x, y, angle, len, depth, width) {\n if (depth < 0 || len < 3) return;\n const x2 = x + Math.cos(angle) * len;\n const y2 = y + Math.sin(angle) * len;\n layeredStroke(curve(x, y, x2, y2, n(-2.5, 2.5)), width, .48 + depth * .07);\n if (depth) {\n const split = n(.54, .74);\n const bx = x + (x2 - x) * split;\n const by = y + (y2 - y) * split;\n twig(bx, by, angle + n(.34, .68), len * n(.48, .68), depth - 1, width * .68);\n twig(x2, y2, angle - n(.25, .59), len * n(.45, .64), depth - 1, width * .64);\n if (rnd() > .48) twig(bx, by, angle - n(.38, .62), len * .45, depth - 1, width * .58);\n }\n }\n\n for (let x = 43, i = 0; x < 480; x += n(20, 30), i++) {\n const y = 318 - (x - 40) * .061 + Math.sin(x * .04) * 3;\n const ang = i % 2 ? n(.75, 1.16) : n(-1.15, -.72);\n twig(x, y, ang, n(18, 33), 3, n(.75, 1.2));\n }\n }\n\n // Row four: fern-like flattened specimen, dense tapering pinnae.\n {\n const y = 430;\n layeredStroke(\"M24,448 C101,440 176,433 251,427 C331,420 404,408 489,390\", 4.3, .84);\n\n for (let x = 44, i = 0; x < 480; x += n(10, 14), i++) {\n const baseY = 447 - (x - 24) * .126 + Math.sin(x * .025) * 2.2;\n const side = i % 2 ? -1 : 1;\n const envelope = Math.sin((x - 25) / 465 * Math.PI);\n const len = n(13, 27) + envelope * n(14, 27);\n const lean = n(8, 19);\n const tx = x + lean;\n const ty = baseY + side * len;\n layeredStroke(curve(x, baseY, tx, ty, side * n(-2, 4)), n(1.25, 2.1), .72);\n\n const leafCount = Math.floor(n(3, 6));\n for (let j = 1; j <= leafCount; j++) {\n const t = j / (leafCount + 1);\n const bx = x + (tx - x) * t;\n const by = baseY + (ty - baseY) * t;\n const l = n(4.5, 9) * (1 - t * .35);\n const flip = j % 2 ? 1 : -1;\n const ex = bx + l;\n const ey = by + flip * side * l * .48;\n const d = `M${bx},${by} Q${(bx + ex) / 2},${by + flip * side * l} ${ex},${ey}`;\n layeredStroke(d, .65, .58);\n }\n }\n\n // Holdfast and root-like attachment.\n layeredStroke(\"M25,448 C18,451 15,457 10,463 M25,448 C17,446 12,447 6,449 M25,448 C19,454 20,461 18,468\", 1.6, .67);\n }\n\n // Fine exposure specks and scratches in the blue paper.\n for (let i = 0; i < 170; i++) {\n const c = document.createElementNS(NS, \"circle\");\n c.setAttribute(\"cx\", n(4, 508));\n c.setAttribute(\"cy\", n(4, 508));\n c.setAttribute(\"r\", n(.15, .8));\n c.setAttribute(\"fill\", rnd() > .25 ? \"#9bcbd2\" : \"#001e4a\");\n c.setAttribute(\"opacity\", n(.035, .18));\n surface.appendChild(c);\n }\n for (let i = 0; i < 15; i++) {\n pathEl(\n `M${n(0, 512)},${n(0, 512)} l${n(-12, 15)},${n(-1, 1)}`,\n {\n fill: \"none\", stroke: \"#b9d9d7\", \"stroke-width\": n(.25, .65),\n opacity: n(.04, .12), \"stroke-linecap\": \"round\"\n },\n surface\n );\n }\n\n await new Promise(requestAnimationFrame);\n}"}], "metadata": {"id": "val-v1-broad-v2-style-validation-003", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 5274, "code_sha256": "e49e5de667f79b2771559a9079c533fb320f6a9019afd16f07b519725970f709"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "Cyanotype botanical study of three iris stems rising vertically, each with a ruffled flower, sword-shaped leaves, and sharply defined pale contours."}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n background: \"#063f72\"\n });\n\n const ns = \"http://www.w3.org/2000/svg\";\n const svg = document.createElementNS(ns, \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 512 512\");\n svg.setAttribute(\"width\", \"512\");\n svg.setAttribute(\"height\", \"512\");\n svg.setAttribute(\"role\", \"img\");\n svg.setAttribute(\"aria-label\", \"Cyanotype botanical study of three flowering iris stems\");\n\n let grain = \"\";\n let seed = 38177;\n const rand = () => {\n seed = (seed * 16807) % 2147483647;\n return (seed - 1) / 2147483646;\n };\n for (let i = 0; i < 330; i++) {\n const x = (rand() * 512).toFixed(1);\n const y = (rand() * 512).toFixed(1);\n const r = (0.18 + rand() * 0.8).toFixed(2);\n const o = (0.025 + rand() * 0.09).toFixed(3);\n grain += ``;\n }\n\n svg.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n ${grain}\n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n\n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n `;\n\n stage.appendChild(svg);\n}"}], "metadata": {"id": "val-v1-broad-v2-style-validation-007", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 7486, "code_sha256": "1e9943a4c80f0bb80e6d8abd6ded740944b77b1e5d7edfa23a2565d78856583e"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "Cyanotype botanical study featuring a dandelion rosette with jagged leaves, one round seed head, and several drifting parachute seeds."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n position: \"relative\",\n overflow: \"hidden\",\n width: \"512px\",\n height: \"512px\",\n background: \"#063c72\"\n });\n\n const dpr = 2;\n const canvas = document.createElement(\"canvas\");\n canvas.width = 512 * dpr;\n canvas.height = 512 * dpr;\n Object.assign(canvas.style, {\n width: \"512px\",\n height: \"512px\",\n display: \"block\"\n });\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const W = canvas.width, H = canvas.height;\n\n let seed = 193741;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n\n // Granular, uneven Prussian-blue sensitized paper.\n const image = ctx.createImageData(W, H);\n const data = image.data;\n for (let y = 0; y < H; y++) {\n const ly = y / dpr;\n for (let x = 0; x < W; x++) {\n const lx = x / dpr;\n const dx = (lx - 256) / 360;\n const dy = (ly - 250) / 360;\n const vignette = Math.min(1, Math.sqrt(dx * dx + dy * dy));\n const cloud =\n 5 * Math.sin(lx * 0.018 + Math.sin(ly * 0.012)) +\n 3 * Math.sin(ly * 0.031 - lx * 0.007) +\n 2 * Math.sin((lx + ly) * 0.053);\n const grain = (rnd() + rnd() + rnd() - 1.5) * 7;\n const edge = 13 * Math.pow(vignette, 2.2);\n const i = (y * W + x) * 4;\n data[i] = Math.max(2, 7 + cloud * 0.12 + grain * 0.18 - edge * 0.28);\n data[i + 1] = Math.max(23, 61 + cloud * 0.58 + grain * 0.7 - edge);\n data[i + 2] = Math.max(48, 112 + cloud + grain - edge * 1.45);\n data[i + 3] = 255;\n }\n }\n ctx.putImageData(image, 0, 0);\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n // Broad paper mottling.\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n for (let i = 0; i < 40; i++) {\n const x = rnd() * 512, y = rnd() * 512;\n const r = 25 + rnd() * 100;\n const g = ctx.createRadialGradient(x, y, 0, x, y, r);\n g.addColorStop(0, `rgba(25,130,168,${0.008 + rnd() * 0.018})`);\n g.addColorStop(1, \"rgba(10,90,140,0)\");\n ctx.fillStyle = g;\n ctx.beginPath();\n ctx.arc(x, y, r, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n // Slightly imperfect coated-paper perimeter.\n ctx.save();\n const edgeGrad = ctx.createLinearGradient(0, 0, 18, 0);\n edgeGrad.addColorStop(0, \"rgba(1,24,58,.32)\");\n edgeGrad.addColorStop(1, \"rgba(1,24,58,0)\");\n ctx.fillStyle = edgeGrad;\n ctx.fillRect(0, 0, 22, 512);\n ctx.translate(512, 0);\n ctx.scale(-1, 1);\n ctx.fillRect(0, 0, 18, 512);\n ctx.restore();\n\n const exposed = \"#d8f3ec\";\n const pale = \"#bde9e5\";\n const blueShadow = \"#196c9d\";\n\n function bezier(p0, p1, p2, p3, t) {\n const u = 1 - t;\n return {\n x: u * u * u * p0.x + 3 * u * u * t * p1.x + 3 * u * t * t * p2.x + t * t * t * p3.x,\n y: u * u * u * p0.y + 3 * u * u * t * p1.y + 3 * u * t * t * p2.y + t * t * t * p3.y\n };\n }\n\n function leaf(base, tip, bend, maxWidth, opacity, phase) {\n const p0 = base;\n const p1 = {\n x: base.x + (tip.x - base.x) * 0.24 + bend.x,\n y: base.y + (tip.y - base.y) * 0.24 + bend.y\n };\n const p2 = {\n x: base.x + (tip.x - base.x) * 0.72 + bend.x * 0.62,\n y: base.y + (tip.y - base.y) * 0.72 + bend.y * 0.62\n };\n const p3 = tip;\n const n = 30;\n const centers = [];\n const left = [], right = [];\n\n for (let i = 0; i <= n; i++) {\n const t = i / n;\n const c = bezier(p0, p1, p2, p3, t);\n const t0 = Math.max(0, t - 0.005), t1 = Math.min(1, t + 0.005);\n const a = bezier(p0, p1, p2, p3, t0);\n const b = bezier(p0, p1, p2, p3, t1);\n const len = Math.hypot(b.x - a.x, b.y - a.y) || 1;\n const nx = -(b.y - a.y) / len, ny = (b.x - a.x) / len;\n\n const envelope = Math.pow(Math.sin(Math.PI * t), 0.7);\n const tooth = i === 0 || i === n\n ? 0\n : ((i + phase) % 4 === 0 ? 1.16 :\n (i + phase) % 4 === 2 ? 0.72 : 0.34);\n const basal = t < 0.14 ? t / 0.14 : 1;\n const width = maxWidth * envelope * tooth * basal *\n (0.95 + 0.08 * Math.sin(i * 2.31 + phase));\n centers.push(c);\n left.push({ x: c.x + nx * width, y: c.y + ny * width });\n right.push({ x: c.x - nx * width * 0.92, y: c.y - ny * width * 0.92 });\n }\n\n const path = new Path2D();\n path.moveTo(left[0].x, left[0].y);\n for (let i = 1; i <= n; i++) path.lineTo(left[i].x, left[i].y);\n for (let i = n; i >= 0; i--) path.lineTo(right[i].x, right[i].y);\n path.closePath();\n\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n ctx.shadowColor = \"rgba(144,230,232,.28)\";\n ctx.shadowBlur = 7;\n ctx.fillStyle = `rgba(197,239,233,${opacity})`;\n ctx.fill(path);\n ctx.shadowBlur = 0;\n\n ctx.clip(path);\n const grad = ctx.createLinearGradient(base.x, base.y, tip.x, tip.y);\n grad.addColorStop(0, \"rgba(239,255,248,.28)\");\n grad.addColorStop(.48, \"rgba(186,230,227,.12)\");\n grad.addColorStop(1, \"rgba(244,255,249,.42)\");\n ctx.fillStyle = grad;\n ctx.fillRect(0, 250, 512, 230);\n\n // Cyanotype's incomplete contact patches.\n ctx.globalCompositeOperation = \"source-over\";\n for (let j = 0; j < 8; j++) {\n const t = 0.18 + rnd() * 0.7;\n const c = bezier(p0, p1, p2, p3, t);\n ctx.fillStyle = `rgba(13,83,129,${0.025 + rnd() * 0.045})`;\n ctx.beginPath();\n ctx.ellipse(c.x + (rnd() - .5) * maxWidth, c.y + (rnd() - .5) * maxWidth,\n 3 + rnd() * 9, 1.5 + rnd() * 4, rnd() * Math.PI, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n // Midrib and branching veins.\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n ctx.strokeStyle = \"rgba(234,255,248,.58)\";\n ctx.lineCap = \"round\";\n ctx.lineWidth = 1.15;\n ctx.beginPath();\n ctx.moveTo(centers[0].x, centers[0].y);\n for (let i = 1; i <= n; i++) ctx.lineTo(centers[i].x, centers[i].y);\n ctx.stroke();\n\n ctx.strokeStyle = \"rgba(229,252,246,.28)\";\n ctx.lineWidth = .65;\n for (let i = 5; i < n - 3; i += 3) {\n const c = centers[i];\n ctx.beginPath();\n ctx.moveTo(c.x, c.y);\n ctx.lineTo(left[i].x, left[i].y);\n ctx.moveTo(c.x, c.y);\n ctx.lineTo(right[i].x, right[i].y);\n ctx.stroke();\n }\n ctx.restore();\n }\n\n // Leaves at the back of the rosette.\n leaf({x:253,y:444}, {x:73,y:454}, {x:-15,y:-28}, 18, .78, 0);\n leaf({x:257,y:441}, {x:89,y:403}, {x:-10,y:-45}, 22, .84, 1);\n leaf({x:258,y:440}, {x:117,y:347}, {x:-10,y:-38}, 21, .82, 2);\n leaf({x:259,y:441}, {x:190,y:303}, {x:-17,y:-27}, 20, .87, 0);\n leaf({x:259,y:441}, {x:238,y:321}, {x:-15,y:-14}, 17, .72, 3);\n leaf({x:260,y:442}, {x:295,y:326}, {x:11,y:-20}, 18, .77, 1);\n leaf({x:260,y:443}, {x:373,y:349}, {x:17,y:-27}, 23, .86, 2);\n leaf({x:260,y:445}, {x:440,y:390}, {x:18,y:-35}, 22, .82, 0);\n leaf({x:259,y:447}, {x:459,y:451}, {x:15,y:-15}, 18, .75, 3);\n leaf({x:256,y:445}, {x:185,y:478}, {x:-7,y:5}, 16, .67, 2);\n leaf({x:260,y:445}, {x:343,y:481}, {x:10,y:4}, 17, .66, 1);\n\n // Crown at the center of the rosette.\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n ctx.fillStyle = \"rgba(224,249,241,.82)\";\n ctx.shadowColor = \"rgba(185,244,241,.3)\";\n ctx.shadowBlur = 5;\n ctx.beginPath();\n ctx.ellipse(259, 442, 15, 9, -.1, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n\n // Hollow, slightly curved dandelion stalk.\n const stem = new Path2D();\n stem.moveTo(261, 440);\n stem.bezierCurveTo(268, 347, 297, 245, 331, 158);\n\n ctx.save();\n ctx.lineCap = \"round\";\n ctx.strokeStyle = \"rgba(70,174,190,.2)\";\n ctx.lineWidth = 9;\n ctx.stroke(stem);\n ctx.globalCompositeOperation = \"screen\";\n ctx.shadowColor = \"rgba(195,247,241,.35)\";\n ctx.shadowBlur = 5;\n ctx.strokeStyle = \"rgba(211,244,237,.88)\";\n ctx.lineWidth = 4.2;\n ctx.stroke(stem);\n ctx.shadowBlur = 0;\n ctx.strokeStyle = \"rgba(247,255,248,.42)\";\n ctx.lineWidth = 1;\n ctx.stroke(stem);\n ctx.restore();\n\n // Seed head: a dense radial structure with fine pappus filaments.\n const hx = 333, hy = 150;\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n ctx.shadowColor = \"rgba(191,247,245,.42)\";\n ctx.shadowBlur = 4;\n ctx.lineCap = \"round\";\n\n for (let i = 0; i < 132; i++) {\n const a = i * Math.PI * 2 / 132 + (rnd() - .5) * .035;\n const inner = 4 + rnd() * 8;\n const radius = 43 + rnd() * 13;\n const curve = (rnd() - .5) * 5;\n const x0 = hx + Math.cos(a) * inner;\n const y0 = hy + Math.sin(a) * inner;\n const x1 = hx + Math.cos(a) * radius;\n const y1 = hy + Math.sin(a) * radius;\n const mx = (x0 + x1) / 2 - Math.sin(a) * curve;\n const my = (y0 + y1) / 2 + Math.cos(a) * curve;\n\n ctx.strokeStyle = `rgba(221,250,245,${0.20 + rnd() * .35})`;\n ctx.lineWidth = .45 + rnd() * .5;\n ctx.beginPath();\n ctx.moveTo(x0, y0);\n ctx.quadraticCurveTo(mx, my, x1, y1);\n ctx.stroke();\n\n if (i % 2 === 0) {\n ctx.fillStyle = `rgba(237,255,249,${.25 + rnd() * .38})`;\n ctx.beginPath();\n ctx.arc(x1, y1, .45 + rnd() * .7, 0, Math.PI * 2);\n ctx.fill();\n }\n }\n\n // Tangled outer pappus hairs.\n ctx.shadowBlur = 0;\n for (let i = 0; i < 90; i++) {\n const a = rnd() * Math.PI * 2;\n const r = 40 + rnd() * 13;\n const x = hx + Math.cos(a) * r;\n const y = hy + Math.sin(a) * r;\n const spread = .09 + rnd() * .08;\n ctx.strokeStyle = `rgba(229,253,248,${.13 + rnd() * .2})`;\n ctx.lineWidth = .5;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.lineTo(x + Math.cos(a + spread) * (5 + rnd() * 5),\n y + Math.sin(a + spread) * (5 + rnd() * 5));\n ctx.moveTo(x, y);\n ctx.lineTo(x + Math.cos(a - spread) * (5 + rnd() * 5),\n y + Math.sin(a - spread) * (5 + rnd() * 5));\n ctx.stroke();\n }\n\n const core = ctx.createRadialGradient(hx, hy, 0, hx, hy, 14);\n core.addColorStop(0, \"rgba(238,255,247,.84)\");\n core.addColorStop(.45, \"rgba(189,232,226,.54)\");\n core.addColorStop(1, \"rgba(172,225,224,0)\");\n ctx.fillStyle = core;\n ctx.beginPath();\n ctx.arc(hx, hy, 15, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n\n function floatingSeed(x, y, scale, angle, opacity = 1) {\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(angle);\n ctx.scale(scale, scale);\n ctx.globalCompositeOperation = \"screen\";\n ctx.lineCap = \"round\";\n ctx.strokeStyle = `rgba(224,252,247,${.58 * opacity})`;\n ctx.fillStyle = `rgba(222,248,241,${.74 * opacity})`;\n\n // Achene.\n ctx.beginPath();\n ctx.moveTo(-1.5, 18);\n ctx.quadraticCurveTo(0, 25, 1.5, 18);\n ctx.lineTo(.65, 14);\n ctx.quadraticCurveTo(0, 12.5, -.65, 14);\n ctx.closePath();\n ctx.fill();\n\n // Beak.\n ctx.lineWidth = .7;\n ctx.beginPath();\n ctx.moveTo(0, 14);\n ctx.quadraticCurveTo(1, 4, 0, -4);\n ctx.stroke();\n\n // Parachute spokes.\n const count = 18;\n for (let i = 0; i < count; i++) {\n const a = Math.PI + (i / (count - 1) - .5) * 2.35;\n const len = 9 + rnd() * 4;\n ctx.strokeStyle = `rgba(230,255,249,${(.26 + rnd() * .4) * opacity})`;\n ctx.lineWidth = .42;\n ctx.beginPath();\n ctx.moveTo(0, -4);\n ctx.quadraticCurveTo(Math.cos(a) * len * .48, -5 + Math.sin(a) * len * .45,\n Math.cos(a) * len, -4 + Math.sin(a) * len);\n ctx.stroke();\n }\n ctx.fillStyle = `rgba(243,255,251,${.6 * opacity})`;\n ctx.beginPath();\n ctx.arc(0, -4, 1, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n }\n\n floatingSeed(186, 87, 1.08, -.38, .9);\n floatingSeed(242, 46, .78, .18, .72);\n floatingSeed(116, 159, .92, -.8, .84);\n floatingSeed(421, 77, .83, .6, .78);\n floatingSeed(438, 208, 1.03, .44, .91);\n floatingSeed(389, 261, .72, -.28, .65);\n floatingSeed(151, 242, .67, -.98, .62);\n floatingSeed(283, 96, .58, .15, .53);\n\n // A few detached, nearly invisible filaments around the head.\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n ctx.strokeStyle = \"rgba(225,252,247,.25)\";\n ctx.lineWidth = .55;\n for (let i = 0; i < 14; i++) {\n const x = 270 + rnd() * 145, y = 88 + rnd() * 130;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.quadraticCurveTo(x + (rnd() - .5) * 12, y + 5,\n x + (rnd() - .5) * 16, y + 12 + rnd() * 10);\n ctx.stroke();\n }\n ctx.restore();\n\n // Dust, pinholes, and processing marks.\n ctx.save();\n ctx.globalCompositeOperation = \"screen\";\n for (let i = 0; i < 170; i++) {\n const x = rnd() * 512, y = rnd() * 512;\n const r = rnd() < .94 ? .15 + rnd() * .55 : 1 + rnd() * 2;\n ctx.fillStyle = `rgba(176,228,230,${.025 + rnd() * .08})`;\n ctx.beginPath();\n ctx.arc(x, y, r, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n ctx.save();\n ctx.strokeStyle = \"rgba(1,31,68,.28)\";\n ctx.lineWidth = 1;\n ctx.strokeRect(.5, .5, 511, 511);\n ctx.restore();\n}"}], "metadata": {"id": "val-v1-broad-v2-style-validation-008", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 5716, "code_sha256": "09e74ce306529424c67526ac443ffa9aff8eb483c5a1c63e5785cdbba9498689"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A compact teal book-drop cabinet stands beneath a round wall clock, its front label clearly printed with \"Drop Books Here\"."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n position: \"relative\",\n background: \"#d8d5cc\"\n });\n\n stage.innerHTML = `\n \n `;\n}"}], "metadata": {"id": "val-v1-broad-v2-text_rendering-validation-000", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 4485, "code_sha256": "e8c4d3f3a4bd1ae6a182a045ba5f68530cb619868a3c8024d19faf7612fa7c3d"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A white laminate return counter near a library entrance features a red-edged label beside the opening that reads \"Return Items Here\"."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n position: \"relative\",\n overflow: \"hidden\",\n width: \"512px\",\n height: \"512px\",\n background: \"#d8d6d0\"\n });\n\n const svgNS = \"http://www.w3.org/2000/svg\";\n const svg = document.createElementNS(svgNS, \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 512 512\");\n svg.setAttribute(\"width\", \"512\");\n svg.setAttribute(\"height\", \"512\");\n svg.setAttribute(\"aria-label\", \"A white library return counter with a Return Items Here label\");\n svg.style.display = \"block\";\n\n svg.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n\n \n \n \n \n \n \n \n Return\n Items\n Here\n \n\n \n \n \n \n\n \n \n \n \n `;\n\n stage.appendChild(svg);\n}"}], "metadata": {"id": "val-v1-broad-v2-text_rendering-validation-001", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 4692, "code_sha256": "0a0a406983b7508ce7cd028caed83e3ed70278591eebac1505d4fb6d5c2dae54"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A black metal return slot embedded in a pale wood circulation desk has a small brass plate engraved \"Book Return\"."}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n position: \"relative\",\n overflow: \"hidden\",\n background: \"#d8c7a8\"\n });\n\n const canvas = document.createElement(\"canvas\");\n const scale = 2;\n canvas.width = 512 * scale;\n canvas.height = 512 * scale;\n Object.assign(canvas.style, {\n width: \"512px\",\n height: \"512px\",\n display: \"block\"\n });\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(scale, scale);\n\n function roundedRect(x, y, w, h, r) {\n const rr = Math.min(r, w / 2, h / 2);\n ctx.beginPath();\n ctx.moveTo(x + rr, y);\n ctx.lineTo(x + w - rr, y);\n ctx.quadraticCurveTo(x + w, y, x + w, y + rr);\n ctx.lineTo(x + w, y + h - rr);\n ctx.quadraticCurveTo(x + w, y + h, x + w - rr, y + h);\n ctx.lineTo(x + rr, y + h);\n ctx.quadraticCurveTo(x, y + h, x, y + h - rr);\n ctx.lineTo(x, y + rr);\n ctx.quadraticCurveTo(x, y, x + rr, y);\n ctx.closePath();\n }\n\n function mulberry32(seed) {\n return function () {\n let t = seed += 0x6D2B79F5;\n t = Math.imul(t ^ t >>> 15, t | 1);\n t ^= t + Math.imul(t ^ t >>> 7, t | 61);\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\n };\n }\n\n const random = mulberry32(934712);\n\n // Pale oak desk face.\n let wood = ctx.createLinearGradient(0, 0, 512, 512);\n wood.addColorStop(0, \"#e5d7bb\");\n wood.addColorStop(0.38, \"#dcccac\");\n wood.addColorStop(0.7, \"#e1d1b2\");\n wood.addColorStop(1, \"#cdbb99\");\n ctx.fillStyle = wood;\n ctx.fillRect(0, 0, 512, 512);\n\n // Countertop and its front edge.\n let top = ctx.createLinearGradient(0, 0, 0, 76);\n top.addColorStop(0, \"#eee4d0\");\n top.addColorStop(0.78, \"#dac8a8\");\n top.addColorStop(1, \"#bba787\");\n ctx.fillStyle = top;\n ctx.fillRect(0, 0, 512, 76);\n\n ctx.fillStyle = \"rgba(75,55,34,.20)\";\n ctx.fillRect(0, 75, 512, 3);\n ctx.fillStyle = \"rgba(255,255,255,.35)\";\n ctx.fillRect(0, 78, 512, 1);\n\n // Fine oak fibers.\n ctx.lineCap = \"round\";\n for (let i = 0; i < 180; i++) {\n const y = random() * 512;\n const x = random() * 500 - 20;\n const len = 25 + random() * 150;\n const amp = 0.4 + random() * 2.6;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.bezierCurveTo(\n x + len * .27, y + (random() - .5) * amp,\n x + len * .66, y + (random() - .5) * amp,\n x + len, y + (random() - .5) * amp\n );\n ctx.strokeStyle = random() > .45\n ? `rgba(112,82,46,${.018 + random() * .038})`\n : `rgba(255,250,229,${.025 + random() * .05})`;\n ctx.lineWidth = .3 + random() * .8;\n ctx.stroke();\n }\n\n // Broader irregular grain.\n for (let i = 0; i < 26; i++) {\n let y = 85 + random() * 410;\n let x = -40 + random() * 100;\n ctx.beginPath();\n ctx.moveTo(x, y);\n for (let j = 1; j <= 6; j++) {\n const nx = x + j * 100;\n const ny = y + Math.sin(j * 1.4 + i) * (1 + random() * 3);\n ctx.quadraticCurveTo(nx - 45, ny + (random() - .5) * 4, nx, ny);\n }\n ctx.strokeStyle = `rgba(112,79,40,${.018 + random() * .028})`;\n ctx.lineWidth = 1 + random() * 2.2;\n ctx.stroke();\n }\n\n // A few subtle wood pores.\n for (let i = 0; i < 70; i++) {\n const x = random() * 512;\n const y = 82 + random() * 425;\n ctx.beginPath();\n ctx.ellipse(x, y, 1 + random() * 4, .18 + random() * .35, 0, 0, Math.PI * 2);\n ctx.fillStyle = `rgba(73,50,25,${.025 + random() * .045})`;\n ctx.fill();\n }\n\n // Shadow around the return-slot assembly.\n ctx.save();\n ctx.shadowColor = \"rgba(43,29,15,.48)\";\n ctx.shadowBlur = 17;\n ctx.shadowOffsetY = 8;\n roundedRect(101, 135, 310, 156, 7);\n ctx.fillStyle = \"rgba(24,20,16,.55)\";\n ctx.fill();\n ctx.restore();\n\n // Outer black metal bezel.\n let bezel = ctx.createLinearGradient(100, 135, 411, 291);\n bezel.addColorStop(0, \"#3c3d3b\");\n bezel.addColorStop(.16, \"#171918\");\n bezel.addColorStop(.55, \"#252624\");\n bezel.addColorStop(.86, \"#101211\");\n bezel.addColorStop(1, \"#363735\");\n roundedRect(102, 135, 308, 151, 7);\n ctx.fillStyle = bezel;\n ctx.fill();\n\n // Thin highlighted outer edge.\n roundedRect(102.5, 135.5, 307, 150, 6.5);\n ctx.strokeStyle = \"rgba(255,255,245,.18)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n\n roundedRect(106, 139, 300, 143, 4);\n ctx.strokeStyle = \"rgba(0,0,0,.75)\";\n ctx.lineWidth = 2;\n ctx.stroke();\n\n // Subtle brushed texture on bezel.\n ctx.save();\n roundedRect(103, 136, 306, 149, 6);\n ctx.clip();\n for (let i = 0; i < 160; i++) {\n const y = 136 + random() * 149;\n const x = 104 + random() * 304;\n ctx.fillStyle = random() > .5\n ? `rgba(255,255,255,${random() * .025})`\n : `rgba(0,0,0,${random() * .055})`;\n ctx.fillRect(x, y, 10 + random() * 75, .25 + random() * .45);\n }\n ctx.restore();\n\n // Recess around the opening.\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.9)\";\n ctx.shadowBlur = 9;\n ctx.shadowOffsetY = 3;\n roundedRect(124, 162, 264, 92, 4);\n ctx.fillStyle = \"#080909\";\n ctx.fill();\n ctx.restore();\n\n let innerLip = ctx.createLinearGradient(0, 159, 0, 258);\n innerLip.addColorStop(0, \"#3d3f3c\");\n innerLip.addColorStop(.09, \"#111312\");\n innerLip.addColorStop(.86, \"#090a09\");\n innerLip.addColorStop(1, \"#454541\");\n roundedRect(121, 159, 270, 99, 4);\n ctx.fillStyle = innerLip;\n ctx.fill();\n\n roundedRect(127, 166, 258, 83, 2);\n let depth = ctx.createLinearGradient(0, 166, 0, 249);\n depth.addColorStop(0, \"#020303\");\n depth.addColorStop(.38, \"#090a09\");\n depth.addColorStop(.78, \"#10100f\");\n depth.addColorStop(1, \"#020202\");\n ctx.fillStyle = depth;\n ctx.fill();\n\n // Interior planes and nearly invisible depth.\n ctx.beginPath();\n ctx.moveTo(127, 166);\n ctx.lineTo(385, 166);\n ctx.lineTo(375, 181);\n ctx.lineTo(137, 181);\n ctx.closePath();\n ctx.fillStyle = \"rgba(53,55,52,.28)\";\n ctx.fill();\n\n ctx.beginPath();\n ctx.moveTo(127, 249);\n ctx.lineTo(385, 249);\n ctx.lineTo(375, 237);\n ctx.lineTo(137, 237);\n ctx.closePath();\n let lowerLip = ctx.createLinearGradient(0, 237, 0, 249);\n lowerLip.addColorStop(0, \"#080908\");\n lowerLip.addColorStop(1, \"#353633\");\n ctx.fillStyle = lowerLip;\n ctx.fill();\n\n ctx.fillStyle = \"rgba(255,255,255,.16)\";\n ctx.fillRect(132, 247, 248, 1);\n ctx.fillStyle = \"rgba(0,0,0,.8)\";\n ctx.fillRect(132, 249, 248, 2);\n\n // Bezel mounting screws.\n function screw(x, y) {\n const g = ctx.createRadialGradient(x - 1, y - 1, .3, x, y, 5);\n g.addColorStop(0, \"#777872\");\n g.addColorStop(.4, \"#323431\");\n g.addColorStop(1, \"#090a09\");\n ctx.beginPath();\n ctx.arc(x, y, 4.4, 0, Math.PI * 2);\n ctx.fillStyle = g;\n ctx.fill();\n ctx.beginPath();\n ctx.moveTo(x - 2.3, y + .7);\n ctx.lineTo(x + 2.3, y - .7);\n ctx.strokeStyle = \"rgba(0,0,0,.9)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(x - 2.1, y - .2);\n ctx.lineTo(x + 1.9, y - 1.3);\n ctx.strokeStyle = \"rgba(255,255,255,.2)\";\n ctx.lineWidth = .5;\n ctx.stroke();\n }\n screw(113, 147);\n screw(399, 147);\n screw(113, 274);\n screw(399, 274);\n\n // Brass label plate shadow.\n ctx.save();\n ctx.shadowColor = \"rgba(55,35,13,.45)\";\n ctx.shadowBlur = 8;\n ctx.shadowOffsetY = 4;\n roundedRect(177, 322, 158, 45, 2.5);\n ctx.fillStyle = \"#8d682a\";\n ctx.fill();\n ctx.restore();\n\n // Brass plate.\n let brass = ctx.createLinearGradient(177, 322, 335, 367);\n brass.addColorStop(0, \"#896222\");\n brass.addColorStop(.12, \"#d8b866\");\n brass.addColorStop(.35, \"#ae8537\");\n brass.addColorStop(.58, \"#e2c775\");\n brass.addColorStop(.82, \"#9a7028\");\n brass.addColorStop(1, \"#d1a94f\");\n roundedRect(177, 320, 158, 45, 2.5);\n ctx.fillStyle = brass;\n ctx.fill();\n\n roundedRect(178, 321, 156, 43, 2);\n ctx.strokeStyle = \"rgba(255,244,177,.7)\";\n ctx.lineWidth = .8;\n ctx.stroke();\n\n roundedRect(180, 323, 152, 39, 1);\n ctx.strokeStyle = \"rgba(75,45,10,.45)\";\n ctx.lineWidth = .7;\n ctx.stroke();\n\n // Fine horizontal scratches in brass.\n ctx.save();\n roundedRect(178, 321, 156, 43, 2);\n ctx.clip();\n for (let i = 0; i < 45; i++) {\n const y = 322 + random() * 41;\n const x = 181 + random() * 145;\n ctx.fillStyle = random() > .45\n ? `rgba(255,247,180,${.04 + random() * .1})`\n : `rgba(78,48,9,${.03 + random() * .08})`;\n ctx.fillRect(x, y, 6 + random() * 65, .25);\n }\n ctx.restore();\n\n // Brass screw heads.\n function brassScrew(x, y) {\n const g = ctx.createRadialGradient(x - 1, y - 1, 0, x, y, 3.4);\n g.addColorStop(0, \"#f6db82\");\n g.addColorStop(.5, \"#aa7c29\");\n g.addColorStop(1, \"#5c3b10\");\n ctx.beginPath();\n ctx.arc(x, y, 3.1, 0, Math.PI * 2);\n ctx.fillStyle = g;\n ctx.fill();\n ctx.beginPath();\n ctx.moveTo(x - 1.8, y);\n ctx.lineTo(x + 1.8, y);\n ctx.strokeStyle = \"rgba(65,38,8,.8)\";\n ctx.lineWidth = .65;\n ctx.stroke();\n }\n brassScrew(187, 342.5);\n brassScrew(325, 342.5);\n\n // Engraved text: dark cut with a faint lower highlight.\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.font = '600 18px Georgia, \"Times New Roman\", serif';\n ctx.fillStyle = \"rgba(255,236,154,.42)\";\n ctx.fillText(\"Book Return\", 256, 344.2);\n ctx.fillStyle = \"#3d2810\";\n ctx.fillText(\"Book Return\", 256, 342.9);\n\n // Mild photographic noise.\n const noiseCanvas = document.createElement(\"canvas\");\n noiseCanvas.width = 512;\n noiseCanvas.height = 512;\n const nctx = noiseCanvas.getContext(\"2d\");\n const image = nctx.createImageData(512, 512);\n for (let i = 0; i < image.data.length; i += 4) {\n const v = random() * 255;\n image.data[i] = v;\n image.data[i + 1] = v;\n image.data[i + 2] = v;\n image.data[i + 3] = 7;\n }\n nctx.putImageData(image, 0, 0);\n ctx.save();\n ctx.globalCompositeOperation = \"soft-light\";\n ctx.globalAlpha = .45;\n ctx.drawImage(noiseCanvas, 0, 0);\n ctx.restore();\n\n // Gentle edge falloff.\n const vignette = ctx.createRadialGradient(256, 246, 120, 256, 256, 370);\n vignette.addColorStop(0, \"rgba(0,0,0,0)\");\n vignette.addColorStop(.72, \"rgba(40,25,10,.025)\");\n vignette.addColorStop(1, \"rgba(26,17,8,.18)\");\n ctx.fillStyle = vignette;\n ctx.fillRect(0, 0, 512, 512);\n}"}], "metadata": {"id": "val-v1-broad-v2-text_rendering-validation-003", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 4585, "code_sha256": "39445609efd41485e4ce2c681c317d788896e6f26beb9f565126e91c1eaf4c27"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A cream-colored library return box beside a staircase carries a simple black vinyl label reading \"Deposit Books Here\"."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = `\n \n `;\n\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n background: \"#ddd6c6\"\n });\n}"}], "metadata": {"id": "val-v1-broad-v2-text_rendering-validation-007", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 4352, "code_sha256": "2a91cecae7588c3c955ddd256bbb222c67b32b3adc4d7c2703bf9be53d7e6317"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A blue rolling return bin parked near an information desk has a laminated silver card marked \"Returned Books\"."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n position: \"relative\",\n overflow: \"hidden\",\n width: \"512px\",\n height: \"512px\",\n background: \"#d5d7d5\"\n });\n\n const canvas = document.createElement(\"canvas\");\n canvas.width = 1024;\n canvas.height = 1024;\n Object.assign(canvas.style, {\n width: \"512px\",\n height: \"512px\",\n display: \"block\"\n });\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(2, 2);\n\n const W = 512, H = 512;\n\n function rr(x, y, w, h, r) {\n r = Math.min(r, w / 2, h / 2);\n ctx.beginPath();\n ctx.moveTo(x + r, y);\n ctx.lineTo(x + w - r, y);\n ctx.quadraticCurveTo(x + w, y, x + w, y + r);\n ctx.lineTo(x + w, y + h - r);\n ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);\n ctx.lineTo(x + r, y + h);\n ctx.quadraticCurveTo(x, y + h, x, y + h - r);\n ctx.lineTo(x, y + r);\n ctx.quadraticCurveTo(x, y, x + r, y);\n ctx.closePath();\n }\n\n function poly(points) {\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 1; i < points.length; i++) ctx.lineTo(points[i][0], points[i][1]);\n ctx.closePath();\n }\n\n function line(x1, y1, x2, y2, color, width = 1) {\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.strokeStyle = color;\n ctx.lineWidth = width;\n ctx.stroke();\n }\n\n // Back wall\n let g = ctx.createLinearGradient(0, 0, 0, 330);\n g.addColorStop(0, \"#eef0ed\");\n g.addColorStop(0.58, \"#dfe3e0\");\n g.addColorStop(1, \"#c8cecb\");\n ctx.fillStyle = g;\n ctx.fillRect(0, 0, W, 340);\n\n // Ceiling strip and fluorescent lights\n ctx.fillStyle = \"#f8f8f4\";\n ctx.fillRect(0, 0, W, 25);\n ctx.fillStyle = \"rgba(255,255,246,.95)\";\n ctx.shadowColor = \"rgba(255,255,255,.8)\";\n ctx.shadowBlur = 12;\n ctx.fillRect(49, 6, 151, 7);\n ctx.fillRect(323, 6, 118, 7);\n ctx.shadowBlur = 0;\n\n // Distant glass doorway / windows\n g = ctx.createLinearGradient(0, 48, 0, 260);\n g.addColorStop(0, \"#c9d8dd\");\n g.addColorStop(1, \"#9facad\");\n ctx.fillStyle = g;\n ctx.fillRect(21, 52, 185, 210);\n ctx.fillStyle = \"#edf1ef\";\n ctx.fillRect(26, 57, 5, 205);\n ctx.fillRect(102, 57, 6, 205);\n ctx.fillRect(198, 57, 6, 205);\n ctx.fillRect(21, 127, 185, 5);\n ctx.fillStyle = \"rgba(234,246,247,.38)\";\n ctx.fillRect(32, 59, 69, 66);\n ctx.fillRect(109, 59, 87, 66);\n\n // Diffuse shapes behind glass\n ctx.fillStyle = \"rgba(87,110,104,.2)\";\n ctx.fillRect(40, 146, 48, 83);\n ctx.fillRect(120, 153, 60, 76);\n ctx.fillStyle = \"rgba(255,255,255,.22)\";\n poly([[32,61],[76,61],[151,125],[109,125]]);\n ctx.fill();\n\n // Information wall sign\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.18)\";\n ctx.shadowBlur = 4;\n ctx.shadowOffsetY = 2;\n rr(300, 51, 172, 44, 3);\n ctx.fillStyle = \"#f4f2e9\";\n ctx.fill();\n ctx.restore();\n ctx.strokeStyle = \"#b5b8b5\";\n ctx.lineWidth = 1;\n rr(300, 51, 172, 44, 3);\n ctx.stroke();\n ctx.fillStyle = \"#3c5965\";\n ctx.font = \"600 17px Arial, sans-serif\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(\"INFORMATION\", 386, 73);\n ctx.fillStyle = \"#62808a\";\n ctx.beginPath();\n ctx.arc(319, 73, 11, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = \"#fff\";\n ctx.font = \"bold 16px Georgia\";\n ctx.fillText(\"i\", 319, 72);\n\n // Background bookcase\n ctx.fillStyle = \"#8a735b\";\n ctx.fillRect(221, 104, 70, 161);\n ctx.fillStyle = \"#473e35\";\n ctx.fillRect(227, 111, 58, 144);\n for (let y = 145; y < 255; y += 36) {\n ctx.fillStyle = \"#927a60\";\n ctx.fillRect(225, y, 62, 5);\n }\n const bookColors = [\"#8e4441\", \"#506f7a\", \"#c39b55\", \"#627458\", \"#aa7660\", \"#5d6881\"];\n let seed = 7;\n function rand() {\n seed = (seed * 9301 + 49297) % 233280;\n return seed / 233280;\n }\n for (let shelf = 0; shelf < 4; shelf++) {\n let bx = 230;\n const by = 143 + shelf * 36;\n while (bx < 282) {\n const bw = 3 + rand() * 5;\n const bh = 19 + rand() * 10;\n ctx.fillStyle = bookColors[Math.floor(rand() * bookColors.length)];\n ctx.fillRect(bx, by - bh, bw, bh);\n bx += bw + 1.5;\n }\n }\n\n // Baseboard\n ctx.fillStyle = \"#9fa5a2\";\n ctx.fillRect(0, 263, W, 9);\n ctx.fillStyle = \"#ecedeb\";\n ctx.fillRect(0, 263, W, 2);\n\n // Floor\n g = ctx.createLinearGradient(0, 270, 0, H);\n g.addColorStop(0, \"#c6c5bd\");\n g.addColorStop(1, \"#8e908b\");\n ctx.fillStyle = g;\n ctx.fillRect(0, 272, W, H - 272);\n\n // Floor tile seams\n ctx.strokeStyle = \"rgba(87,91,88,.18)\";\n ctx.lineWidth = 1;\n for (let y = 307; y < 512; y += 45) line(0, y, 512, y + 9, \"rgba(80,83,80,.15)\");\n line(89, 272, 35, 512, \"rgba(80,83,80,.15)\");\n line(246, 272, 237, 512, \"rgba(80,83,80,.15)\");\n line(402, 272, 456, 512, \"rgba(80,83,80,.15)\");\n\n // Information counter in the right background\n ctx.save();\n ctx.shadowColor = \"rgba(20,25,25,.22)\";\n ctx.shadowBlur = 12;\n ctx.shadowOffsetY = 7;\n poly([[340,182],[512,177],[512,364],[346,369]]);\n ctx.fillStyle = \"#766653\";\n ctx.fill();\n ctx.restore();\n\n // Counter front panels\n g = ctx.createLinearGradient(345, 210, 512, 360);\n g.addColorStop(0, \"#a68a69\");\n g.addColorStop(0.55, \"#92775b\");\n g.addColorStop(1, \"#715e4a\");\n poly([[345,207],[512,204],[512,363],[347,368]]);\n ctx.fillStyle = g;\n ctx.fill();\n line(402, 207, 403, 366, \"rgba(72,52,38,.4)\");\n line(465, 205, 466, 364, \"rgba(72,52,38,.4)\");\n line(348, 329, 512, 325, \"rgba(61,49,38,.34)\");\n\n // Countertop\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.25)\";\n ctx.shadowBlur = 7;\n ctx.shadowOffsetY = 4;\n poly([[328,184],[498,178],[512,190],[512,211],[342,216],[328,205]]);\n g = ctx.createLinearGradient(330, 180, 330, 217);\n g.addColorStop(0, \"#ede6da\");\n g.addColorStop(0.35, \"#c9bbaa\");\n g.addColorStop(1, \"#8c7e70\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.restore();\n line(342, 211, 512, 206, \"rgba(255,255,255,.35)\");\n\n // Desk monitor\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.22)\";\n ctx.shadowBlur = 5;\n rr(408, 117, 64, 55, 4);\n ctx.fillStyle = \"#3b4143\";\n ctx.fill();\n rr(413, 122, 54, 43, 2);\n g = ctx.createLinearGradient(413, 122, 467, 165);\n g.addColorStop(0, \"#c8dadd\");\n g.addColorStop(1, \"#6f8589\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.restore();\n ctx.fillStyle = \"#4d5050\";\n ctx.fillRect(437, 171, 7, 17);\n ctx.fillRect(424, 187, 33, 4);\n ctx.fillStyle = \"rgba(255,255,255,.28)\";\n poly([[416,125],[434,125],[463,160],[454,160]]);\n ctx.fill();\n\n // Desk lamp / small items\n ctx.fillStyle = \"#dedbd1\";\n rr(368, 171, 30, 12, 2);\n ctx.fill();\n ctx.fillStyle = \"#63767c\";\n ctx.fillRect(375, 159, 16, 13);\n ctx.fillStyle = \"#f0cf73\";\n ctx.fillRect(378, 161, 10, 7);\n\n // Broad bin floor shadow\n ctx.save();\n ctx.filter = \"blur(9px)\";\n ctx.fillStyle = \"rgba(20,26,28,.32)\";\n ctx.beginPath();\n ctx.ellipse(229, 442, 154, 28, -0.02, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n\n // Rear wheels\n function wheel(cx, cy, scale = 1) {\n ctx.save();\n ctx.translate(cx, cy);\n ctx.scale(scale, scale);\n ctx.fillStyle = \"#263036\";\n ctx.beginPath();\n ctx.ellipse(0, 0, 17, 21, 0, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = \"#101619\";\n ctx.beginPath();\n ctx.ellipse(0, 2, 10, 14, 0, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = \"#758087\";\n ctx.beginPath();\n ctx.arc(0, 1, 4, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n }\n ctx.fillStyle = \"#29373e\";\n ctx.fillRect(122, 409, 11, 22);\n ctx.fillRect(327, 408, 10, 22);\n wheel(126, 435, .8);\n wheel(329, 435, .8);\n\n // Main blue bin body, slightly tapered\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.3)\";\n ctx.shadowBlur = 7;\n ctx.shadowOffsetX = 3;\n ctx.shadowOffsetY = 5;\n poly([[101,204],[355,204],[340,418],[119,418]]);\n g = ctx.createLinearGradient(95, 210, 356, 412);\n g.addColorStop(0, \"#1f78ae\");\n g.addColorStop(0.22, \"#176a9e\");\n g.addColorStop(0.66, \"#115986\");\n g.addColorStop(1, \"#0a3e62\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.restore();\n\n // Left side volume\n poly([[101,204],[125,215],[136,414],[119,418]]);\n g = ctx.createLinearGradient(100, 200, 136, 410);\n g.addColorStop(0, \"#3690bf\");\n g.addColorStop(1, \"#0d4e74\");\n ctx.fillStyle = g;\n ctx.fill();\n\n // Right edge\n poly([[347,211],[355,204],[340,418],[329,414]]);\n ctx.fillStyle = \"#083c60\";\n ctx.fill();\n\n // Bin top sloping assembly\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.35)\";\n ctx.shadowBlur = 5;\n ctx.shadowOffsetY = 4;\n poly([[102,203],[143,150],[337,149],[356,204],[338,220],[120,220]]);\n g = ctx.createLinearGradient(180, 143, 265, 224);\n g.addColorStop(0, \"#318cbc\");\n g.addColorStop(0.48, \"#1473aa\");\n g.addColorStop(1, \"#0b4e79\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.restore();\n\n // Top highlights and molded rim\n line(144, 151, 337, 150, \"rgba(160,222,246,.65)\", 2);\n line(121, 217, 339, 217, \"rgba(3,39,61,.65)\", 5);\n line(123, 213, 341, 213, \"rgba(92,176,211,.5)\", 2);\n\n // Return slot\n ctx.save();\n poly([[151,166],[320,166],[335,195],[132,195]]);\n g = ctx.createLinearGradient(0, 166, 0, 198);\n g.addColorStop(0, \"#082f47\");\n g.addColorStop(1, \"#061a26\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.restore();\n line(151, 166, 320, 166, \"rgba(149,214,238,.45)\", 2);\n poly([[142,173],[317,173],[326,189],[137,189]]);\n ctx.fillStyle = \"#071d29\";\n ctx.fill();\n\n // A visible returned book just inside slot\n poly([[182,169],[269,169],[279,180],[174,180]]);\n ctx.fillStyle = \"#913f39\";\n ctx.fill();\n line(184, 171, 267, 171, \"rgba(255,203,172,.5)\", 1);\n ctx.fillStyle = \"#d7c6a2\";\n poly([[272,169],[277,171],[283,179],[278,180]]);\n ctx.fill();\n\n // Front panel inset seams\n ctx.strokeStyle = \"rgba(2,42,68,.55)\";\n ctx.lineWidth = 2;\n rr(132, 235, 196, 159, 8);\n ctx.stroke();\n ctx.strokeStyle = \"rgba(105,184,218,.18)\";\n ctx.lineWidth = 1;\n rr(135, 238, 190, 153, 7);\n ctx.stroke();\n\n // Molded vertical reflections\n g = ctx.createLinearGradient(124, 0, 181, 0);\n g.addColorStop(0, \"rgba(255,255,255,.03)\");\n g.addColorStop(.5, \"rgba(255,255,255,.16)\");\n g.addColorStop(1, \"rgba(255,255,255,0)\");\n ctx.fillStyle = g;\n poly([[126,223],[183,223],[175,404],[137,407]]);\n ctx.fill();\n g = ctx.createLinearGradient(278, 0, 331, 0);\n g.addColorStop(0, \"rgba(255,255,255,0)\");\n g.addColorStop(.6, \"rgba(126,204,235,.1)\");\n g.addColorStop(1, \"rgba(255,255,255,0)\");\n ctx.fillStyle = g;\n poly([[274,224],[328,222],[319,404],[281,404]]);\n ctx.fill();\n\n // Laminated silver card shadow\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.38)\";\n ctx.shadowBlur = 6;\n ctx.shadowOffsetY = 4;\n rr(162, 252, 140, 67, 4);\n ctx.fillStyle = \"#c7cccd\";\n ctx.fill();\n ctx.restore();\n\n // Metallic / laminated card\n rr(159, 249, 140, 67, 4);\n g = ctx.createLinearGradient(159, 249, 299, 316);\n g.addColorStop(0, \"#8f989b\");\n g.addColorStop(.16, \"#eef1f0\");\n g.addColorStop(.42, \"#bbc2c3\");\n g.addColorStop(.66, \"#f5f5f2\");\n g.addColorStop(1, \"#9ca4a5\");\n ctx.fillStyle = g;\n ctx.fill();\n ctx.strokeStyle = \"#687174\";\n ctx.lineWidth = 1.2;\n rr(159, 249, 140, 67, 4);\n ctx.stroke();\n\n // Inner card border\n rr(164, 254, 130, 57, 2);\n ctx.strokeStyle = \"rgba(70,78,80,.55)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n line(165, 255, 293, 255, \"rgba(255,255,255,.85)\", 1);\n\n // Laminate glare\n ctx.save();\n rr(159, 249, 140, 67, 4);\n ctx.clip();\n poly([[172,248],[211,248],[253,316],[216,316]]);\n ctx.fillStyle = \"rgba(255,255,255,.28)\";\n ctx.fill();\n poly([[273,248],[288,248],[299,267],[299,288]]);\n ctx.fillStyle = \"rgba(255,255,255,.2)\";\n ctx.fill();\n ctx.restore();\n\n // Card fasteners\n for (const [x, y] of [[166,256],[292,256],[166,309],[292,309]]) {\n ctx.fillStyle = \"#747d7e\";\n ctx.beginPath();\n ctx.arc(x, y, 1.5, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = \"rgba(255,255,255,.65)\";\n ctx.beginPath();\n ctx.arc(x - .4, y - .5, .45, 0, Math.PI * 2);\n ctx.fill();\n }\n\n // Card text\n ctx.fillStyle = \"#18282e\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.font = \"bold 17px Arial, Helvetica, sans-serif\";\n ctx.fillText(\"Returned Books\", 229, 283);\n ctx.font = \"9px Arial, Helvetica, sans-serif\";\n ctx.fillStyle = \"#465459\";\n ctx.fillText(\"LIBRARY MATERIALS\", 229, 301);\n\n // Bottom bumper\n poly([[117,400],[341,400],[340,419],[119,419]]);\n g = ctx.createLinearGradient(0, 400, 0, 420);\n g.addColorStop(0, \"#174e6c\");\n g.addColorStop(.4, \"#092f48\");\n g.addColorStop(1, \"#071f2e\");\n ctx.fillStyle = g;\n ctx.fill();\n line(122, 402, 336, 402, \"rgba(82,153,182,.35)\");\n\n // Front caster brackets and wheels\n function caster(x, y) {\n ctx.fillStyle = \"#6e777a\";\n poly([[x - 7,y - 13],[x + 8,y - 13],[x + 6,y + 3],[x - 5,y + 3]]);\n ctx.fill();\n ctx.fillStyle = \"#31393c\";\n ctx.fillRect(x - 4, y - 2, 8, 10);\n wheel(x, y + 13, .72);\n ctx.fillStyle = \"#a2aaab\";\n ctx.beginPath();\n ctx.arc(x, y - 9, 2.2, 0, Math.PI * 2);\n ctx.fill();\n }\n caster(151, 419);\n caster(309, 419);\n\n // Scuffs and realistic wear\n ctx.strokeStyle = \"rgba(197,229,237,.18)\";\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(145, 350);\n ctx.quadraticCurveTo(168, 345, 184, 353);\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(274, 368);\n ctx.lineTo(307, 363);\n ctx.stroke();\n ctx.strokeStyle = \"rgba(0,27,43,.25)\";\n ctx.beginPath();\n ctx.moveTo(196, 391);\n ctx.lineTo(238, 394);\n ctx.stroke();\n\n // Fine photographic grain\n const image = ctx.getImageData(0, 0, W * 2, H * 2);\n const d = image.data;\n let nseed = 12345;\n for (let i = 0; i < d.length; i += 4) {\n nseed = (nseed * 16807) % 2147483647;\n const noise = ((nseed / 2147483647) - .5) * 3.2;\n d[i] = Math.max(0, Math.min(255, d[i] + noise));\n d[i + 1] = Math.max(0, Math.min(255, d[i + 1] + noise));\n d[i + 2] = Math.max(0, Math.min(255, d[i + 2] + noise));\n }\n ctx.putImageData(image, 0, 0);\n\n await new Promise(resolve => requestAnimationFrame(resolve));\n}"}], "metadata": {"id": "val-v1-broad-v2-text_rendering-validation-009", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 6928, "code_sha256": "147c9642cf39c3dd3c488fefad30acc01b0235ef2dba2f6216b8b42c2c43fd2c"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A plant shows a tight white center, surrounded by large green leaves."}, {"role": "assistant", "content": "async function render(stage) {\n const uid = `plant_${Math.random().toString(36).slice(2)}`;\n let seed = 48271;\n const rand = () => {\n seed = (seed * 16807) % 2147483647;\n return (seed - 1) / 2147483646;\n };\n\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n position: \"relative\",\n background: \"#172318\"\n });\n\n const smoothPath = points => {\n let d = `M ${points[0][0].toFixed(1)} ${points[0][1].toFixed(1)}`;\n for (let i = 1; i < points.length - 1; i++) {\n const mx = (points[i][0] + points[i + 1][0]) / 2;\n const my = (points[i][1] + points[i + 1][1]) / 2;\n d += ` Q ${points[i][0].toFixed(1)} ${points[i][1].toFixed(1)} ${mx.toFixed(1)} ${my.toFixed(1)}`;\n }\n const last = points[points.length - 1];\n d += ` Q ${last[0].toFixed(1)} ${last[1].toFixed(1)} ${points[0][0].toFixed(1)} ${points[0][1].toFixed(1)} Z`;\n return d;\n };\n\n const makeLeaf = (o, index) => {\n const {\n angle, length, width, start = 8, gradient, opacity = 1,\n wave = 0.08, vein = \"#adc47d\", veinOpacity = .42,\n texture = .12, bend = 0\n } = o;\n\n const top = [];\n const bottom = [];\n const n = 13;\n for (let i = 0; i <= n; i++) {\n const t = i / n;\n const x = start + t * length;\n const body = Math.pow(Math.sin(Math.PI * t), .72);\n const taper = 0.84 + .16 * (1 - t);\n const ripple = 1 + wave * Math.sin(i * 3.45 + index * 1.73);\n const centerCurve = bend * Math.sin(Math.PI * t);\n const edge = width * body * taper * ripple;\n const pointNoise = (rand() - .5) * width * .025;\n top.push([x, centerCurve - edge + pointNoise]);\n bottom.push([x, centerCurve + edge - pointNoise]);\n }\n const points = [...top, ...bottom.reverse()];\n const d = smoothPath(points);\n const clip = `${uid}_clip_${index}`;\n\n let veins = `\n \n `;\n\n for (let i = 2; i <= 10; i++) {\n const t = i / 12;\n const x = start + length * t;\n const body = Math.pow(Math.sin(Math.PI * t), .72);\n const w = width * body * .84;\n const yy = bend * Math.sin(Math.PI * t);\n const dir = i % 2 ? -1 : 1;\n veins += `\n \n \n `;\n }\n\n return `\n \n \n \n \n \n \n \n ${veins}\n \n \n `;\n };\n\n let outerLeaves = \"\";\n const outerCount = 19;\n for (let i = 0; i < outerCount; i++) {\n const a = -98 + i * (360 / outerCount) + (rand() - .5) * 10;\n outerLeaves += makeLeaf({\n angle: a,\n length: 194 + rand() * 54,\n width: 48 + rand() * 20,\n start: 11 + rand() * 8,\n gradient: `${uid}_outer${i % 3}`,\n wave: .075 + rand() * .055,\n bend: (rand() - .5) * 22,\n vein: i % 3 === 0 ? \"#a8c66f\" : \"#789d55\",\n veinOpacity: .34 + rand() * .16,\n texture: .13 + rand() * .08\n }, i);\n }\n\n let middleLeaves = \"\";\n const middleCount = 17;\n for (let i = 0; i < middleCount; i++) {\n const a = -84 + i * (360 / middleCount) + (rand() - .5) * 11;\n middleLeaves += makeLeaf({\n angle: a,\n length: 129 + rand() * 48,\n width: 39 + rand() * 17,\n start: 7 + rand() * 9,\n gradient: `${uid}_mid${i % 3}`,\n wave: .06 + rand() * .055,\n bend: (rand() - .5) * 17,\n vein: \"#bed38b\",\n veinOpacity: .38 + rand() * .15,\n texture: .11 + rand() * .07\n }, 40 + i);\n }\n\n let innerLeaves = \"\";\n const innerCount = 15;\n for (let i = 0; i < innerCount; i++) {\n const a = -90 + i * (360 / innerCount) + (rand() - .5) * 13;\n innerLeaves += makeLeaf({\n angle: a,\n length: 73 + rand() * 34,\n width: 25 + rand() * 12,\n start: 2 + rand() * 7,\n gradient: `${uid}_inner${i % 3}`,\n wave: .045 + rand() * .04,\n bend: (rand() - .5) * 12,\n vein: \"#f0f0c9\",\n veinOpacity: .46,\n texture: .08\n }, 80 + i);\n }\n\n let core = \"\";\n for (let ring = 0; ring < 3; ring++) {\n const count = 11 - ring * 2;\n const radius = 29 - ring * 9;\n const length = 43 - ring * 10;\n for (let i = 0; i < count; i++) {\n const angle = i * 360 / count + ring * 19 + (rand() - .5) * 12;\n const pale = [\"#faf9e5\", \"#f1f2d5\", \"#fffdf0\", \"#e6e9c8\"][i % 4];\n core += `\n \n \n \n \n \n `;\n }\n }\n\n const svg = `\n \n `;\n\n stage.innerHTML = svg;\n}"}], "metadata": {"id": "val-v1-coco-train2017-000000071429-720051", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 4925, "code_sha256": "40c9f50ff28c1702cb69339be943f3a7045cfc8be6b2dd2d3796de70e580aa71"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A person gets ready to mount their bicycle."}, {"role": "assistant", "content": "async function render(stage) {\n stage.innerHTML = \"\";\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n position: \"relative\",\n background: \"#dbe5e3\"\n });\n\n const ns = \"http://www.w3.org/2000/svg\";\n const svg = document.createElementNS(ns, \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 512 512\");\n svg.setAttribute(\"width\", \"512\");\n svg.setAttribute(\"height\", \"512\");\n svg.setAttribute(\"role\", \"img\");\n svg.setAttribute(\"aria-label\", \"A cyclist preparing to mount a bicycle on a park path\");\n svg.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n \n \n \n \n \n \n\n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n\n \n \n \n\n \n \n \n \n \n\n \n \n \n\n \n \n \n \n \n \n\n \n \n \n\n \n \n \n \n \n `;\n stage.appendChild(svg);\n await new Promise(resolve => requestAnimationFrame(resolve));\n}"}], "metadata": {"id": "val-v1-coco-train2017-000000073437-684644", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 7271, "code_sha256": "0d1bf9584693ac1ee8f303ce99ac4e6da961021e30ed9f0a230be34cab5570f9"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "Many different clocks hang together on a wall."}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n position: \"relative\",\n width: \"512px\",\n height: \"512px\",\n overflow: \"hidden\",\n background: \"#bbb1a1\"\n });\n\n const canvas = document.createElement(\"canvas\");\n const dpr = 2;\n canvas.width = 512 * dpr;\n canvas.height = 512 * dpr;\n Object.assign(canvas.style, { width: \"512px\", height: \"512px\", display: \"block\" });\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(dpr, dpr);\n ctx.lineCap = \"round\";\n ctx.lineJoin = \"round\";\n\n let seed = 839175;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n\n function rr(x, y, w, h, r) {\n const q = Math.min(r, w / 2, h / 2);\n ctx.beginPath();\n ctx.moveTo(x + q, y);\n ctx.arcTo(x + w, y, x + w, y + h, q);\n ctx.arcTo(x + w, y + h, x, y + h, q);\n ctx.arcTo(x, y + h, x, y, q);\n ctx.arcTo(x, y, x + w, y, q);\n ctx.closePath();\n }\n\n function shadow(blur = 11, x = 3, y = 6, color = \"rgba(40,26,16,.38)\") {\n ctx.shadowColor = color;\n ctx.shadowBlur = blur;\n ctx.shadowOffsetX = x;\n ctx.shadowOffsetY = y;\n }\n\n function noShadow() {\n ctx.shadowColor = \"transparent\";\n ctx.shadowBlur = 0;\n ctx.shadowOffsetX = 0;\n ctx.shadowOffsetY = 0;\n }\n\n // A softly mottled plaster wall.\n const wall = ctx.createLinearGradient(0, 0, 512, 512);\n wall.addColorStop(0, \"#d8d0c1\");\n wall.addColorStop(.48, \"#c9c0b0\");\n wall.addColorStop(1, \"#aea596\");\n ctx.fillStyle = wall;\n ctx.fillRect(0, 0, 512, 512);\n\n for (let i = 0; i < 3200; i++) {\n const x = rnd() * 512, y = rnd() * 512;\n const a = .018 + rnd() * .035;\n ctx.fillStyle = rnd() > .48\n ? `rgba(255,255,245,${a})`\n : `rgba(76,62,48,${a})`;\n ctx.fillRect(x, y, .35 + rnd() * 1.5, .35 + rnd() * 1.5);\n }\n for (let i = 0; i < 26; i++) {\n const x = rnd() * 512, y = rnd() * 512, r = 8 + rnd() * 38;\n const g = ctx.createRadialGradient(x, y, 0, x, y, r);\n g.addColorStop(0, `rgba(105,90,71,${.015 + rnd() * .025})`);\n g.addColorStop(1, \"rgba(105,90,71,0)\");\n ctx.fillStyle = g;\n ctx.beginPath();\n ctx.arc(x, y, r, 0, Math.PI * 2);\n ctx.fill();\n }\n\n // Upper molding and lower diffuse shade anchor the wall spatially.\n ctx.fillStyle = \"rgba(88,70,51,.16)\";\n ctx.fillRect(0, 18, 512, 2);\n ctx.fillStyle = \"rgba(255,255,255,.22)\";\n ctx.fillRect(0, 20, 512, 1);\n const lowerShade = ctx.createLinearGradient(0, 420, 0, 512);\n lowerShade.addColorStop(0, \"rgba(52,38,27,0)\");\n lowerShade.addColorStop(1, \"rgba(52,38,27,.16)\");\n ctx.fillStyle = lowerShade;\n ctx.fillRect(0, 410, 512, 102);\n\n function hands(cx, cy, r, hour, minute, style = \"black\", second = null) {\n const ma = (minute / 60) * Math.PI * 2 - Math.PI / 2;\n const ha = ((hour % 12 + minute / 60) / 12) * Math.PI * 2 - Math.PI / 2;\n const handColor = style === \"brass\" ? \"#6b5122\" :\n style === \"white\" ? \"#eee9dc\" : \"#26221e\";\n\n ctx.strokeStyle = handColor;\n ctx.fillStyle = handColor;\n ctx.lineWidth = Math.max(1.5, r * .045);\n ctx.beginPath();\n ctx.moveTo(cx - Math.cos(ha) * r * .1, cy - Math.sin(ha) * r * .1);\n ctx.lineTo(cx + Math.cos(ha) * r * .53, cy + Math.sin(ha) * r * .53);\n ctx.stroke();\n\n ctx.lineWidth = Math.max(1, r * .028);\n ctx.beginPath();\n ctx.moveTo(cx - Math.cos(ma) * r * .12, cy - Math.sin(ma) * r * .12);\n ctx.lineTo(cx + Math.cos(ma) * r * .76, cy + Math.sin(ma) * r * .76);\n ctx.stroke();\n\n if (second !== null) {\n const sa = second / 60 * Math.PI * 2 - Math.PI / 2;\n ctx.strokeStyle = \"#a52c20\";\n ctx.lineWidth = Math.max(.7, r * .012);\n ctx.beginPath();\n ctx.moveTo(cx - Math.cos(sa) * r * .17, cy - Math.sin(sa) * r * .17);\n ctx.lineTo(cx + Math.cos(sa) * r * .82, cy + Math.sin(sa) * r * .82);\n ctx.stroke();\n }\n\n const pin = ctx.createRadialGradient(cx - 1, cy - 1, 0, cx, cy, r * .09);\n pin.addColorStop(0, \"#f2d993\");\n pin.addColorStop(.35, style === \"white\" ? \"#ddd\" : \"#6d5428\");\n pin.addColorStop(1, \"#201b16\");\n ctx.fillStyle = pin;\n ctx.beginPath();\n ctx.arc(cx, cy, Math.max(2, r * .055), 0, Math.PI * 2);\n ctx.fill();\n }\n\n function clockFace(cx, cy, r, opts = {}) {\n const {\n rim = \"wood\", face = \"#efe9d8\", numerals = \"arabic\",\n hour = 10, minute = 9, second = 38, label = \"\"\n } = opts;\n\n shadow(r * .17, 3, 6);\n let rg = ctx.createRadialGradient(cx - r * .28, cy - r * .32, r * .08, cx, cy, r * 1.08);\n if (rim === \"brass\") {\n rg.addColorStop(0, \"#ffe49c\"); rg.addColorStop(.28, \"#ad7f2d\");\n rg.addColorStop(.63, \"#e5bd60\"); rg.addColorStop(1, \"#584019\");\n } else if (rim === \"black\") {\n rg.addColorStop(0, \"#686764\"); rg.addColorStop(.25, \"#262725\");\n rg.addColorStop(.72, \"#111210\"); rg.addColorStop(1, \"#45443f\");\n } else if (rim === \"silver\") {\n rg.addColorStop(0, \"#f2f0e9\"); rg.addColorStop(.25, \"#929494\");\n rg.addColorStop(.58, \"#d7d7d1\"); rg.addColorStop(1, \"#555a5b\");\n } else if (rim === \"red\") {\n rg.addColorStop(0, \"#b95f46\"); rg.addColorStop(.5, \"#743527\");\n rg.addColorStop(1, \"#351813\");\n } else {\n rg.addColorStop(0, \"#bc7843\"); rg.addColorStop(.35, \"#6c351a\");\n rg.addColorStop(.72, \"#9a552c\"); rg.addColorStop(1, \"#3a1d12\");\n }\n ctx.fillStyle = rg;\n ctx.beginPath();\n ctx.arc(cx, cy, r, 0, Math.PI * 2);\n ctx.fill();\n noShadow();\n\n ctx.strokeStyle = \"rgba(255,255,255,.28)\";\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.arc(cx - .5, cy - .5, r - 2, Math.PI * 1.08, Math.PI * 1.87);\n ctx.stroke();\n\n const fr = r * .82;\n const fg = ctx.createRadialGradient(cx - fr * .25, cy - fr * .3, 2, cx, cy, fr);\n fg.addColorStop(0, \"#fffdf2\");\n fg.addColorStop(.72, face);\n fg.addColorStop(1, face === \"#222522\" ? \"#121411\" : \"#d0c7b2\");\n ctx.fillStyle = fg;\n ctx.beginPath();\n ctx.arc(cx, cy, fr, 0, Math.PI * 2);\n ctx.fill();\n ctx.strokeStyle = rim === \"brass\" ? \"#725522\" : \"rgba(35,29,23,.55)\";\n ctx.lineWidth = 1;\n ctx.stroke();\n\n const darkFace = face === \"#222522\";\n const ink = darkFace ? \"#eee9dc\" : \"#302c27\";\n for (let i = 0; i < 60; i++) {\n const a = i * Math.PI / 30 - Math.PI / 2;\n const major = i % 5 === 0;\n const ro = fr * .91, ri = fr * (major ? .78 : .86);\n ctx.strokeStyle = ink;\n ctx.globalAlpha = major ? .9 : .48;\n ctx.lineWidth = major ? Math.max(1, r * .018) : .55;\n ctx.beginPath();\n ctx.moveTo(cx + Math.cos(a) * ri, cy + Math.sin(a) * ri);\n ctx.lineTo(cx + Math.cos(a) * ro, cy + Math.sin(a) * ro);\n ctx.stroke();\n }\n ctx.globalAlpha = 1;\n\n if (r > 22 && numerals !== \"none\") {\n ctx.fillStyle = ink;\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n if (numerals === \"roman\") {\n const rom = [\"XII\", \"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\", \"VIII\", \"IX\", \"X\", \"XI\"];\n ctx.font = `${Math.max(7, r * .18)}px Georgia, serif`;\n for (let i = 0; i < 12; i++) {\n const a = i * Math.PI / 6 - Math.PI / 2;\n ctx.fillText(rom[i], cx + Math.cos(a) * fr * .65, cy + Math.sin(a) * fr * .65);\n }\n } else {\n ctx.font = `600 ${Math.max(7, r * .18)}px Arial, sans-serif`;\n for (let i = 1; i <= 12; i++) {\n const a = i * Math.PI / 6 - Math.PI / 2;\n ctx.fillText(String(i), cx + Math.cos(a) * fr * .65, cy + Math.sin(a) * fr * .65);\n }\n }\n }\n\n if (label && r > 30) {\n ctx.fillStyle = darkFace ? \"#cbc6b9\" : \"#706759\";\n ctx.font = `${Math.max(4.5, r * .07)}px Georgia, serif`;\n ctx.textAlign = \"center\";\n ctx.fillText(label, cx, cy + r * .3);\n }\n hands(cx, cy, fr, hour, minute, darkFace ? \"white\" : rim === \"brass\" ? \"brass\" : \"black\", second);\n }\n\n function sunClock(cx, cy, r) {\n shadow(9, 3, 5);\n ctx.save();\n ctx.translate(cx, cy);\n for (let i = 0; i < 24; i++) {\n ctx.rotate(Math.PI / 12);\n const g = ctx.createLinearGradient(r * .74, 0, r * 1.35, 0);\n g.addColorStop(0, \"#5b3e1b\");\n g.addColorStop(.5, \"#d09b43\");\n g.addColorStop(1, \"#6e481d\");\n ctx.fillStyle = g;\n ctx.beginPath();\n ctx.moveTo(r * .68, -2.3);\n ctx.lineTo(r * 1.38, 0);\n ctx.lineTo(r * .68, 2.3);\n ctx.closePath();\n ctx.fill();\n }\n ctx.restore();\n noShadow();\n clockFace(cx, cy, r * .73, {\n rim: \"brass\", face: \"#f3ead4\", numerals: \"roman\", hour: 7, minute: 22, second: 4\n });\n }\n\n function squareClock(x, y, w, h) {\n shadow(12, 4, 7);\n const wood = ctx.createLinearGradient(x, y, x + w, y + h);\n wood.addColorStop(0, \"#a86736\");\n wood.addColorStop(.35, \"#4d2515\");\n wood.addColorStop(.67, \"#8f4d28\");\n wood.addColorStop(1, \"#35180f\");\n ctx.fillStyle = wood;\n rr(x, y, w, h, 6);\n ctx.fill();\n noShadow();\n ctx.strokeStyle = \"#32180f\";\n ctx.lineWidth = 2;\n rr(x + 2, y + 2, w - 4, h - 4, 5);\n ctx.stroke();\n for (let i = 0; i < 8; i++) {\n ctx.strokeStyle = `rgba(32,12,5,${.12 + rnd() * .12})`;\n ctx.lineWidth = .6;\n ctx.beginPath();\n ctx.moveTo(x + 4, y + 5 + i * h / 8);\n ctx.bezierCurveTo(x + w * .35, y + i * h / 8 + rnd() * 7,\n x + w * .65, y + i * h / 8 - rnd() * 5,\n x + w - 4, y + 6 + i * h / 8);\n ctx.stroke();\n }\n clockFace(x + w / 2, y + h / 2, Math.min(w, h) * .39, {\n rim: \"brass\", face: \"#eee2c6\", numerals: \"roman\", hour: 3, minute: 42, second: 17\n });\n }\n\n function pendulumClock(x, y, w, h) {\n shadow(14, 5, 8);\n const wood = ctx.createLinearGradient(x, y, x + w, y);\n wood.addColorStop(0, \"#32170f\");\n wood.addColorStop(.2, \"#89502b\");\n wood.addColorStop(.5, \"#ad7040\");\n wood.addColorStop(.78, \"#67351e\");\n wood.addColorStop(1, \"#2a120c\");\n ctx.fillStyle = wood;\n rr(x, y, w, h, 7);\n ctx.fill();\n noShadow();\n\n ctx.fillStyle = \"#4b2415\";\n ctx.beginPath();\n ctx.moveTo(x - 6, y + 8);\n ctx.lineTo(x + w / 2, y - 13);\n ctx.lineTo(x + w + 6, y + 8);\n ctx.closePath();\n ctx.fill();\n ctx.fillStyle = \"#d1a35b\";\n ctx.beginPath();\n ctx.arc(x + w / 2, y - 5, 4, 0, Math.PI * 2);\n ctx.fill();\n\n clockFace(x + w / 2, y + 37, w * .38, {\n rim: \"brass\", face: \"#eee5d2\", numerals: \"roman\", hour: 1, minute: 51, second: 23\n });\n\n ctx.fillStyle = \"#25130e\";\n rr(x + 10, y + 72, w - 20, h - 82, 5);\n ctx.fill();\n const glass = ctx.createLinearGradient(x + 10, y, x + w - 10, y);\n glass.addColorStop(0, \"rgba(100,133,139,.24)\");\n glass.addColorStop(.4, \"rgba(240,250,242,.09)\");\n glass.addColorStop(.65, \"rgba(255,255,255,.3)\");\n glass.addColorStop(1, \"rgba(60,88,93,.17)\");\n ctx.fillStyle = glass;\n rr(x + 12, y + 74, w - 24, h - 86, 4);\n ctx.fill();\n\n ctx.strokeStyle = \"#a77d38\";\n ctx.lineWidth = 2;\n ctx.beginPath();\n ctx.moveTo(x + w / 2, y + 76);\n ctx.lineTo(x + w / 2 - 5, y + h - 25);\n ctx.stroke();\n const pg = ctx.createRadialGradient(x + w / 2 - 8, y + h - 28, 2, x + w / 2 - 5, y + h - 25, 15);\n pg.addColorStop(0, \"#ffe29a\");\n pg.addColorStop(.45, \"#b48231\");\n pg.addColorStop(1, \"#4a3213\");\n ctx.fillStyle = pg;\n ctx.beginPath();\n ctx.ellipse(x + w / 2 - 5, y + h - 24, 12, 17, -.1, 0, Math.PI * 2);\n ctx.fill();\n }\n\n function ovalClock(cx, cy, rx, ry) {\n shadow(11, 4, 7);\n const g = ctx.createRadialGradient(cx - rx * .3, cy - ry * .3, 2, cx, cy, rx);\n g.addColorStop(0, \"#d78d51\");\n g.addColorStop(.5, \"#6c351f\");\n g.addColorStop(1, \"#2c1510\");\n ctx.fillStyle = g;\n ctx.beginPath();\n ctx.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2);\n ctx.fill();\n noShadow();\n\n ctx.fillStyle = \"#eee3cb\";\n ctx.beginPath();\n ctx.ellipse(cx, cy, rx * .78, ry * .8, 0, 0, Math.PI * 2);\n ctx.fill();\n ctx.strokeStyle = \"#6e4c29\";\n ctx.lineWidth = 1.4;\n ctx.stroke();\n\n for (let i = 0; i < 12; i++) {\n const a = i * Math.PI / 6 - Math.PI / 2;\n ctx.fillStyle = \"#382b21\";\n ctx.font = \"8px Georgia\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(i === 0 ? \"XII\" : [\"\", \"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\", \"VIII\", \"IX\", \"X\", \"XI\"][i],\n cx + Math.cos(a) * rx * .55, cy + Math.sin(a) * ry * .57);\n }\n hands(cx, cy, Math.min(rx, ry) * .9, 5, 27, \"black\", 48);\n }\n\n function cuckoo(x, y, w, h) {\n shadow(13, 5, 8);\n ctx.fillStyle = \"#4a2718\";\n ctx.beginPath();\n ctx.moveTo(x - 8, y + 28);\n ctx.lineTo(x + w / 2, y - 14);\n ctx.lineTo(x + w + 8, y + 28);\n ctx.closePath();\n ctx.fill();\n const wood = ctx.createLinearGradient(x, y, x + w, y + h);\n wood.addColorStop(0, \"#8a5330\");\n wood.addColorStop(.55, \"#4e2818\");\n wood.addColorStop(1, \"#2b150e\");\n ctx.fillStyle = wood;\n rr(x, y + 23, w, h - 23, 3);\n ctx.fill();\n noShadow();\n\n ctx.strokeStyle = \"#bd8250\";\n ctx.lineWidth = 2;\n for (let i = 0; i < 4; i++) {\n ctx.beginPath();\n ctx.moveTo(x + 4 + i * 12, y + 18 + i * 2);\n ctx.lineTo(x + w / 2, y - 7);\n ctx.stroke();\n }\n ctx.fillStyle = \"#17100d\";\n rr(x + w / 2 - 10, y + 13, 20, 15, 2);\n ctx.fill();\n ctx.fillStyle = \"#b17b48\";\n ctx.beginPath();\n ctx.arc(x + w / 2, y + 22, 4, Math.PI, 0);\n ctx.fill();\n\n clockFace(x + w / 2, y + 55, w * .31, {\n rim: \"wood\", face: \"#e9dfc9\", numerals: \"roman\", hour: 11, minute: 4, second: null\n });\n\n ctx.strokeStyle = \"#342115\";\n ctx.lineWidth = 1.4;\n ctx.beginPath();\n ctx.moveTo(x + 14, y + h - 4);\n ctx.lineTo(x + 8, y + h + 36);\n ctx.moveTo(x + w - 14, y + h - 4);\n ctx.lineTo(x + w - 5, y + h + 44);\n ctx.stroke();\n\n ctx.fillStyle = \"#52351c\";\n ctx.beginPath();\n ctx.moveTo(x + 8, y + h + 27);\n ctx.lineTo(x + 2, y + h + 49);\n ctx.lineTo(x + 14, y + h + 49);\n ctx.closePath();\n ctx.fill();\n ctx.beginPath();\n ctx.moveTo(x + w - 5, y + h + 35);\n ctx.lineTo(x + w - 11, y + h + 57);\n ctx.lineTo(x + w + 1, y + h + 57);\n ctx.closePath();\n ctx.fill();\n }\n\n function digital(x, y, w, h) {\n shadow(10, 3, 6);\n const g = ctx.createLinearGradient(x, y, x, y + h);\n g.addColorStop(0, \"#595a58\");\n g.addColorStop(.3, \"#242624\");\n g.addColorStop(1, \"#111210\");\n ctx.fillStyle = g;\n rr(x, y, w, h, 7);\n ctx.fill();\n noShadow();\n ctx.fillStyle = \"#080d0a\";\n rr(x + 7, y + 7, w - 14, h - 14, 3);\n ctx.fill();\n ctx.shadowColor = \"rgba(95,255,112,.5)\";\n ctx.shadowBlur = 5;\n ctx.fillStyle = \"#8fe98b\";\n ctx.font = \"18px monospace\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(\"8:24\", x + w / 2, y + h / 2 + 1);\n noShadow();\n }\n\n // Back row and smaller pieces.\n sunClock(78, 78, 34);\n clockFace(169, 65, 28, {\n rim: \"silver\", face: \"#f3f2eb\", numerals: \"none\", hour: 2, minute: 17, second: 43\n });\n clockFace(257, 68, 38, {\n rim: \"black\", face: \"#f4f0e2\", numerals: \"arabic\", hour: 10, minute: 10, second: 31, label: \"STANDARD\"\n });\n clockFace(337, 62, 25, {\n rim: \"red\", face: \"#f2dec8\", numerals: \"none\", hour: 6, minute: 47, second: 8\n });\n pendulumClock(397, 50, 66, 151);\n\n squareClock(27, 139, 92, 101);\n clockFace(158, 153, 31, {\n rim: \"brass\", face: \"#222522\", numerals: \"arabic\", hour: 8, minute: 36, second: 11\n });\n clockFace(339, 155, 29, {\n rim: \"silver\", face: \"#f0eee4\", numerals: \"none\", hour: 12, minute: 23, second: 52\n });\n clockFace(453, 238, 39, {\n rim: \"black\", face: \"#eceadc\", numerals: \"arabic\", hour: 4, minute: 39, second: 15\n });\n\n clockFace(257, 226, 70, {\n rim: \"brass\", face: \"#efe5cf\", numerals: \"roman\", hour: 10, minute: 8, second: 36, label: \"WESTMINSTER\"\n });\n\n clockFace(139, 264, 29, {\n rim: \"black\", face: \"#f3eee1\", numerals: \"arabic\", hour: 1, minute: 33, second: 20\n });\n digital(335, 231, 72, 39);\n\n // Foreground lower gallery.\n ovalClock(78, 342, 47, 61);\n clockFace(169, 350, 34, {\n rim: \"silver\", face: \"#f5f3eb\", numerals: \"none\", hour: 9, minute: 13, second: 57\n });\n pendulumClock(221, 322, 70, 163);\n cuckoo(368, 302, 75, 129);\n\n clockFace(116, 444, 34, {\n rim: \"red\", face: \"#eddfcb\", numerals: \"arabic\", hour: 2, minute: 52, second: 6\n });\n clockFace(334, 442, 31, {\n rim: \"brass\", face: \"#222522\", numerals: \"none\", hour: 7, minute: 19, second: 40\n });\n clockFace(474, 440, 25, {\n rim: \"silver\", face: \"#f3f1e8\", numerals: \"none\", hour: 5, minute: 44, second: 25\n });\n\n // Tiny hanging nails visible above a few frames.\n const nails = [[169, 34], [337, 33], [139, 229], [334, 405], [473, 408]];\n nails.forEach(([x, y]) => {\n ctx.strokeStyle = \"rgba(56,45,35,.48)\";\n ctx.lineWidth = .7;\n ctx.beginPath();\n ctx.moveTo(x, y + 3);\n ctx.lineTo(x, y + 10);\n ctx.stroke();\n ctx.fillStyle = \"#766c61\";\n ctx.beginPath();\n ctx.arc(x, y + 2, 1.4, 0, Math.PI * 2);\n ctx.fill();\n });\n\n // Subtle room-light glaze and vignette.\n const light = ctx.createRadialGradient(118, 64, 10, 180, 170, 480);\n light.addColorStop(0, \"rgba(255,247,220,.17)\");\n light.addColorStop(.55, \"rgba(255,255,255,0)\");\n light.addColorStop(1, \"rgba(41,29,20,.19)\");\n ctx.fillStyle = light;\n ctx.fillRect(0, 0, 512, 512);\n}"}], "metadata": {"id": "val-v1-coco-train2017-000000231320-177887", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 7572, "code_sha256": "1f001d28e59102b456da5daa82cefc7ecf034195986cf8b6eedc80d78c443c58"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A stop sign that is not at the top of the pole."}, {"role": "assistant", "content": "async function render(stage) {\n const canvas = document.createElement(\"canvas\");\n const dpr = Math.max(2, window.devicePixelRatio || 1);\n canvas.width = 512 * dpr;\n canvas.height = 512 * dpr;\n canvas.style.width = \"512px\";\n canvas.style.height = \"512px\";\n canvas.style.display = \"block\";\n stage.style.position = \"relative\";\n stage.style.overflow = \"hidden\";\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n ctx.scale(dpr, dpr);\n\n let seed = 18473;\n const random = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n\n const polygon = (cx, cy, radius, rotation = Math.PI / 8) => {\n ctx.beginPath();\n for (let i = 0; i < 8; i++) {\n const a = rotation + i * Math.PI / 4;\n const x = cx + Math.cos(a) * radius;\n const y = cy + Math.sin(a) * radius;\n i ? ctx.lineTo(x, y) : ctx.moveTo(x, y);\n }\n ctx.closePath();\n };\n\n // Sky\n const sky = ctx.createLinearGradient(0, 0, 0, 330);\n sky.addColorStop(0, \"#87b9dc\");\n sky.addColorStop(0.55, \"#c7deeb\");\n sky.addColorStop(1, \"#e9e5d5\");\n ctx.fillStyle = sky;\n ctx.fillRect(0, 0, 512, 512);\n\n // Soft clouds\n ctx.save();\n ctx.globalAlpha = 0.28;\n ctx.filter = \"blur(9px)\";\n for (let i = 0; i < 18; i++) {\n const x = random() * 560 - 25;\n const y = 28 + random() * 175;\n const rx = 24 + random() * 58;\n const ry = 7 + random() * 16;\n ctx.beginPath();\n ctx.ellipse(x, y, rx, ry, 0, 0, Math.PI * 2);\n ctx.fillStyle = random() > 0.25 ? \"#ffffff\" : \"#d7e3e8\";\n ctx.fill();\n }\n ctx.restore();\n\n // Distant tree line\n ctx.save();\n ctx.filter = \"blur(2px)\";\n const treeBase = ctx.createLinearGradient(0, 218, 0, 372);\n treeBase.addColorStop(0, \"#526f4d\");\n treeBase.addColorStop(1, \"#233c2b\");\n ctx.fillStyle = treeBase;\n ctx.beginPath();\n ctx.moveTo(0, 350);\n ctx.lineTo(0, 268);\n for (let x = 0; x <= 512; x += 7) {\n const y = 250 - random() * 62 - Math.sin(x * 0.035) * 13;\n ctx.lineTo(x, y);\n }\n ctx.lineTo(512, 350);\n ctx.closePath();\n ctx.fill();\n\n for (let i = 0; i < 120; i++) {\n const x = random() * 512;\n const y = 237 + random() * 104;\n const r = 7 + random() * 25;\n ctx.fillStyle = `rgba(${28 + random() * 40},${61 + random() * 49},${29 + random() * 34},${0.18 + random() * 0.28})`;\n ctx.beginPath();\n ctx.arc(x, y, r, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.restore();\n\n // Distant houses\n ctx.save();\n ctx.globalAlpha = 0.72;\n ctx.fillStyle = \"#d2c8b5\";\n ctx.fillRect(28, 302, 116, 54);\n ctx.fillStyle = \"#745e50\";\n ctx.beginPath();\n ctx.moveTo(15, 306);\n ctx.lineTo(84, 266);\n ctx.lineTo(153, 306);\n ctx.closePath();\n ctx.fill();\n ctx.fillStyle = \"#718498\";\n ctx.fillRect(46, 316, 25, 26);\n ctx.fillRect(103, 316, 24, 26);\n\n ctx.fillStyle = \"#c5bca8\";\n ctx.fillRect(395, 294, 106, 62);\n ctx.fillStyle = \"#68594c\";\n ctx.beginPath();\n ctx.moveTo(382, 299);\n ctx.lineTo(446, 263);\n ctx.lineTo(511, 299);\n ctx.closePath();\n ctx.fill();\n ctx.fillStyle = \"#70808a\";\n ctx.fillRect(411, 310, 27, 29);\n ctx.fillRect(464, 310, 24, 29);\n ctx.restore();\n\n // Verge and road\n const grass = ctx.createLinearGradient(0, 340, 0, 512);\n grass.addColorStop(0, \"#668353\");\n grass.addColorStop(0.65, \"#779052\");\n grass.addColorStop(1, \"#667742\");\n ctx.fillStyle = grass;\n ctx.fillRect(0, 344, 512, 168);\n\n ctx.fillStyle = \"#8c8e89\";\n ctx.beginPath();\n ctx.moveTo(0, 402);\n ctx.lineTo(512, 367);\n ctx.lineTo(512, 512);\n ctx.lineTo(0, 512);\n ctx.closePath();\n ctx.fill();\n\n const roadShade = ctx.createLinearGradient(0, 391, 0, 512);\n roadShade.addColorStop(0, \"rgba(255,255,255,.10)\");\n roadShade.addColorStop(1, \"rgba(30,34,35,.18)\");\n ctx.fillStyle = roadShade;\n ctx.fillRect(0, 385, 512, 127);\n\n ctx.strokeStyle = \"rgba(238,224,170,.7)\";\n ctx.lineWidth = 3;\n ctx.beginPath();\n ctx.moveTo(0, 425);\n ctx.lineTo(512, 389);\n ctx.stroke();\n\n // Road and grass texture\n for (let i = 0; i < 900; i++) {\n const x = random() * 512;\n const y = 345 + random() * 167;\n if (y > 399 - x * 0.068) {\n const v = random() > 0.5 ? 255 : 25;\n ctx.fillStyle = `rgba(${v},${v},${v},${0.015 + random() * 0.035})`;\n ctx.fillRect(x, y, 0.6 + random() * 1.2, 0.6 + random() * 1.2);\n } else {\n ctx.strokeStyle = `rgba(${45 + random() * 55},${70 + random() * 55},${28 + random() * 28},.28)`;\n ctx.lineWidth = 0.5;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.lineTo(x - 1 + random() * 2, y - 2 - random() * 5);\n ctx.stroke();\n }\n }\n\n // Pole ground shadow\n ctx.save();\n ctx.filter = \"blur(7px)\";\n ctx.fillStyle = \"rgba(23,28,24,.28)\";\n ctx.beginPath();\n ctx.ellipse(283, 486, 49, 9, -0.08, 0, Math.PI * 2);\n ctx.fill();\n ctx.restore();\n\n // Long galvanized pole, intentionally extending far above the sign\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.24)\";\n ctx.shadowBlur = 5;\n ctx.shadowOffsetX = 3;\n ctx.shadowOffsetY = 3;\n const pole = ctx.createLinearGradient(267, 0, 289, 0);\n pole.addColorStop(0, \"#70797b\");\n pole.addColorStop(0.14, \"#b9c0bd\");\n pole.addColorStop(0.38, \"#e1e2dc\");\n pole.addColorStop(0.62, \"#9ca5a3\");\n pole.addColorStop(0.83, \"#d1d4cf\");\n pole.addColorStop(1, \"#60696b\");\n ctx.fillStyle = pole;\n ctx.beginPath();\n ctx.moveTo(269, 26);\n ctx.lineTo(287, 26);\n ctx.lineTo(285, 500);\n ctx.lineTo(270, 500);\n ctx.closePath();\n ctx.fill();\n ctx.restore();\n\n // Pole top cap\n ctx.fillStyle = \"#747d7e\";\n ctx.beginPath();\n ctx.roundRect(268, 22, 20, 7, 2);\n ctx.fill();\n ctx.strokeStyle = \"rgba(255,255,255,.55)\";\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(270, 24);\n ctx.lineTo(286, 24);\n ctx.stroke();\n\n // Perforations visible above and below sign\n for (let y = 40; y < 492; y += 18) {\n if (y > 151 && y < 331) continue;\n ctx.fillStyle = \"rgba(43,49,49,.72)\";\n ctx.beginPath();\n ctx.ellipse(278, y, 2.4, 3.5, 0, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = \"rgba(255,255,255,.25)\";\n ctx.beginPath();\n ctx.arc(277.2, y - 1.1, 0.75, 0, Math.PI * 2);\n ctx.fill();\n }\n\n // Sign shadow\n ctx.save();\n ctx.translate(278, 244);\n ctx.rotate(-0.012);\n ctx.shadowColor = \"rgba(0,0,0,.38)\";\n ctx.shadowBlur = 10;\n ctx.shadowOffsetX = 6;\n ctx.shadowOffsetY = 8;\n polygon(0, 0, 91);\n ctx.fillStyle = \"#585b58\";\n ctx.fill();\n ctx.restore();\n\n // Sign assembly\n ctx.save();\n ctx.translate(278, 244);\n ctx.rotate(-0.012);\n\n polygon(0, 0, 90);\n const rim = ctx.createLinearGradient(-90, -80, 90, 80);\n rim.addColorStop(0, \"#dadbd6\");\n rim.addColorStop(0.35, \"#929997\");\n rim.addColorStop(0.62, \"#ecece5\");\n rim.addColorStop(1, \"#6c7372\");\n ctx.fillStyle = rim;\n ctx.fill();\n\n polygon(0, 0, 87);\n const red = ctx.createRadialGradient(-23, -30, 8, 0, 0, 112);\n red.addColorStop(0, \"#e22328\");\n red.addColorStop(0.58, \"#c90f18\");\n red.addColorStop(1, \"#a80811\");\n ctx.fillStyle = red;\n ctx.fill();\n\n polygon(0, 0, 78);\n ctx.strokeStyle = \"#f5f2e8\";\n ctx.lineWidth = 5.5;\n ctx.lineJoin = \"miter\";\n ctx.stroke();\n\n // Subtle reflective sheen\n ctx.save();\n polygon(0, 0, 84);\n ctx.clip();\n const shine = ctx.createLinearGradient(-75, -75, 60, 65);\n shine.addColorStop(0, \"rgba(255,255,255,.16)\");\n shine.addColorStop(0.34, \"rgba(255,255,255,.025)\");\n shine.addColorStop(0.65, \"rgba(0,0,0,.035)\");\n shine.addColorStop(1, \"rgba(255,255,255,.06)\");\n ctx.fillStyle = shine;\n ctx.fillRect(-100, -100, 200, 200);\n\n for (let i = 0; i < 190; i++) {\n const x = random() * 156 - 78;\n const y = random() * 156 - 78;\n if (Math.abs(x) + Math.abs(y) * 0.43 < 96) {\n ctx.fillStyle = random() > 0.4\n ? `rgba(255,255,255,${0.015 + random() * 0.05})`\n : `rgba(68,0,0,${0.018 + random() * 0.04})`;\n ctx.fillRect(x, y, 0.5 + random() * 1.1, 0.5 + random() * 1.1);\n }\n }\n ctx.restore();\n\n // STOP lettering\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.font = \"900 54px Arial Black, Arial, sans-serif\";\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(110,0,0,.15)\";\n ctx.strokeText(\"STOP\", 1, 3);\n ctx.fillStyle = \"#fffdf5\";\n ctx.fillText(\"STOP\", 0, 1);\n\n // Mounting bolts\n const bolts = [[0, -67], [0, 67]];\n for (const [x, y] of bolts) {\n const b = ctx.createRadialGradient(x - 1.2, y - 1.4, 0, x, y, 4.3);\n b.addColorStop(0, \"#f4f5ef\");\n b.addColorStop(0.45, \"#aab0ac\");\n b.addColorStop(1, \"#4e5555\");\n ctx.fillStyle = b;\n ctx.beginPath();\n ctx.arc(x, y, 4.1, 0, Math.PI * 2);\n ctx.fill();\n ctx.strokeStyle = \"rgba(45,48,47,.65)\";\n ctx.lineWidth = 0.8;\n ctx.beginPath();\n ctx.moveTo(x - 2.2, y);\n ctx.lineTo(x + 2.2, y);\n ctx.stroke();\n }\n ctx.restore();\n\n // Foreground grass around pole base\n for (let i = 0; i < 55; i++) {\n const x = 254 + random() * 48;\n const y = 483 + random() * 22;\n ctx.strokeStyle = `rgba(${38 + random() * 45},${62 + random() * 48},${25 + random() * 25},${0.35 + random() * 0.4})`;\n ctx.lineWidth = 0.7 + random();\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.quadraticCurveTo(x + random() * 5 - 2.5, y - 8, x + random() * 7 - 3.5, y - 12 - random() * 10);\n ctx.stroke();\n }\n\n // Gentle photographic vignette\n const vignette = ctx.createRadialGradient(256, 242, 170, 256, 256, 390);\n vignette.addColorStop(0, \"rgba(0,0,0,0)\");\n vignette.addColorStop(0.74, \"rgba(0,0,0,.015)\");\n vignette.addColorStop(1, \"rgba(17,25,25,.19)\");\n ctx.fillStyle = vignette;\n ctx.fillRect(0, 0, 512, 512);\n}"}], "metadata": {"id": "val-v1-coco-train2017-000000367754-47757", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 4318, "code_sha256": "f2656b0cfb8e08f39c8a7492eb299127dba21c534dc73510f8b90c9cfa61045b"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "A bed has a blue cover and is near a stone wall."}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n position: \"relative\",\n overflow: \"hidden\",\n background: \"#171b1d\"\n });\n\n const canvas = document.createElement(\"canvas\");\n canvas.width = 1024;\n canvas.height = 1024;\n Object.assign(canvas.style, {\n width: \"100%\",\n height: \"100%\",\n display: \"block\"\n });\n stage.appendChild(canvas);\n\n const ctx = canvas.getContext(\"2d\");\n const W = canvas.width, H = canvas.height;\n\n let seed = 184729;\n const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 4294967296;\n };\n const path = (pts, close = true) => {\n ctx.beginPath();\n ctx.moveTo(pts[0][0], pts[0][1]);\n for (let i = 1; i < pts.length; i++) ctx.lineTo(pts[i][0], pts[i][1]);\n if (close) ctx.closePath();\n };\n const fillPoly = (pts, fill, stroke, width = 1) => {\n path(pts);\n ctx.fillStyle = fill;\n ctx.fill();\n if (stroke) {\n ctx.strokeStyle = stroke;\n ctx.lineWidth = width;\n ctx.stroke();\n }\n };\n const ellipse = (x, y, rx, ry, fill) => {\n ctx.beginPath();\n ctx.ellipse(x, y, rx, ry, 0, 0, Math.PI * 2);\n ctx.fillStyle = fill;\n ctx.fill();\n };\n\n // Stone wall foundation\n const wallGrad = ctx.createLinearGradient(0, 0, 0, 720);\n wallGrad.addColorStop(0, \"#6e706b\");\n wallGrad.addColorStop(0.45, \"#777771\");\n wallGrad.addColorStop(1, \"#555956\");\n ctx.fillStyle = wallGrad;\n ctx.fillRect(0, 0, W, 710);\n\n // Irregular masonry\n const rowHeights = [105, 112, 96, 116, 105, 112, 95];\n let yy = -20;\n for (let row = 0; yy < 710; row++) {\n const rh = rowHeights[row % rowHeights.length];\n let x = row % 2 ? -85 : -20;\n while (x < W) {\n const sw = 125 + rnd() * 125;\n const inset = 5;\n const top = yy + inset + rnd() * 4;\n const bottom = yy + rh - inset - rnd() * 4;\n const pts = [\n [x + inset + rnd() * 8, top + rnd() * 5],\n [x + sw - inset - rnd() * 7, top],\n [x + sw - rnd() * 4, bottom - rnd() * 6],\n [x + 10 + rnd() * 6, bottom]\n ];\n\n const base = 92 + Math.floor(rnd() * 42);\n const warm = rnd() > 0.72;\n const grad = ctx.createLinearGradient(x, top, x + sw, bottom);\n if (warm) {\n grad.addColorStop(0, `rgb(${base + 16},${base + 10},${base})`);\n grad.addColorStop(0.55, `rgb(${base + 4},${base + 1},${base - 5})`);\n grad.addColorStop(1, `rgb(${base - 12},${base - 12},${base - 15})`);\n } else {\n grad.addColorStop(0, `rgb(${base + 10},${base + 12},${base + 10})`);\n grad.addColorStop(0.6, `rgb(${base},${base + 1},${base - 1})`);\n grad.addColorStop(1, `rgb(${base - 14},${base - 12},${base - 13})`);\n }\n\n ctx.save();\n path(pts);\n ctx.shadowColor = \"rgba(12,16,16,.55)\";\n ctx.shadowBlur = 3;\n ctx.shadowOffsetY = 4;\n ctx.fillStyle = grad;\n ctx.fill();\n ctx.restore();\n\n path(pts);\n ctx.strokeStyle = \"rgba(31,34,33,.6)\";\n ctx.lineWidth = 4;\n ctx.stroke();\n\n ctx.save();\n path(pts);\n ctx.clip();\n for (let i = 0; i < 14; i++) {\n const px = x + rnd() * sw;\n const py = top + rnd() * (bottom - top);\n const r = 1 + rnd() * 7;\n ellipse(px, py, r, r * 0.45, rnd() > 0.5\n ? `rgba(255,255,245,${0.025 + rnd() * 0.05})`\n : `rgba(20,24,23,${0.03 + rnd() * 0.07})`);\n }\n // Fine stone fissures\n if (rnd() > 0.55) {\n ctx.beginPath();\n let cx = x + sw * (0.25 + rnd() * 0.5);\n let cy = top + rnd() * 20;\n ctx.moveTo(cx, cy);\n for (let n = 0; n < 3; n++) {\n cx += (rnd() - 0.5) * 28;\n cy += 10 + rnd() * 18;\n ctx.lineTo(cx, cy);\n }\n ctx.strokeStyle = \"rgba(30,32,31,.19)\";\n ctx.lineWidth = 1.5;\n ctx.stroke();\n }\n ctx.restore();\n x += sw - 2;\n }\n yy += rh - 2;\n }\n\n // Soft light falling across wall\n const wallLight = ctx.createRadialGradient(220, 95, 20, 230, 150, 640);\n wallLight.addColorStop(0, \"rgba(255,244,214,.26)\");\n wallLight.addColorStop(0.55, \"rgba(255,238,203,.08)\");\n wallLight.addColorStop(1, \"rgba(0,0,0,0)\");\n ctx.fillStyle = wallLight;\n ctx.fillRect(0, 0, W, 720);\n\n // Wall/floor seam and floor\n const floorGrad = ctx.createLinearGradient(0, 650, 0, H);\n floorGrad.addColorStop(0, \"#3d3933\");\n floorGrad.addColorStop(1, \"#211f1d\");\n ctx.fillStyle = floorGrad;\n ctx.fillRect(0, 690, W, 334);\n\n ctx.fillStyle = \"rgba(11,12,12,.45)\";\n ctx.fillRect(0, 686, W, 13);\n ctx.fillStyle = \"rgba(179,157,125,.12)\";\n ctx.fillRect(0, 699, W, 3);\n\n // Wooden floorboards in perspective\n ctx.save();\n ctx.strokeStyle = \"rgba(7,8,8,.34)\";\n ctx.lineWidth = 3;\n const vanishX = 515, vanishY = 690;\n [-650, -400, -180, 40, 245, 445, 645, 845, 1060, 1280, 1510].forEach(x => {\n ctx.beginPath();\n ctx.moveTo(vanishX + (x - vanishX) * 0.04, vanishY);\n ctx.lineTo(x, H);\n ctx.stroke();\n });\n for (let y = 746; y < H; y += 67) {\n ctx.beginPath();\n ctx.moveTo(0, y);\n ctx.lineTo(W, y + (y - 690) * 0.025);\n ctx.stroke();\n }\n for (let i = 0; i < 80; i++) {\n ctx.beginPath();\n const x = rnd() * W, y = 700 + rnd() * 324;\n ctx.moveTo(x, y);\n ctx.lineTo(x + 30 + rnd() * 100, y + (rnd() - .5) * 4);\n ctx.strokeStyle = `rgba(186,159,118,${.018 + rnd() * .035})`;\n ctx.lineWidth = 1;\n ctx.stroke();\n }\n ctx.restore();\n\n // Bed cast shadow\n ctx.save();\n ctx.filter = \"blur(24px)\";\n fillPoly([\n [115, 625], [650, 550], [1000, 792], [930, 930], [250, 940], [75, 790]\n ], \"rgba(0,0,0,.62)\");\n ctx.restore();\n\n // Headboard\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.55)\";\n ctx.shadowBlur = 16;\n ctx.shadowOffsetX = 8;\n ctx.shadowOffsetY = 8;\n const headGrad = ctx.createLinearGradient(110, 355, 645, 635);\n headGrad.addColorStop(0, \"#302b27\");\n headGrad.addColorStop(.45, \"#201e1c\");\n headGrad.addColorStop(1, \"#121313\");\n fillPoly([[110, 380], [585, 329], [647, 635], [147, 702]], headGrad, \"#151515\", 6);\n ctx.restore();\n\n // Headboard panels\n for (let i = 0; i < 5; i++) {\n const ax = 133 + i * 93;\n ctx.beginPath();\n ctx.moveTo(ax, 403 - i * 10);\n ctx.lineTo(ax + 77, 395 - i * 10);\n ctx.lineTo(ax + 95, 620 - i * 3);\n ctx.lineTo(ax + 11, 632 - i * 3);\n ctx.closePath();\n const pg = ctx.createLinearGradient(ax, 400, ax + 90, 630);\n pg.addColorStop(0, \"#3b3530\");\n pg.addColorStop(.55, \"#282421\");\n pg.addColorStop(1, \"#171716\");\n ctx.fillStyle = pg;\n ctx.fill();\n ctx.strokeStyle = \"rgba(5,5,5,.48)\";\n ctx.lineWidth = 4;\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(ax + 8, 412 - i * 10);\n ctx.lineTo(ax + 72, 405 - i * 10);\n ctx.strokeStyle = \"rgba(255,234,200,.08)\";\n ctx.lineWidth = 2;\n ctx.stroke();\n }\n\n // Bed frame under mattress\n const frameGrad = ctx.createLinearGradient(0, 690, 0, 915);\n frameGrad.addColorStop(0, \"#372f29\");\n frameGrad.addColorStop(.25, \"#29231f\");\n frameGrad.addColorStop(1, \"#151514\");\n fillPoly([[145, 645], [623, 573], [947, 760], [950, 844], [281, 948], [145, 773]],\n frameGrad, \"#141313\", 5);\n\n // Side rail highlight\n fillPoly([[278, 834], [949, 747], [950, 792], [283, 894]],\n \"#241f1c\", \"rgba(7,7,7,.6)\", 3);\n ctx.beginPath();\n ctx.moveTo(286, 842);\n ctx.lineTo(940, 759);\n ctx.strokeStyle = \"rgba(225,190,146,.13)\";\n ctx.lineWidth = 3;\n ctx.stroke();\n\n // Legs\n fillPoly([[194, 814], [245, 819], [241, 954], [204, 969]], \"#171615\");\n fillPoly([[884, 806], [929, 798], [922, 913], [890, 920]], \"#111212\");\n\n // Mattress base\n ctx.save();\n ctx.shadowColor = \"rgba(0,0,0,.36)\";\n ctx.shadowBlur = 11;\n ctx.shadowOffsetY = 10;\n const mattressSide = ctx.createLinearGradient(0, 660, 0, 820);\n mattressSide.addColorStop(0, \"#d8d5ca\");\n mattressSide.addColorStop(.45, \"#aaa99f\");\n mattressSide.addColorStop(1, \"#74766f\");\n fillPoly([[145, 579], [605, 515], [943, 701], [930, 773], [277, 865], [145, 704]],\n mattressSide, \"#676963\", 3);\n ctx.restore();\n\n // Mattress seam\n ctx.beginPath();\n ctx.moveTo(277, 838);\n ctx.lineTo(929, 748);\n ctx.strokeStyle = \"rgba(66,67,63,.55)\";\n ctx.lineWidth = 4;\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(286, 829);\n ctx.lineTo(924, 741);\n ctx.strokeStyle = \"rgba(255,255,244,.45)\";\n ctx.lineWidth = 2;\n ctx.stroke();\n\n // Lower white sheet peeking out\n const sheetGrad = ctx.createLinearGradient(0, 570, 0, 800);\n sheetGrad.addColorStop(0, \"#f1f0e8\");\n sheetGrad.addColorStop(1, \"#bfc3be\");\n ctx.beginPath();\n ctx.moveTo(154, 569);\n ctx.bezierCurveTo(300, 536, 476, 521, 614, 511);\n ctx.lineTo(937, 691);\n ctx.bezierCurveTo(785, 709, 608, 728, 455, 752);\n ctx.bezierCurveTo(340, 771, 264, 790, 180, 757);\n ctx.closePath();\n ctx.fillStyle = sheetGrad;\n ctx.fill();\n\n // Main blue duvet\n ctx.save();\n ctx.shadowColor = \"rgba(5,15,24,.42)\";\n ctx.shadowBlur = 14;\n ctx.shadowOffsetY = 8;\n const duvet = ctx.createLinearGradient(130, 480, 870, 870);\n duvet.addColorStop(0, \"#376e99\");\n duvet.addColorStop(.25, \"#245b86\");\n duvet.addColorStop(.57, \"#17496f\");\n duvet.addColorStop(.82, \"#113b5c\");\n duvet.addColorStop(1, \"#092a43\");\n ctx.beginPath();\n ctx.moveTo(165, 553);\n ctx.bezierCurveTo(270, 518, 405, 496, 537, 495);\n ctx.bezierCurveTo(574, 496, 604, 503, 631, 519);\n ctx.bezierCurveTo(726, 570, 817, 627, 918, 683);\n ctx.bezierCurveTo(942, 696, 948, 718, 934, 741);\n ctx.bezierCurveTo(894, 784, 876, 823, 858, 873);\n ctx.bezierCurveTo(799, 868, 734, 873, 669, 884);\n ctx.bezierCurveTo(545, 904, 424, 929, 294, 921);\n ctx.bezierCurveTo(259, 918, 235, 903, 229, 880);\n ctx.bezierCurveTo(219, 840, 214, 801, 191, 758);\n ctx.bezierCurveTo(169, 715, 137, 680, 137, 630);\n ctx.bezierCurveTo(138, 594, 144, 569, 165, 553);\n ctx.closePath();\n ctx.fillStyle = duvet;\n ctx.fill();\n ctx.restore();\n\n // Fold shadows and highlights\n const folds = [\n { p: [198, 566, 270, 646, 249, 777, 294, 910], dark: .28, w: 32 },\n { p: [304, 531, 365, 620, 354, 763, 393, 909], dark: .24, w: 40 },\n { p: [436, 511, 472, 619, 472, 752, 505, 891], dark: .28, w: 38 },\n { p: [559, 512, 583, 614, 600, 748, 622, 888], dark: .25, w: 44 },\n { p: [650, 544, 693, 641, 723, 752, 743, 868], dark: .32, w: 42 },\n { p: [750, 598, 792, 663, 839, 739, 847, 844], dark: .25, w: 34 }\n ];\n for (const f of folds) {\n ctx.beginPath();\n ctx.moveTo(f.p[0], f.p[1]);\n ctx.bezierCurveTo(...f.p.slice(2));\n ctx.strokeStyle = `rgba(4,24,40,${f.dark})`;\n ctx.lineWidth = f.w;\n ctx.lineCap = \"round\";\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(f.p[0] - 8, f.p[1] - 4);\n ctx.bezierCurveTo(\n f.p[2] - 10, f.p[3] - 8,\n f.p[4] - 11, f.p[5] - 8,\n f.p[6] - 13, f.p[7] - 7\n );\n ctx.strokeStyle = \"rgba(134,196,228,.12)\";\n ctx.lineWidth = Math.max(5, f.w * .22);\n ctx.stroke();\n }\n\n // Horizontal rumples\n for (let i = 0; i < 9; i++) {\n const y = 630 + i * 29;\n const x = 245 + rnd() * 300;\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.bezierCurveTo(x + 35, y - 10, x + 75, y + 14, x + 125 + rnd() * 80, y - 3);\n ctx.strokeStyle = `rgba(136,197,228,${.055 + rnd() * .055})`;\n ctx.lineWidth = 3 + rnd() * 4;\n ctx.lineCap = \"round\";\n ctx.stroke();\n }\n\n // Folded top edge of duvet\n const cuff = ctx.createLinearGradient(0, 475, 0, 610);\n cuff.addColorStop(0, \"#4b82a9\");\n cuff.addColorStop(.48, \"#316c98\");\n cuff.addColorStop(1, \"#184b72\");\n ctx.beginPath();\n ctx.moveTo(158, 542);\n ctx.bezierCurveTo(289, 510, 431, 487, 545, 490);\n ctx.bezierCurveTo(589, 491, 616, 506, 650, 529);\n ctx.lineTo(619, 590);\n ctx.bezierCurveTo(558, 555, 481, 551, 399, 562);\n ctx.bezierCurveTo(306, 574, 238, 596, 170, 607);\n ctx.bezierCurveTo(147, 588, 145, 562, 158, 542);\n ctx.closePath();\n ctx.fillStyle = cuff;\n ctx.fill();\n ctx.strokeStyle = \"rgba(7,37,57,.42)\";\n ctx.lineWidth = 3;\n ctx.stroke();\n\n // Pillows\n function pillow(points, c1, c2) {\n ctx.save();\n ctx.shadowColor = \"rgba(3,16,25,.55)\";\n ctx.shadowBlur = 15;\n ctx.shadowOffsetY = 9;\n const g = ctx.createLinearGradient(points[0][0], points[0][1], points[2][0], points[2][1]);\n g.addColorStop(0, c1);\n g.addColorStop(.55, c2);\n g.addColorStop(1, \"#173f5d\");\n ctx.beginPath();\n ctx.moveTo(...points[0]);\n ctx.bezierCurveTo(...points[1], ...points[2], ...points[3]);\n ctx.bezierCurveTo(...points[4], ...points[5], ...points[6]);\n ctx.bezierCurveTo(...points[7], ...points[8], ...points[9]);\n ctx.bezierCurveTo(...points[10], ...points[11], ...points[0]);\n ctx.closePath();\n ctx.fillStyle = g;\n ctx.fill();\n ctx.restore();\n ctx.strokeStyle = \"rgba(165,208,227,.18)\";\n ctx.lineWidth = 3;\n ctx.stroke();\n }\n\n pillow([\n [173, 482],\n [183, 443], [215, 416], [267, 411],\n [326, 406], [374, 430], [385, 477],\n [388, 508], [355, 534], [285, 543],\n [221, 551], [176, 529]\n ], \"#5b8eac\", \"#316b91\");\n\n pillow([\n [359, 443],\n [377, 403], [417, 380], [478, 380],\n [536, 378], [582, 405], [595, 449],\n [603, 481], [569, 511], [499, 519],\n [429, 526], [373, 499]\n ], \"#4f84a6\", \"#285e85\");\n\n // Pillow creases\n ctx.strokeStyle = \"rgba(9,43,64,.3)\";\n ctx.lineWidth = 7;\n ctx.lineCap = \"round\";\n [[210,474,277,454,352,480], [402,449,476,424,568,459]].forEach(a => {\n ctx.beginPath();\n ctx.moveTo(a[0], a[1]);\n ctx.quadraticCurveTo(a[2], a[3], a[4], a[5]);\n ctx.stroke();\n });\n\n // Duvet front edge stitching\n ctx.beginPath();\n ctx.moveTo(294, 903);\n ctx.bezierCurveTo(450, 911, 656, 855, 847, 854);\n ctx.strokeStyle = \"rgba(116,180,214,.23)\";\n ctx.lineWidth = 3;\n ctx.setLineDash([10, 8]);\n ctx.stroke();\n ctx.setLineDash([]);\n\n // Ambient occlusion near wall and vignette\n const bottomShade = ctx.createLinearGradient(0, 650, 0, 1024);\n bottomShade.addColorStop(0, \"rgba(0,0,0,0)\");\n bottomShade.addColorStop(1, \"rgba(0,0,0,.20)\");\n ctx.fillStyle = bottomShade;\n ctx.fillRect(0, 600, W, 424);\n\n const vignette = ctx.createRadialGradient(485, 440, 260, 512, 500, 750);\n vignette.addColorStop(0, \"rgba(0,0,0,0)\");\n vignette.addColorStop(.72, \"rgba(0,0,0,.06)\");\n vignette.addColorStop(1, \"rgba(0,0,0,.47)\");\n ctx.fillStyle = vignette;\n ctx.fillRect(0, 0, W, H);\n\n // Fine photographic grain\n const grain = document.createElement(\"canvas\");\n grain.width = 256;\n grain.height = 256;\n const gctx = grain.getContext(\"2d\");\n const img = gctx.createImageData(256, 256);\n for (let i = 0; i < img.data.length; i += 4) {\n const v = Math.floor(rnd() * 256);\n img.data[i] = v;\n img.data[i + 1] = v;\n img.data[i + 2] = v;\n img.data[i + 3] = 12;\n }\n gctx.putImageData(img, 0, 0);\n ctx.save();\n ctx.globalCompositeOperation = \"soft-light\";\n ctx.globalAlpha = .25;\n ctx.fillStyle = ctx.createPattern(grain, \"repeat\");\n ctx.fillRect(0, 0, W, H);\n ctx.restore();\n}"}], "metadata": {"id": "val-v1-coco-train2017-000000526675-272821", "teacher": "gpt-5.6-sol", "sft_sequence_tokens": 7118, "code_sha256": "a4e8f38f5c255ab07326f4283864a120a03a9f1fcb9650bb7ae2660b3271d2b1"}}
{"messages": [{"role": "system", "content": "Write JavaScript that renders the described image as realistically as possible. Define `async function render(stage)` where `stage` is an empty 512x512 DOM element already on the page - build whatever you need inside it. Do not call any AI image-generation or text-to-image service. Reply with only the code, no explanation."}, {"role": "user", "content": "four navy deer to the left of six yellow hawks"}, {"role": "assistant", "content": "async function render(stage) {\n stage.replaceChildren();\n Object.assign(stage.style, {\n width: \"512px\",\n height: \"512px\",\n position: \"relative\",\n overflow: \"hidden\",\n background: \"#faf8f0\"\n });\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 512 512\");\n svg.setAttribute(\"width\", \"512\");\n svg.setAttribute(\"height\", \"512\");\n svg.setAttribute(\"role\", \"img\");\n svg.setAttribute(\"aria-label\", \"Four navy deer to the left of six yellow hawks\");\n\n svg.innerHTML = `\n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n \n\n \n \n\n \n \n \n\n \n \n \n \n\n \n \n \n\n \n \n \n\n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n\n \n \n\n \n \n\n \n \n\n \n \n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n \n \n \n \n \n\n \n