# A crossword where the browser never knows the answers

2026-12-04 — Emanuele Del Monte, Frontend Engineer

PokèVerba is a Pokémon crossword that changes every day. A friend writes the blog content; I built the site: a WordPress theme, a PHP plugin with its own tables and a React app for the grid.

In a browser game the easy path is to ship the solution with the grid and compare letters on the client. Anyone who opens the developer tools can read it. I took the other path: the browser gets a letter or the solution only when the player asks for it.

## What reaches the browser

The day’s puzzle sits in the database as full JSON, answers and Pokémon ids included. Before it leaves, it goes through `pokeverba_puzzle_public()`, which keeps each word’s number, direction, row, column, length and clue. Only the answer’s length gets through. The Pokémon ids stay on the server too, except yesterday’s: that crossword is closed.

That is all the grid needs. The cells follow from position, direction and length.

## Checking judges whole words only

The Check button sends the typed letters to `POST /pokeverba/v1/puzzle/check`. `pokeverba_grade_words()` rebuilds each word from its cells and skips any word with even one empty cell. Complete words are compared with the answer, and their cells come back as right or wrong.

If the server judged single letters, you could solve the crossword by trying A, B, C in one cell and pressing Check each time. With whole words judged, every attempt costs a word. On top of that each IP has a per-minute check limit, counted in a transient keyed by an HMAC hash of the IP, so the plain address never lands in the database.

The same response says which Pokémon you guessed: they join the Collection as soon as the word is right, even before the crossword is finished.

## Clues built from facts

The site will carry ads and affiliate links, so no official text can end up in a clue. The plugin imports facts such as type, generation, colour, habitat and evolutions from PokéAPI, and builds up to three clue versions per species. One gives identity and evolution stage, one the habitat, the last just the decisive fact, such as what it evolves from.

Before a clue is saved, a check drops it if it names the answer. Pairs like Mr. Mime and Mime Jr. get a check of their own: a relative whose name shares a word with the answer is left out of the clue, because it would give away half the word.

## A deterministic generator

The seed comes from the date: `20261204` for today, plus 10,000 per generation for regional crosswords. The same seed gives the same species order, the same layout and the same clues, so automatic generation is reproducible. On the preview page the admin sees a future crossword and, if it does not convince, regenerates it with a random seed.

The layout is at most 15 × 15, with 10–15 words and no more than three words from the same group (the same primary type, or the same generation in the global crossword). In the global crossword a Pokémon never appears in two crosswords less than 30 days apart. In regional ones the window drops to 3 days, and to 1 or 0 when too few species are available: Kanto has 151, and 30 days would drain the pool fast.

## Caching and Rome’s midnight

Today’s crossword is the same for everyone, so it goes out with `Cache-Control: public`. The `max-age` is five minutes, but never past Rome’s midnight: `pokeverba_today_max_age()` takes the smaller of 300 seconds and the seconds left in the day. A cache cannot serve yesterday’s crossword.

Midnight needed a fix too. The endpoint used to read the clock more than once: in a request straddling midnight the grid, the date and the `max-age` could belong to two different days. Now the date is read once and everything else receives it as an argument. Check responses, on the other hand, are `no-store`: they depend on what the player typed.

## How it went

PokèVerba is live at sbustiamobro.it, at version 1.25 in November 2026, with a regional crossword, tokens and achievements. Keeping the solution on the server costs two more endpoints: one checks, the other reveals letters or the solution. Each Check adds a few milliseconds. In return, the developer tools show only lengths, clues and the letters the player asked for.

[PokèVerba](https://www.emanueledelmonte.it/en/work/pokeverba)
