{
"id": "070",
"prompt": "Old-school demo sine scroller: the letters of \"RUSTLITE\" march right-to-left across the middle of the screen (wrapping around), each letter bobbing on its own sine offset so the word ripples like a wave. draw_string can't place letters individually, so put the char codes in an array and draw_char each one at scale 3 with a 16-entry sine-table y offset.",
"solution_rl": "fn frame(t: i32) {\n let tab = [0, 49, 90, 117, 127, 117, 90, 49, 0, -49, -90, -117, -127, -117, -90, -49];\n let text = [82, 85, 83, 84, 76, 73, 84, 69];\n let w: i32 = host::display::width();\n let h: i32 = host::display::height();\n let cw: i32 = 26;\n let total: i32 = w + 8 * cw;\n host::display::clear(0x000010);\n let scroll: i32 = t * 2 % total;\n let mut i: i32 = 0;\n while i < 8 {\n let x: i32 = w - scroll + i * cw;\n let y: i32 = h / 2 - 12 + tab[(t / 2 + i * 3) & 15] * 24 / 127;\n host::display::draw_char(x, y, text[i], 0x00ffaa, 3);\n i = i + 1;\n }\n host::display::present();\n}\n",
"tags": [
"trig-table",
"animation",
"arrays",
"display"
]
}