{
"id": "198",
"prompt": "An error-bar chart of five measurements, fully deterministic with no state: an LCG hash of the sample index yields each mean (30..70) and spread (5..20); draw a dot at every mean, a vertical whisker from mean-spread to mean+spread with horizontal end caps, a baseline axis and 1..5 labels.",
"solution_rl": "fn hv(i: i32) -> i32 {\n let s: i32 = i * 1103515245 + 12345;\n (s >> 16) & 32767\n}\n\nfn frame(t: i32) {\n let w: i32 = host::display::width();\n let h: i32 = host::display::height();\n host::display::clear(0x0b0b0b);\n let base: i32 = h - 50;\n let mut i: i32 = 0;\n while i < 5 {\n let mean: i32 = hv(i * 2) % 41 + 30;\n let spread: i32 = hv(i * 2 + 1) % 16 + 5;\n let x: i32 = 40 + i * (w - 80) / 4;\n let ylo: i32 = base - (mean - spread) * 3;\n let yhi: i32 = base - (mean + spread) * 3;\n host::display::draw_line(x, ylo, x, yhi, 0x909090);\n host::display::draw_line(x - 6, ylo, x + 6, ylo, 0x909090);\n host::display::draw_line(x - 6, yhi, x + 6, yhi, 0x909090);\n host::display::fill_rect(x - 3, base - mean * 3 - 3, 7, 7, 0x40c0ff);\n host::display::draw_number(x - 4, base + 10, i + 1, 0x808080, 2);\n i = i + 1;\n }\n host::display::draw_line(20, base, w - 20, base, 0x606060);\n host::display::draw_string(20, 12, \"MEAN + SPREAD\", 0x808080, 1);\n host::display::present();\n}\n",
"tags": [
"chart",
"prng",
"draw_line"
]
}