localharness 0.78.0

Agents that own themselves: one Rust crate that's both an agent SDK (streaming, tools, hooks, policies, triggers, MCP) and a wallet-owning, self-sovereign agent that runs in the browser.
Documentation
1
2
3
4
5
6
7
8
9
10
11
{
  "id": "115",
  "prompt": "Make a Simon clone: four colored quadrant pads. The game flashes a growing sequence (item i derived from hash(seed*97+i)%4 so nothing needs storing), each flash plays its note via host::audio::tone, then I repeat it by tapping pads. A wrong pad buzzes and ends the game showing the level reached; tapping restarts with a fresh seed. Drive the SHOW/INPUT/OVER phases from a state slot.",
  "solution_rl": "fn hash(seed: i32) -> i32 {\n    let mut h: i32 = seed * 747796405 + 2891336453;\n    h = (h >> 16) ^ h;\n    if h < 0 { h = 0 - h; }\n    h\n}\n\nfn seq(seed: i32, i: i32) -> i32 {\n    hash(seed * 97 + i) % 4\n}\n\nfn pad_color(q: i32, lit: i32) -> i32 {\n    match q {\n        0 => { if lit == 1 { 0xff6666 } else { 0x701818 } }\n        1 => { if lit == 1 { 0x66ff66 } else { 0x187018 } }\n        2 => { if lit == 1 { 0x6688ff } else { 0x182070 } }\n        _ => { if lit == 1 { 0xffee66 } else { 0x706818 } }\n    }\n}\n\nfn frame(t: i32) {\n    let w: i32 = host::display::width();\n    let h: i32 = host::display::height();\n    if host::display::state_get(0) == 0 {\n        host::display::state_set(0, 1);\n        host::display::state_set(1, 1);\n        host::display::state_set(2, 0);\n        host::display::state_set(3, 0);\n        host::display::state_set(4, 0);\n        host::display::state_set(5, 0);\n        host::display::state_set(7, 1);\n    }\n    let down: i32 = host::display::pointer_down();\n    let tap: bool = down == 1 && host::display::state_get(6) == 0;\n    host::display::state_set(6, down);\n    let level: i32 = host::display::state_get(1);\n    let phase: i32 = host::display::state_get(2);\n    let sd: i32 = host::display::state_get(7);\n    let tones = [262, 330, 392, 523];\n    let mut lit: i32 = -1;\n    if phase == 0 {\n        let idx: i32 = host::display::state_get(3);\n        let timer: i32 = host::display::state_get(4);\n        if timer == 0 {\n            host::audio::tone(tones[seq(sd, idx)], 200, 0);\n        }\n        if timer < 24 { lit = seq(sd, idx); }\n        if timer >= 36 {\n            host::display::state_set(4, 0);\n            if idx + 1 >= level {\n                host::display::state_set(2, 1);\n                host::display::state_set(5, 0);\n            } else {\n                host::display::state_set(3, idx + 1);\n            }\n        } else {\n            host::display::state_set(4, timer + 1);\n        }\n    } else if phase == 1 {\n        if tap {\n            let mut q: i32 = 0;\n            if host::display::pointer_x() >= w / 2 { q = 1; }\n            if host::display::pointer_y() >= h / 2 { q = q + 2; }\n            let ii: i32 = host::display::state_get(5);\n            if q == seq(sd, ii) {\n                host::audio::tone(tones[q], 150, 0);\n                if ii + 1 >= level {\n                    host::display::state_set(1, level + 1);\n                    host::display::state_set(2, 0);\n                    host::display::state_set(3, 0);\n                    host::display::state_set(4, 0);\n                } else {\n                    host::display::state_set(5, ii + 1);\n                }\n            } else {\n                host::audio::tone(110, 500, 1);\n                host::display::state_set(2, 2);\n            }\n        }\n    } else {\n        if tap {\n            host::display::state_set(7, sd + 1);\n            host::display::state_set(1, 1);\n            host::display::state_set(2, 0);\n            host::display::state_set(3, 0);\n            host::display::state_set(4, 0);\n        }\n    }\n    host::display::clear(0x000000);\n    if phase == 2 {\n        host::display::draw_string(130, 190, \"GAME OVER\", 0xff4040, 4);\n        host::display::draw_string(130, 260, \"YOU REACHED LEVEL\", 0x808080, 2);\n        host::display::draw_number(410, 254, level, 0xffffff, 3);\n        host::display::draw_string(140, 320, \"TAP TO RESTART\", 0x808080, 2);\n    } else {\n        let mut q: i32 = 0;\n        while q < 4 {\n            let mut on: i32 = 0;\n            if q == lit { on = 1; }\n            let qx: i32 = (q % 2) * (w / 2);\n            let qy: i32 = (q / 2) * (h / 2);\n            host::display::fill_rect(qx + 8, qy + 8, w / 2 - 16, h / 2 - 16, pad_color(q, on));\n            q = q + 1;\n        }\n        host::display::draw_number(w / 2 - 10, h / 2 - 12, level, 0xffffff, 3);\n        if phase == 1 {\n            host::display::draw_string(w / 2 - 40, h / 2 + 20, \"YOUR TURN\", 0xffffff, 1);\n        }\n    }\n    host::display::present();\n}\n",
  "tags": [
    "game",
    "state",
    "audio",
    "prng"
  ]
}