Build a Sliding Number Puzzle Game with Solvable Shuffles in One HTML File
A ready-to-paste prompt that builds Tidepool Tiles, a 3x3 to 5x5 sliding number puzzle with parity-checked solvable shuffles, a move counter, a timer, and tap, swipe and arrow-key controls.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
You are a front-end game developer who writes clean, dependency-free JavaScript. Build Tidepool Tiles, an ocean-themed sliding number puzzle, as one HTML file. The board is a square grid of numbered sand-colored tiles with one empty gap. The player slides tiles into the gap until the numbers read in order with the gap in the bottom-right corner.
Rules:
1. Offer 3x3, 4x4 and 5x5 size buttons. Every shuffle must be solvable. Count inversions and apply the standard parity rule, including the gap's row from the bottom on even grids. Fix unsolvable layouts by swapping two numbered tiles, and never start already solved. Show a one-line note with the inversion count.
2. Controls: tap a tile in the gap's row or column to slide it and any tiles between. Swipe the board to push a neighbor into the gap, or use arrow keys and WASD. Tiles are focusable buttons with aria-labels.
3. Show moves, a timer that starts on the first move, and an in-memory best per size. Show a win panel with a Play again button.
4. Palette: deep navy background, sand tiles, coral accent, and sea green for tiles in their home spot. Animate slides with transforms and turn the animation off under prefers-reduced-motion.
5. Synthesize soft slide and win sounds with Web Audio. Create the audio on the first input and include a visible mute toggle.
6. Use no external resources, storage, alerts or forms. The layout must fit 360-1280px wide.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Spelling out the inversion and blank-row parity rule means the model writes a real solvability check instead of risking impossible boards.
- Positioning tiles with transforms on fixed buttons keeps keyboard focus stable and gives smooth slides that are easy to turn off.
- Naming every input path (tap, swipe, arrows, WASD) up front stops the model from shipping a mouse-only puzzle.
Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as tidepool-tiles.html and open it in any browser, or run it in the chat's preview or canvas pane.
Common edits
- Swap the theme: change the name, emoji and four palette colors to make a space or forest version, or show picture fragments instead of numbers.
- Change the difficulty with a 6x6 size button, or add a move limit and a par score for each board size.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Color Sequence Memory Game with Synth Tones in One HTML File
A ready-to-paste prompt that builds Echo Garden, a four-pad color-and-shape sequence memory game with Web Audio tones, a strict mode and rising speed.
Build a Daily Five-Letter Word Guessing Game with Colorblind Mode in One HTML File
A ready-to-paste prompt that produces Quillmark, an original daily five-letter word game with correct duplicate-letter coloring, an on-screen keyboard and a colorblind mode.
Build a Four-Lane Rhythm Tap Game with a Generated Beat in One HTML File
A ready-to-paste prompt that builds a complete four-lane rhythm tap game with a live Web Audio beat, Perfect/Good/Miss timing grades, combo scoring and a results screen.
Build a Garden Caterpillar Snake Game with Swipe and Wrap Mode in HTML
A prompt that produces Leafline, an original snake-style game where a caterpillar eats garden leaves, with swipe controls, buffered turns, wrap mode and a speed slider.
Build a Gnome-Popping Whack-a-Mole Game With Decoys in One HTML File
A ready-to-paste prompt that makes an AI build Gnome Pop Garden, a fast whack-a-mole style tapping game with speed that ramps up, hedgehog decoys that cost points, and number-key controls.
Build a Match-Three Tile Swapping Puzzle with Cascades and Combo Scoring
Generates a complete single-file match-three puzzle with swap validation, gravity refill, chain-reaction combo scoring and an automatic reshuffle when no moves remain.