{
"id": "057",
"prompt": "Draw a slowly rotating galaxy-style spiral of 48 dots: dot i sits at angle t/2 + i*5 (indices into a 32-entry integer sine table, cos = +8 offset) and radius i*rmax/48, so the chain sweeps outward from the center. Dots get brighter toward the rim (grayscale built as g*65536 + g*256 + g).",
"solution_rl": "fn frame(t: i32) {\n let tab = [0, 25, 49, 71, 90, 106, 117, 124, 127, 124, 117, 106, 90, 71, 49, 25, 0, -25, -49, -71, -90, -106, -117, -124, -127, -124, -117, -106, -90, -71, -49, -25];\n let w: i32 = host::display::width();\n let h: i32 = host::display::height();\n let cx: i32 = w / 2;\n let cy: i32 = h / 2;\n let rmax: i32 = if w < h { w / 2 - 8 } else { h / 2 - 8 };\n host::display::clear(0x000000);\n let mut i: i32 = 0;\n while i < 48 {\n let r: i32 = i * rmax / 48;\n let a: i32 = (t / 2 + i * 5) & 31;\n let x: i32 = cx + tab[a] * r / 127;\n let y: i32 = cy + tab[(a + 8) & 31] * r / 127;\n let g: i32 = 60 + i * 4;\n host::display::fill_rect(x - 1, y - 1, 3, 3, g * 65536 + g * 256 + g);\n i = i + 1;\n }\n host::display::present();\n}\n",
"tags": [
"trig-table",
"motion-path",
"loops"
]
}