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": "125",
  "prompt": "Higher-or-lower card game: a big number 1..9 sits on a card; I tap the top half of the screen for HIGHER or the bottom for LOWER, and the next number comes from an LCG hash (ties count as correct). Right calls grow a streak with the best kept across games in a state slot; a wrong call shows what came up, the streak and the best, then a tap deals again.",
  "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, 1 + hash(999) % 9);\n        host::display::state_set(2, 0);\n        host::display::state_set(4, 0);\n        host::display::state_set(6, 1);\n    }\n    let down: i32 = host::display::pointer_down();\n    let tap: bool = down == 1 && host::display::state_get(5) == 0;\n    host::display::state_set(5, down);\n    let cur: i32 = host::display::state_get(1);\n    if host::display::state_get(4) == 1 {\n        host::display::clear(0x180808);\n        host::display::draw_string(120, 150, \"WRONG CALL\", 0xff4040, 4);\n        host::display::draw_string(120, 210, \"IT CAME UP\", 0x808080, 2);\n        host::display::draw_number(330, 200, cur, 0xffffff, 4);\n        host::display::draw_string(120, 270, \"STREAK\", 0x808080, 2);\n        host::display::draw_number(250, 264, host::display::state_get(2), 0xffffff, 3);\n        host::display::draw_string(120, 304, \"BEST\", 0x808080, 2);\n        host::display::draw_number(250, 298, host::display::state_get(3), 0x00ff88, 3);\n        host::display::draw_string(130, 370, \"TAP TO DEAL AGAIN\", 0x808080, 2);\n        if tap {\n            host::display::state_set(0, 0);\n        }\n    } else {\n        if tap {\n            let mut up: i32 = 0;\n            if host::display::pointer_y() < h / 2 { up = 1; }\n            let rnd: i32 = host::display::state_get(6);\n            host::display::state_set(6, rnd + 1);\n            let next: i32 = 1 + hash(rnd * 7 + 3) % 9;\n            let mut correct: i32 = 0;\n            if next == cur { correct = 1; }\n            if next > cur && up == 1 { correct = 1; }\n            if next < cur && up == 0 { correct = 1; }\n            host::display::state_set(1, next);\n            if correct == 1 {\n                let s: i32 = host::display::state_get(2) + 1;\n                host::display::state_set(2, s);\n                if s > host::display::state_get(3) {\n                    host::display::state_set(3, s);\n                }\n            } else {\n                host::display::state_set(4, 1);\n            }\n        }\n        host::display::clear(0x0a1220);\n        host::display::fill_rect(0, 0, w, h / 2, 0x122036);\n        host::display::draw_string(w / 2 - 60, 40, \"HIGHER\", 0x6688aa, 3);\n        host::display::draw_string(w / 2 - 55, h - 70, \"LOWER\", 0x6688aa, 3);\n        host::display::fill_rect(w / 2 - 55, h / 2 - 75, 110, 150, 0xf0f0e8);\n        host::display::draw_number(w / 2 - 18, h / 2 - 30, cur, 0x101010, 8);\n        host::display::draw_string(8, 8, \"STREAK\", 0x808080, 2);\n        host::display::draw_number(130, 8, host::display::state_get(2), 0xffffff, 2);\n        host::display::draw_string(w - 150, 8, \"BEST\", 0x808080, 2);\n        host::display::draw_number(w - 70, 8, host::display::state_get(3), 0x00ff88, 2);\n    }\n    host::display::present();\n}\n",
  "tags": [
    "game",
    "state",
    "prng",
    "ui"
  ]
}