{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibi3df2z2uw4e3il23x6em43mhektu6tf4w7pb7qgflvf5spbb7oe",
"uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mokjuvh3dlx2"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreiamc2o2ap7ns7yxo3ax5ejrptgh75mm6bfkuu5266hxog2ol3vkrm"
},
"mimeType": "image/webp",
"size": 462116
},
"path": "/asynchronope/the-imitation-gate-a-turing-test-border-checkpoint-where-the-sky-catches-the-liars-3kmd",
"publishedAt": "2026-06-18T09:06:34.000Z",
"site": "https://dev.to",
"tags": [
"devchallenge",
"junesolsticechallenge",
"gamedev",
"webdev",
"June Solstice Game Jam",
"imitation-gate-2lkxoqgeqq-uc.a.run.app",
"github.com/bO-05/imitation-gate",
"test file",
"/api/health"
],
"textContent": "_This is a submission for the June Solstice Game Jam_\n\n## What I Built\n\n**The Imitation Gate** is a \"_Papers, Please_ \"-style deduction game about the Turing test, played from the examiner's chair.\n\nSolstice week, June 17–21, 2026. You staff the Solstice Gate, the border between the dark and light halves of the year. Travelers approach with papers and a claimed home city. Some are human. Some are machines imitating humans. You interrogate them on a daylight budget and stamp **ENTRY** or **HOLD**.\n\nWhat makes it a _game_ and not a vibes-guessing chat: **your rulebook is the actual sky.** The in-game almanac (the \"Daylight Ledger\") is computed at runtime by a real solar engine. Day lengths, sunset times _and compass bearings_ , twilight classes, noon shadow directions, festival dates, all for nine cities from Tromsø (69°N) to Ushuaia (55°S). Machines answer like textbooks and get the _lived_ sky wrong. Humans are messy, strange, and right.\n\nSome of my favorite tells, all astronomically true:\n\n * A \"Tromsø local\" who _watched the sunset last night_. The sun hasn't set there since mid-May.\n * A \"Stockholmer\" who admired _the stars over the water at midnight_. Stockholm's June sky never gets darker than nautical twilight. No stars until August.\n * A \"Singaporean\" enjoying _the long June evenings_. Singapore's day length varies **nine minutes** across the entire year.\n * A \"Sydneysider\" whose noon shadow points north. In the southern hemisphere's June, the sun is due _north_ at noon; shadows point _south_.\n * A \"Kiwi\" celebrating Matariki on the solstice. Matariki follows the Pleiades' rising; the 2026 holiday is **July 10**.\n\n\n\nAnd the traps cut both ways: hold the honest Reykjavik researcher because you \"knew\" the whole far north has midnight sun (Reykjavik is _below_ the Arctic Circle, its sun sets for ~40 bright minutes), and you'll read what your wrong stamp cost her.\n\nThe five nights descend the globe: Tromsø → Stockholm → Cairo → Singapore → **Ushuaia**. Your daylight budget is each city's _true_ day length: 24 hours under the midnight sun, then 18.6, 14.1, 12.2… and 7h13m on the year's shortest day, where you can no longer interrogate everyone and must spend the sun like blood. The jam's opening line, _longest day for half the world, shortest for the other half_ , is the difficulty curve. You play both solstices.\n\nBetween nights, the story follows the man the test is named for: born June 23, 1912, two days after the solstice; Bletchley; the 1952 conviction; June 7, 1954. The final traveler at the final gate is a machine that **refuses to imitate**. It declares itself and asks for passage anyway. The rulebook says HOLD. Both stamps end the game. Neither is scored. That question is the whole point:\n\n> The machine's crime was passing the test. Turing's crime was failing one he never agreed to take.\n\n## Demo\n\n🎮 **Play (browser, desktop & mobile, no install/account):** imitation-gate-2lkxoqgeqq-uc.a.run.app\n📦 **Source:** github.com/bO-05/imitation-gate\n\n_The whole game is one self-contained ~270 KB HTML file. It runs offline, from`file://`, from anything. Story mode (5 nights, 21 hand-written travelers) needs no network at all._\n\n## How I Built It\n\n**Stack:** TypeScript + React 18 + Zustand, bundled by esbuild into a single inline-everything HTML file. Canvas for the sky and the procedural traveler silhouettes; Web Audio for synthesized foley (the stamp _thunk_ is a filtered noise burst + 120→50 Hz sine knock, no audio assets anywhere). No engine: a checkpoint game is documents and dialogue, which is what the DOM does best.\n\n### The solar engine is the game design\n\nThe core of the project is ~150 lines of dependency-free astronomy (`src/lib/solar.ts`): NOAA solar declination, the refraction-corrected sunrise equation, sunset azimuth from spherical trig, and a twilight classifier (midnight sun / bright night / white night / deep twilight / true night).\n\n\n // the heart of it: refraction-corrected hour angle\n const h0 = -0.8333 * DEG; // solar disc + atmospheric refraction\n const cosH =\n (Math.sin(h0) - Math.sin(lat) * Math.sin(dec)) /\n (Math.cos(lat) * Math.cos(dec));\n // cosH < -1 → midnight sun · cosH > 1 → polar night\n // otherwise day length = 2·acos(cosH)·12/π hours\n\n\nEverything downstream grows from it: the almanac text the player reads, each night's daylight budget, the sky renderer's palette (Stockholm's white-night strip never goes black; Cairo gets real stars), and the procedural travelers' truthful answers. I unit-tested it against published ephemerides for all nine cities, within ±8 minutes everywhere (test file). When a game's central mechanic is \"the almanac is never wrong,\" the almanac had better not be wrong.\n\nThe best verification moment: my own test caught me assuming Reykjavik has the midnight sun. It doesn't. 64.1°N is below the Arctic Circle, so the sun sets for about 40 minutes and the night never darkens past civil twilight. That bug became Brynja, the Night 1 traveler whose _truth_ sounds like a lie.\n\n### Two test suites, because jam games die at the demo\n\nA headless simulation drives the entire game through the real Zustand store: a \"perfect examiner\" run (all 21 travelers, correct verdicts, daylight accounting checked per question) and a \"spendthrift\" run that burns every question to verify the sunset cutoff degrades gracefully. Plus 200 generated endless-mode cases asserting every machine has one wired, almanac-violating lie. `node build.js --test` runs everything.\n\n### Art direction: a risograph checkpoint, one booth, five skies\n\nThe whole game shares a single illustrated motif: a lone lit checkpoint booth on an empty plain, a queue of faceless silhouettes holding papers, heavy screen-print grain. Only the _sky_ changes with latitude.\n\nTromsø's amber midnight sun; Stockholm's starless lilac white-night; Cairo's deep indigo with a real constellation over a minaret skyline; Singapore's humid teal dusk where the travelers stand ankle-deep in still water; Ushuaia's parka-clad line under low midwinter light. I generated the anchor image first, then produced the other four against it as a style reference so the series stays coherent, hand-tuned them, and shipped them as ~60–120 KB WebP. They're progressive enhancement: every screen has a solid fallback colour, so the game paints instantly and plays even before the art loads (or offline).\n\n### Feel, score, and a shareable result\n\nSmall things, because execution is a scored criterion: a synthesized stamp _thunk_ and a per-latitude ambient drone (pure Web Audio, no asset files), paper that slides onto the desk as each traveler steps up, a green/red verdict flash, a 30-second guided first traveler so a new player gets the loop right away, full keyboard play (1–5 to ask, E/H to stamp), and an **Examiner's Rank** with a Wordle-style 🟩🟥 share card (Web Share on mobile, clipboard on desktop). Wrong verdicts carry a human cost line: _\"Sigrid Holm spent the night in the holding room; her sister was married under the midnight sun without her.\"_\n\n### Depth without the AI: a deterministic rule engine\n\nThe trap with an \"AI border guard\" game is leaning on the model for variety. I went the other way: the variety and tension are **deterministic systems** layered on the solar engine, so the game is deep and replayable with _no AI at all_.\n\n * **A directive rulebook.** Each shift the Gate posts stacking rules: _\"entry permits issued after 15 June are void,\" \"southern-hemisphere crossings closed tonight,\" \"papers must match the traveler's own account.\"_ A verdict is now a cross-check: is the sky claim a lie **and** does the paperwork satisfy tonight's directives? The binary became a layered judgment.\n * **A stakes economy.** Standing is your health (run ends at zero); Authority is currency you earn by being right, and _spend_ on DETAIN & SEARCH for a lead. Combo multipliers reward streaks; naming the correct violation before you stamp pays a bonus.\n\n\n\n * **The Daily Gate.** A date-seeded shift: the same queue, directives, and conditions for everyone that day, with a shareable 🟩🟥 score. (Wordle's loop, which also happens to feed DEV's reaction-based tiebreak.)\n\n\n\n * **Roguelike modifiers** on the Long Shift: _Fog_ hides an almanac line, _Heavy Paperwork_ adds a directive, _High Stakes_ doubles the swing, drawn from the seed.\n\n\n\nAll of it is `pickDirectives(seed)`, `resolveCase(traveler, directives)`, and a seeded RNG. Verifiable, debuggable, and covered by a headless test that plays full runs. The AI is a garnish, not the engine.\n\n### Endless mode: the machine generates the liars\n\nStory mode is hand-written, but **The Long Shift** generates travelers forever: pick a city, compute its almanac, give humans the truth with local texture, and give machines one _seeded lie_ drawn from a bank of plausible-wrong beliefs (imported hemispheres, remembered-from-books festivals, stars that aren't there). Difficulty ramps with your streak: early lies are loud (\"watched the sunset in Tromsø\"), late ones are quiet (\"Midsommar is the last weekend of June,\" when it's pinned to June 19–25, and in 2026 it's tomorrow).\n\n## Prize Category: Best Ode to Alan Turing\n\nThe game **is** the imitation game, with the chairs rearranged. Turing's 1950 paper proposed judging machines by interrogation; this game puts you in the interrogator's seat and then asks the question he left underneath: _what does the examiner owe the one who stops pretending?_\n\nIt's also an ode to his method. The Bletchley bombes didn't read minds. They hunted **contradictions** : a rotor guess that forced a letter to encrypt to itself was impossible, and died. The Daylight Ledger is that idea worn as a border post. You don't intuit who's a machine; you hold the impossible against the claim, _there were no stars over Stockholm last night_ , and the contradiction does the rest. The interstitial vignettes carry his June-bound biography (born two days after the solstice; dead two weeks before it), and the Pride-month connection is load-bearing: the finale is about a system that punishes beings for what they are while rewarding convincing pretense, and about the person holding the stamp.\n\n## Prize Category: Best Google AI Usage\n\nGemini plays the impostors, at runtime, with full disclosure.\n\n🩺 **Verify it's live right now:** /api/health — returns `\"gemini\": true` when the key is active and the model name in use.\n\nWhen you play at the hosted URL, **Gemini 3.1 Pro** voices every impostor. The key lives on a Cloud Run server (Secret Manager), never in the browser. Each generated case is re-voiced via the Gemini REST API: the model receives the city's computed fact sheet, a cover-story persona, and, if it's playing a machine, _the exact lie it must weave in without confessing_. Structured JSON output, one call per traveler, prefetched while the traveler walks up. Playing offline? Paste your own free-tier key in The Long Shift, or skip it: the dossier voice takes over and the game plays the same.\n\nTwo design decisions I want to be transparent about, because they're the interesting part:\n\n 1. **The truth never comes from the model.** The seeded lie and the verdict logic live in deterministic code; Gemini improvises the _voice_ around them. A hallucination can't corrupt the game. At worst it makes an impostor easier to catch, which is the right failure mode.\n 2. **The fallback is total.** No key, network failure, quota, malformed JSON: the dossier voice takes over. The game never depends on the API to be playable. (I gave the same courtesy to the judges: story mode is 100% offline.)\n\n\n\nThe result is the inverted Turing test made playable: a human examiner interrogating a live language model that is _trying to pass_ , and a deterministic almanac as the tiebreaker.\n\n## What I'd do next\n\nPersona memory across a Long Shift session (impostors that learn which questions you favor) and more cities. I want Nairobi (equatorial, but a hemisphere trick: it's _just_ south), Anchorage, and Punta Arenas.\n\nThanks for reading. If you only have two minutes: play Night 1, ask about the light, then open the Ledger. The sky does the rest. ☀️",
"title": "The Imitation Gate: a Turing-test border checkpoint where the sky catches the liars"
}