Knights and Knaves Puzzle Generator
On the island of knights and knaves, knights always tell the truth and knaves always lie. Each islander says one thing, and you must work out who is which. This makes fresh puzzles for two to six islanders, in plain sentences, using your own names if you want, and keeps a puzzle only when exactly one choice of knights and knaves fits every statement — checked by trying all of them.
What this generator does
Gives each islander one statement from five kinds — about one person, about whether two are the same or different kinds, about how many are knights or knaves, or an either-or — and keeps the set only if exactly one answer fits and the islanders are not all the same kind. The logic grid puzzle matches attributes across categories; this is about truth and lies.
How to use this tool
- Choose how many islanders and press Make a puzzle. Change the names if you like.
- Assume someone is a knight and follow what that makes true; if it contradicts itself, they are a knave.
- Press Show the answer to check, or print the puzzle with its answer at the foot of the page.
Understanding the controls
- Islanders
- 2 to 6. Each extra islander doubles the combinations to rule out: 4 for two, 64 for six.
- Names
- One word each with a capital letter; the first ones are used. Names never leave your browser.
- Puzzle code
- Leave empty for a new puzzle from the browser's secure generator. With a code, the same code, count and names make the same puzzle again; the code is a seed, not a secret.
Worked examples
- Code harbour, 4 islanders
- Ada: “Cora and I are the same kind.” Bram: “At least 4 of us are knaves.” Cora: “Dev is a knave.” Dev: “Ada is a knight.” Answer: only Cora is a knight.
Common use cases
- A logic starter for a maths or philosophy lesson
- Practising proof by contradiction
- A puzzle with classmates' names for a class newsletter
How this generator works
Each statement is built from a small grammar that can be evaluated exactly: X is a knight (or knave); X and Y are the same kind; X and Y are different kinds; at least k of us are knights (or knaves); X is a knight or Y is a knave. For a candidate puzzle, every way of choosing knights and knaves — 2 to the power of the number of islanders — is tried, and a choice fits when each knight's statement is true and each knave's is false. Only a puzzle with exactly one fitting choice is kept. Because the count is complete there is no search limit and no undecided case. Afterwards each statement is read back from its printed wording, not from the structure that made it, and the count is run again on what was read.
Randomness and fairness
Statements are chosen by the browser's secure generator, or a seeded one when you give a code. A code repeats a puzzle while the generator and names are unchanged. Codes are deterministic, not cryptographic.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- Everyone is exactly one of knight or knave, and each statement is wholly true or wholly false.
- “At least k of us” counts the speaker.
Limitations and good to know
- Up to six islanders and one statement each.
- No difficulty grade is given; more islanders usually means more combinations to rule out, not necessarily a harder chain of reasoning.
- Statements use a fixed set of five sentence shapes.
Common mistakes
- Thinking a knave's “or” statement has one false half
- A knave's whole statement is false, so both halves of an either-or are false.
- Forgetting the speaker in “at least k of us”
- The count includes the person speaking.
Practical tips
- Anyone who says “I am a knave” cannot exist on the island — so such a line never appears here.
- Start with a statement about a count: it often fixes the speaker at once.
Privacy and your data
Puzzles are built in your browser. With analytics consent, a count records how many islanders a puzzle had; the names you type, the statements and any code are never sent.
Related generators
- Logic Grid Puzzle GeneratorZebra-style puzzles where clues are sentences about who goes with what, every clue proved necessary and exactly one arrangement possible.
- Water Jug Puzzle GeneratorMakes water-jug measuring puzzles — or solves your own — with the fewest-move answer proved by searching every reachable state, stepped through on screen.
- Truth Table GeneratorThe full truth table for an expression you type — or one drawn for you — with the grouping shown fully bracketed and a tautology or contradiction verdict counted from the rows.
- Usowan Puzzle GeneratorMakes Usowan puzzles — shade cells using numbers, exactly one of which in every room is false — each proved to have one answer, with a printable answer page.