{
"id": "290",
"prompt": "An announcements kiosk with two faces: the owner (viewer_is_owner) sees an ANNOUNCE button that opens the host's composer via broadcast_compose - a cartridge is pixels-only and cannot summon a keyboard, so the host overlays a text input prefilled with my default message - while everyone else sees a GET UPDATES subscribe toggle and a note that only the owner can announce. Subscriber count near the top on both faces; taps edge-detected.",
"solution_rl": "fn frame(t: i32) {\n host::display::clear(0x101216);\n let own: i32 = host::agent::viewer_is_owner();\n let subbed: i32 = host::agent::is_subscribed();\n let down: i32 = host::display::pointer_down();\n let prev: i32 = host::display::state_get(0);\n host::display::state_set(0, down);\n let mut click: i32 = 0;\n if down == 1 && prev == 0 {\n click = 1;\n }\n let px: i32 = host::display::pointer_x();\n let py: i32 = host::display::pointer_y();\n\n host::display::draw_string(140, 40, \"ANNOUNCEMENTS\", 0xffffff, 2);\n host::display::draw_string(150, 90, \"SUBSCRIBERS\", 0x556677, 1);\n host::display::draw_number(250, 86, host::agent::subscriber_count(), 0xffffff, 2);\n\n if own == 1 {\n host::display::fill_rect(106, 160, 300, 100, 0xdddddd);\n host::display::draw_string(158, 196, \"ANNOUNCE...\", 0x000000, 2);\n host::display::draw_string(106, 290, \"OPENS THE HOST COMPOSER SO YOU\", 0x666677, 1);\n host::display::draw_string(106, 304, \"CAN TYPE THE MESSAGE FIRST\", 0x666677, 1);\n if click == 1 && px >= 106 && px < 406 && py >= 160 && py < 260 {\n host::agent::broadcast_compose(\"Announcement\", \"Something new just shipped.\");\n }\n } else {\n let mut col: i32 = 0x222a33;\n if subbed == 1 {\n col = 0x1a5c2a;\n }\n host::display::fill_rect(106, 160, 300, 100, col);\n if subbed == 1 {\n host::display::draw_string(126, 196, \"GETTING UPDATES\", 0x99ffbb, 2);\n } else {\n host::display::draw_string(146, 196, \"GET UPDATES\", 0xffffff, 2);\n }\n host::display::draw_string(106, 290, \"ONLY THE OWNER CAN ANNOUNCE\", 0x666677, 1);\n if click == 1 && px >= 106 && px < 406 && py >= 160 && py < 260 {\n if subbed == 1 {\n host::agent::unsubscribe();\n } else {\n host::agent::subscribe();\n }\n }\n }\n host::display::present();\n}\n",
"tags": [
"agent",
"broadcast-compose",
"owner-gate"
]
}