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": "134",
  "prompt": "Color-word matching game: a color name (RED/GREEN/BLUE/GOLD/PINK/TEAL picked by a match on the hashed target index) appears above three swatches from a 6-color palette array, only one of which is right - the decoy offsets come from the hash too. Tap the right swatch before the 120-frame bar drains; wrong taps and timeouts burn one of 3 strikes drawn as X glyphs with draw_char(x, y, code, rgb, scale). Third strike is game over with a 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    let pal = [0xff4455, 0x44cc66, 0x4477ff, 0xffcc22, 0xcc55ee, 0x22cccc];\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, 120);\n        host::display::state_set(3, 0);\n        host::display::state_set(4, 3);\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(0x101018);\n        host::display::draw_string(120, 180, \"COLOR BLIND\", 0xff4040, 4);\n        host::display::draw_string(140, 250, \"MATCHED\", 0x808080, 2);\n        host::display::draw_number(300, 244, host::display::state_get(3), 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 round: i32 = host::display::state_get(1);\n        let target: i32 = hash(round * 17) % 6;\n        let cpos: i32 = hash(round * 7) % 3;\n        let o1: i32 = 1 + hash(round * 3) % 5;\n        let mut o2: i32 = 1 + hash(round * 5) % 5;\n        if o2 == o1 { o2 = (o1 % 5) + 1; }\n        let mut timer: i32 = host::display::state_get(2) - 1;\n        let mut wrong: i32 = 0;\n        let mut next: i32 = 0;\n        if timer <= 0 { wrong = 1; }\n        if tap {\n            let px: i32 = host::display::pointer_x();\n            let py: i32 = host::display::pointer_y();\n            if py >= 300 && py < 390 && px >= 30 {\n                let b: i32 = (px - 30) / 155;\n                if b >= 0 && b < 3 && px - 30 - b * 155 < 140 {\n                    if b == cpos {\n                        host::display::state_set(3, host::display::state_get(3) + 1);\n                        next = 1;\n                    } else {\n                        wrong = 1;\n                    }\n                }\n            }\n        }\n        if wrong == 1 {\n            let lives: i32 = host::display::state_get(4) - 1;\n            host::display::state_set(4, lives);\n            if lives <= 0 { host::display::state_set(5, 1); }\n            next = 1;\n        }\n        if next == 1 {\n            host::display::state_set(1, round + 1);\n            timer = 120;\n        }\n        host::display::state_set(2, timer);\n        host::display::clear(0x14141c);\n        host::display::draw_string(60, 60, \"TAP THE SWATCH NAMED\", 0x808080, 2);\n        match target {\n            0 => { host::display::draw_string(200, 120, \"RED\", 0xffffff, 5); }\n            1 => { host::display::draw_string(170, 120, \"GREEN\", 0xffffff, 5); }\n            2 => { host::display::draw_string(180, 120, \"BLUE\", 0xffffff, 5); }\n            3 => { host::display::draw_string(180, 120, \"GOLD\", 0xffffff, 5); }\n            4 => { host::display::draw_string(180, 120, \"PINK\", 0xffffff, 5); }\n            _ => { host::display::draw_string(180, 120, \"TEAL\", 0xffffff, 5); }\n        }\n        let mut b2: i32 = 0;\n        while b2 < 3 {\n            let mut ci: i32 = target;\n            if b2 != cpos {\n                if b2 == (cpos + 1) % 3 {\n                    ci = (target + o1) % 6;\n                } else {\n                    ci = (target + o2) % 6;\n                }\n            }\n            host::display::fill_rect(30 + b2 * 155, 300, 140, 90, pal[ci]);\n            b2 = b2 + 1;\n        }\n        host::display::fill_rect(0, h - 14, timer * w / 120, 8, 0xffffff);\n        let mut miss: i32 = 3 - host::display::state_get(4);\n        let mut k: i32 = 0;\n        while k < miss {\n            host::display::draw_char(w - 30 - k * 26, 20, 88, 0xff4455, 3);\n            k = k + 1;\n        }\n        host::display::draw_number(16, 20, host::display::state_get(3), 0xffffff, 3);\n    }\n    host::display::present();\n}\n",
  "tags": [
    "game",
    "state",
    "match",
    "prng"
  ]
}