Phaser AE

Hidden word guessing

Pro packv3.0.0-0WordNew

Guess the hidden word in a set number of tries, and every guess is told which letters are in place, which are in the word somewhere else, and which are not in it. The pack runs the whole game; you draw the tiles.

This is a Pro pack. Upgrade to Phaser Pro to use it in your games.See Phaser Pro →

Released October 21, 2026

Hidden word guessing: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

The pack

wordGuess

function wordGuess(): Pack<{ wordGuess: WordGuessApi }>

The word-guess pack: hidden-word guessing rules over the english-words lists. Pure logic, so it runs headless.

Helpers

createWordGuess

function createWordGuess(options: WordGuessOptions): WordGuess

Start a game. Throws a RangeError for options out of range: a length with too few answers for the boards, an answer of the wrong length, a reveal outside the word, a guess limit that is not a whole number of 1 or more.

markGuess

function markGuess(guess: string, answer: string): LetterMark[]

Mark guess against answer, letter by letter: correct in the right place, present elsewhere in the answer, absent otherwise. A repeated letter is marked present only as often as the answer has it beyond its correct places, left to right: speed against abide is absent, absent, present, absent, present. Throws a RangeError when the lengths differ or either is not letters.

Types

BoardView

interface BoardView

One hidden word and the guesses marked against it.

  • readonly answer: string | null — The answer, once this board is solved or the game is over; null before.
  • readonly solved: boolean — Guessed?
  • readonly solvedAt: number | null — Which guess solved it, counting from 1; null while unsolved.
  • readonly rows: ReadonlyArray<GuessRow> — The guesses marked against it, oldest first. A solved board takes no more.
  • readonly known: ReadonlyArray<string | null> — What is known of each position: its letter once shown correct or revealed, else null.
  • readonly present: Readonly<Record<string, number>> — Letters known to be in the answer, with the fewest times each must appear.
  • readonly absent: ReadonlyArray<string> — Letters known not to be in the answer (beyond the counts in present).
  • readonly keyboard: Readonly<Record<string, LetterMark | 'unused'>> — Each letter's best mark on this board so far, for a keyboard: a to z, 'unused' when never guessed.

Feedback

type Feedback = 'letters' | 'counts'

What a guess is told: each letter's mark ('letters'), or only how many are right and how many misplaced ('counts').

GuessResult

interface GuessResult

What a guess did: each board's row, or null for a board already solved, and which boards it solved.

  • readonly word: string — The guess, lower case.
  • readonly rows: ReadonlyArray<GuessRow | null> — One per board: the row this guess added, or null where the board was already solved.
  • readonly solved: ReadonlyArray<number> — The boards this guess solved.
  • readonly phase: WordGuessView['phase'] — The phase after the guess.

GuessRow

interface GuessRow

A guess as one board saw it.

  • readonly word: string — The guess, lower case.
  • readonly marks: ReadonlyArray<LetterMark> | null — Each letter's mark, with feedback 'letters'; null with 'counts'.
  • readonly correct: number — How many letters are in the right place.
  • readonly present: number — How many letters are in the answer but in another place, counting repeats only as often as the answer has them.

LetterMark

type LetterMark = 'correct' | 'present' | 'absent'

How one letter of a guess compares with the answer.

WordGuess

interface WordGuess

A game of hidden-word guessing. Make one with createWordGuess.

  • observation(): WordGuessView — The game as it stands.
  • check(word: string): { readonly ok: true } | Refusal — Would word be accepted now? { ok: true }, or the refusal with a reason a player could be shown. Changes nothing.
  • guess(word: string): { readonly ok: true; readonly result: GuessResult } | Refusal — Play a guess. Refused, changing nothing, when check would refuse it.
  • undo(): boolean — Take back the last guess. False when there is none.
  • candidates(board?: number): string[] — Every answer still possible on board (default 0), given what it has been shown; empty once it is solved.
  • hint(budget?: number): WordGuessHint — A good next guess: an answer when one is certain, else the word that splits the remaining answers most (from at most budget words tried; default 250).
  • autoStep(budget?: number): { readonly ok: true; readonly result: GuessResult } | Refusal — Play hint()'s guess. Refused when the game is over.
  • answers(): ReadonlyArray<string> — The answers, one per board. For a game's own reveal or a test; a player sees them through observation once earned.
  • snapshot(): HistorySave<WordGuessMove> — The game as a save: the seed and the guesses. Restore it into a game made with the same options.
  • restore(save: HistorySave<WordGuessMove> | string): void — Replace this game with a save. Throws, changing nothing, when the save does not replay under these options.

WordGuessApi

type WordGuessApi = typeof rules

game.wordGuess: every function and type this pack carries, as one namespace.

WordGuessHint

interface WordGuessHint

A suggested next guess, and how sure it is.

  • readonly word: string | null — The guess to play; null when the game is over.
  • readonly candidates: ReadonlyArray<number> — Answers still possible on each board, in order; 0 for a solved board.
  • readonly reason: string — Why, in words a player could be shown.

WordGuessMove

type WordGuessMove = { … }

A move: a guess.

  • readonly kind: 'guess'
  • readonly word: string

WordGuessOptions

interface WordGuessOptions

How a game is set up. Only seed is required; the defaults are five letters, six guesses, one board, English answers.

  • seed: number — Picks the answers when answer does not give them, as an unsigned 32-bit integer. A day number makes a daily puzzle.
  • length?: number — Letters in each answer and guess. Default 5, or the length of answer.
  • guesses?: number — Guesses allowed before the game is lost: a whole number of 1 or more, or Infinity for no limit. Default 6.
  • boards?: number — Hidden words played at once: every guess is marked against each one not yet solved. Default 1.
  • answers?: WordList | ReadonlyArray<string> — Where answers come from: a word list or an array of words. Default the English lexicon. Only words of length letters are used.
  • allowed?: WordList | ReadonlyArray<string> | 'any' — What a guess may be: a list (or array), or 'any' for any letters. An answer is always allowed. Default the English lexicon.
  • answer?: string | ReadonlyArray<string> — The answer, or one per board, instead of a seeded pick (a puzzle you set). Each must be length letters.
  • hard?: boolean — Every letter shown correct must stay in place, and every letter shown present must be used again. Default false.
  • strict?: boolean — Every guess must be one that could still be the answer of each unsolved board, given everything shown. Implies hard. Default false.
  • feedback?: Feedback — What a guess is told. Default 'letters'.
  • reveal?: ReadonlyArray<number> — Positions (from 0) whose letters are shown from the start, as some word shows give the first letter. Default none.

WordGuessView

interface WordGuessView

Everything a game draws, at one moment. Never holds an unsolved answer.

  • readonly phase: 'playing' | 'won' | 'lost' — 'playing', 'won' (every board solved) or 'lost' (out of guesses).
  • readonly length: number — Letters in each word.
  • readonly guesses: number — Guesses allowed; Infinity for no limit.
  • readonly used: number — Guesses made.
  • readonly remaining: number — Guesses left; Infinity for no limit.
  • readonly feedback: Feedback — What a guess is told.
  • readonly hard: 'off' | 'hard' | 'strict' — The hard-mode rules in force: 'off', 'hard' or 'strict'.
  • readonly boards: ReadonlyArray<BoardView> — Every board, in order.
  • readonly keyboard: Readonly<Record<string, LetterMark | 'unused'>> — Each letter's best mark across the boards still being played (all boards once the game is over), for a shared keyboard.