· 4 min read · AI, Fun, Web development

Prompt Wizards Battle: a game about writing prompts

A marzipan wizard and a rabbit in a hat on a cake
Photo: Johann Dréo, CC BY-SA 2.0 (resized)

Prompt Wizards Battle is a game where you write a prompt and an AI tries to follow it. The task is simple: sort 100 random words. The scoring is not, and I built the whole thing as a designer with AI help.

You can play it here or read the project page.

How it works

You type a prompt telling the AI to sort words alphabetically. The game sends your prompt and 100 random words to a model (Google AI, Mistral or OpenAI). The model returns a list. The game compares it with the correct order and puts your score on a leaderboard.

The stack is React, TypeScript and TailwindCSS on the front, Vite as the build tool, and Supabase as the database.

Why sorting is a good trap

Sorting looks like the easiest thing a computer does. For a language model it isn't. A model doesn't see letters. It sees chunks of text called tokens. Andrej Karpathy says tokenization is at the heart of a lot of weirdness in LLMs, including bad spelling. A 2024 paper found that most models fail simple tasks about the letters inside words.

That is what makes the game work. A vague prompt gets a messy list. A good prompt has to be clear about the output format and what to do with every word. That matches the advice in OpenAI's prompt engineering guide: clearer instructions, smaller steps, and testing changes systematically.

Games like this

I'm not the first to turn prompting into a game. Lakera's Gandalf asks you to trick a chatbot into giving up a password. Tensor Trust turned the same idea into a two-sided game. Its players wrote defenses and attacks, and the researchers released the data. HackAPrompt ran it as a global competition and collected over 600,000 attack prompts.

Those games are about breaking models. Mine is about getting a plain task done well. It is a friendlier version of the same loop: write, test, read the result, write again.

Three challenges

1. Backend complexity. I'm a designer, not a backend engineer. I used AI-assisted coding and Supabase for storage instead of a custom backend. Supabase gives each project a full Postgres database.

2. Fair scoring. Pass or fail is too harsh. A list with one word out of place is not the same as garbage. So the game uses four measures: exact matches, partial matches, word-level accuracy (did the AI use the right words at all?) and edit distance.

Edit distance is the smallest number of single-letter edits (insert, delete, replace) that turns one text into another. Levenshtein described it in 1965. "kitten" to "sitting" takes 3. A near miss gets partial credit.

Anthropic's docs say the same thing in general form. Define success criteria and a way to test them before you work on the prompt. In a game, the scoring is the success criteria.

3. Different models, different outputs. Each model wraps its answer differently. I wrote a function, sanitizeLLMResponse(), that cleans the output before it is scored. Without it you would punish players for the model's habits.

Designers and full apps

I think designers can now build working apps, not just mockups. The tools are moving this way. v0 turns a description into React code. Replit Agent says it can create and deploy an app from a few sentences, "regardless of technical experience". Replit calls it alpha software.

My opinion: this works for a game like mine, but you still need to see what the code is doing. The debug console, which logs requests, responses and errors, was crucial for refining the logic and testing responses.

The project page calls this a production-ready app. I'd be careful with that word. Gandalf is a warning. Its creators left an analytics dashboard open, and it exposed players' prompts. A game is a good place to learn, and security still needs care.

Sources

Comments