{
"id": "287",
"prompt": "An owner-gated control room: host::agent::viewer_is_owner() is 1 only on the device that actually owns this subdomain, so branch the WHOLE interface on it - owners get a red console header and a PING SUBSCRIBERS button that fires broadcast() with a brief SENT flash, visitors get a neutral header and a line saying the admin tools are hidden. Both faces show the subscriber count. Note the platform does NOT owner-gate broadcast itself; this gate is app policy.",
"solution_rl": "fn frame(t: i32) {\n host::display::clear(0x0e0e12);\n let own: i32 = host::agent::viewer_is_owner();\n let count: i32 = host::agent::subscriber_count();\n\n if own == 1 {\n host::display::fill_rect(0, 0, 512, 50, 0x5c1a1a);\n host::display::draw_string(20, 16, \"OWNER CONSOLE\", 0xffffff, 2);\n host::display::fill_rect(96, 180, 320, 90, 0xdddddd);\n host::display::draw_string(140, 212, \"PING SUBSCRIBERS\", 0x000000, 2);\n host::display::draw_string(96, 320, \"THIS BUTTON ONLY RENDERS FOR\", 0x777777, 1);\n host::display::draw_string(96, 336, \"THE DEVICE THAT OWNS THE NAME\", 0x777777, 1);\n let flash: i32 = host::display::state_get(1);\n if flash > 0 {\n host::display::draw_string(200, 300, \"SENT\", 0x22bb44, 2);\n host::display::state_set(1, flash - 1);\n }\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 if down == 1 && prev == 0 {\n let px: i32 = host::display::pointer_x();\n let py: i32 = host::display::pointer_y();\n if px >= 96 && px < 416 && py >= 180 && py < 270 {\n host::agent::broadcast(\"Owner ping\", \"The owner waved at the feed.\");\n host::display::state_set(1, 40);\n }\n }\n } else {\n host::display::fill_rect(0, 0, 512, 50, 0x1a2430);\n host::display::draw_string(20, 16, \"VISITOR VIEW\", 0x8899aa, 2);\n host::display::draw_string(96, 220, \"ADMIN TOOLS ARE HIDDEN\", 0x666677, 2);\n }\n host::display::draw_string(20, 470, \"SUBSCRIBERS\", 0x556677, 1);\n host::display::draw_number(120, 466, count, 0xffffff, 2);\n host::display::present();\n}\n",
"tags": [
"agent",
"owner-gate",
"broadcast"
]
}