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": "117",
  "prompt": "Whack-a-mole on a 3x3 grid with a 30-second clock (1800 frames counting down in a state slot). The mole hops to a new hole every 45 frames or when whacked (hole index from an LCG hash of the round), each hit beeps and scores, and when time runs out I get a final tally and tap-to-restart.",
  "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 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, 1800);\n        host::display::state_set(2, 0);\n        host::display::state_set(3, 1);\n        host::display::state_set(4, 0);\n        host::display::state_set(5, 0);\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    if host::display::state_get(5) == 1 {\n        host::display::clear(0x101010);\n        host::display::draw_string(170, 170, \"TIME UP\", 0xffaa00, 4);\n        host::display::draw_string(150, 240, \"MOLES HIT\", 0x808080, 2);\n        host::display::draw_number(330, 234, host::display::state_get(2), 0xffffff, 3);\n        host::display::draw_string(140, 320, \"TAP TO RESTART\", 0x808080, 2);\n        if tap { host::display::state_set(0, 0); }\n    } else {\n        let mut left: i32 = host::display::state_get(1) - 1;\n        if left <= 0 {\n            left = 0;\n            host::display::state_set(5, 1);\n        }\n        host::display::state_set(1, left);\n        let mut round: i32 = host::display::state_get(3);\n        let mut mt: i32 = host::display::state_get(4) + 1;\n        if mt >= 45 {\n            mt = 0;\n            round = round + 1;\n        }\n        let mole: i32 = hash(round) % 9;\n        let mx: i32 = 76 + (mole % 3) * 120;\n        let my: i32 = 120 + (mole / 3) * 120;\n        if tap {\n            let px: i32 = host::display::pointer_x();\n            let py: i32 = host::display::pointer_y();\n            if px >= mx && px < mx + 110 && py >= my && py < my + 110 {\n                host::display::state_set(2, host::display::state_get(2) + 1);\n                host::audio::tone(880, 60, 1);\n                round = round + 1;\n                mt = 0;\n            }\n        }\n        host::display::state_set(3, round);\n        host::display::state_set(4, mt);\n        host::display::clear(0x0c1408);\n        let mut c: i32 = 0;\n        while c < 9 {\n            let cx: i32 = 76 + (c % 3) * 120;\n            let cy: i32 = 120 + (c / 3) * 120;\n            host::display::fill_rect(cx, cy, 110, 110, 0x1c2c14);\n            if c == mole {\n                host::display::fill_rect(cx + 15, cy + 25, 80, 70, 0xcc8833);\n                host::display::fill_rect(cx + 32, cy + 45, 12, 12, 0x000000);\n                host::display::fill_rect(cx + 64, cy + 45, 12, 12, 0x000000);\n            }\n            c = c + 1;\n        }\n        host::display::draw_string(8, 10, \"TIME\", 0x808080, 2);\n        host::display::draw_number(90, 10, left / 60, 0xffffff, 2);\n        host::display::draw_string(w - 180, 10, \"HITS\", 0x808080, 2);\n        host::display::draw_number(w - 100, 10, host::display::state_get(2), 0x00ff88, 2);\n    }\n    host::display::present();\n}\n",
  "tags": [
    "game",
    "state",
    "prng",
    "audio"
  ]
}