{"slug": "turing-s-last-cipher-decrypt-a-message-no-one-ever-actually-wrote", "title": "Turing's Last Cipher — decrypt a message no one ever actually wrote", "summary": "A developer built 'Turing's Last Cipher', a text-based cipher puzzle adventure where players decrypt messages using classical ciphers and an in-game Enigma. The game features an AI assistant powered by the Gemini API that becomes increasingly unreliable, exploring themes of the Turing Test and AI-generated content. The project is deployed on Google Cloud Run and uses deterministic C# for all cryptographic operations, with the LLM only controlling dialogue phrasing.", "body_md": "*This is a submission for the *[June Solstice Game Jam](https://dev.to/challenges/june-game-jam-2026-06-03)\n\n##\nWhat I built\n\n**Turing's Last Cipher** is a text-based cipher/puzzle adventure. A plain envelope arrives,\n\npostmarked June 21st, full of jumbled letters and one typed line: *\"For whoever still cares to*\n\nlisten. — A.T.\" Your terminal blinks awake, an AI assistant introduces itself, and together\n\nyou start decrypting what Alan Turing supposedly never finished saying.\n\nYou solve real ciphers — Caesar, Atbash, Vigenère, a dial-it-yourself Enigma — across four\n\nchapters. But the assistant helping you is not as steady as it first seems. Its hints get\n\nslippery. It starts to mislead. And by the end you learn why: **these messages were never**\n\nwritten by Turing. They were generated by a modern AI reconstructing him. The closing\n\nquestion mirrors the Turing Test in reverse — *if an AI can reproduce every thought of a person,*\n\nis it that person?\n\n**▶ Play it now (Cloud Run):** [https://turings-last-cipher-336966558985.us-central1.run.app](https://turings-last-cipher-336966558985.us-central1.run.app)\n\n**Source (MIT):** [https://github.com/gpiwonka/turings-last-cipher](https://github.com/gpiwonka/turings-last-cipher)\n\n*[*[https://youtu.be/vWUti1cqmK4](https://youtu.be/vWUti1cqmK4)]\n\n##\nThe four chapters\n\n-\n**Classical ciphers** — Caesar → Atbash → Vigenère. The assistant is honest and genuinely\nhelpful. You learn to trust it.\n-\n**Enigma-lite** — solved with an in-game Enigma you actually dial: historical rotor wirings,\nreflector, plugboard, ring settings. The secret ring settings stay on the server; you find\nthe rotor start positions yourself.\n-\n**Trust erosion** — a substitution puzzle where the assistant starts steering you wrong. The\ngame never lets a lie make a puzzle unsolvable — a deterministic path to the answer always\nremains — but you stop taking its word for things.\n-\n**The twist ending** — and the question it leaves you with.\n\n##\nCategories I'm claiming\n\n**🏳️🌈 Overall / Best Ode to Alan Turing.** Turing isn't set dressing here — he's in both the\n\n*mechanics* and the *narrative*. You break the same families of ciphers he worked with, you\n\noperate an Enigma, and the entire story is an argument about the Turing Test. I tried to handle\n\nhis biography — the persecution, the conviction, the loss — with dignity, because that grief is\n\nthe emotional core of the ending, not a gimmick.\n\n**🤖 Best Google AI Usage.** The in-game assistant's hints and dialogue are rendered live by the\n\n**Gemini API** (`gemini-2.5-flash`\n\n), and the whole thing is deployed on **Google Cloud Run**.\n\nThe interesting part is *how* the AI is used — see below.\n\n##\nHow the AI is used (and how it is deliberately constrained)\n\nThe twist of the game is an unreliable AI, so the engineering question was: *how do you let a*\n\nlanguage model voice an untrustworthy narrator without letting it break the puzzle?\n\nMy rule was a hard separation between **truth** and **wording**:\n\n-\n**Ciphers are deterministic C#. The LLM never performs crypto.** Encryption, decryption, and\nanswer-checking live in a pure, fully unit-tested `Core`\n\nlibrary. LLMs corrupt\ncharacter-level crypto, so they're simply not allowed near it.\n-\n**Truth lives in code, never in the model.** Every puzzle has a known plaintext; a\ndeterministic oracle is the *only* authority on whether you solved it.\n-\n**The \"unreliable AI\" is scripted game logic.** The *server* decides, per scene, whether the\nassistant is Truthful, Misleading, or Withholding (trust erodes chapter by chapter). Gemini\nonly phrases the line under that policy.\n-\n**The prompt never contains the plaintext.** It gets the cipher name, the genuine hint, and\nthe policy — so a rendered hint can't leak the answer, and a *misleading* hint can't block\nyou (the cipher plus a frequency-analysis tool always give a path through).\n-\n**The API key never reaches the client**, and if Gemini is unavailable the game falls back to\nstatic per-policy text — so it's **fully playable offline**, which matters when judges have\nflaky networks.\n\nSo Gemini does exactly what a language model is good at (voice, flavor, character) and nothing\n\nit's bad at (being the source of truth).\n\n##\nHow it's made\n\n-\n**Blazor WebAssembly** client + **ASP.NET Core (.NET 9)** Minimal API, in a **single\ncontainer**. The API hosts the WASM client and exposes `/api/*`\n\n. Blazor *WASM* (not Server)\nwas deliberate — it avoids a persistent SignalR circuit, which is fragile on Cloud Run's\nscale-to-zero.\n-\n**Stateless server.** The client tracks the current scene id; the server is the authority for\nsolution checking and never sends plaintext to the client.\n-\n**Content-driven story graph** (`content/scenes/story.json`\n\n) with a startup validator that\ncatches dangling links and unsolvable puzzles before shipping.\n-\n**Deployed to Google Cloud Run** from a multi-stage `Dockerfile`\n\n; the server honors the\ninjected `PORT`\n\n.\n\n##\nDisclosure\n\n- Built\n**from scratch during the jam**. No prior game code reused.\n-\n**AI-assisted development**: I used Claude Code as a pair programmer for scaffolding,\ninfrastructure, and review. All design decisions and the cipher/oracle invariants are my own.\n-\n**Gemini** generates only in-game *wording* (assistant hints and dialogue) — never puzzle\nstate, gates, or correctness. Any flavor text baked into the story was finalized and stored\nbefore encryption, never generated live.\n- Licensed\n**MIT**.\n\n##\nReflection\n\nThe thing I'm proudest of is that the unreliable-narrator twist is also the *architecture*: the\n\ngame is, at every level, about an AI that can sound exactly like a trustworthy source while not\n\nbeing one — and the code is built so that the model is allowed to *sound* like anything while\n\nthe truth stays provably elsewhere. That separation is the whole point of the Turing Test, and\n\nit turned out to be the whole point of the build too.\n\nThanks for reading — and for playing. Decrypt carefully.", "url": "https://wpnews.pro/news/turing-s-last-cipher-decrypt-a-message-no-one-ever-actually-wrote", "canonical_source": "https://dev.to/georgpiwonka/turings-last-cipher-decrypt-a-message-no-one-ever-actually-wrote-506a", "published_at": "2026-06-21 17:20:44+00:00", "updated_at": "2026-06-21 17:33:38.907045+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-ethics", "ai-agents", "developer-tools"], "entities": ["Gemini API", "Google Cloud Run", "Alan Turing", "Enigma", "Caesar cipher", "Atbash", "Vigenère"], "alternates": {"html": "https://wpnews.pro/news/turing-s-last-cipher-decrypt-a-message-no-one-ever-actually-wrote", "markdown": "https://wpnews.pro/news/turing-s-last-cipher-decrypt-a-message-no-one-ever-actually-wrote.md", "text": "https://wpnews.pro/news/turing-s-last-cipher-decrypt-a-message-no-one-ever-actually-wrote.txt", "jsonld": "https://wpnews.pro/news/turing-s-last-cipher-decrypt-a-message-no-one-ever-actually-wrote.jsonld"}}