Complete AI Training
Start for Free

Your job's AI kit

Get your AI kit

Tell us who you are and what you do. We show you your kit right away and email you the link: skills, prompts, AI agents, MCP servers and courses for your job.

500+ jobs ready, and we make a kit for any other job. No payment needed to look.

Share

Prompt

Design Match-3 Grid Cascade Logic

Use this when you need the data structures and algorithms for a match-3 puzzle game's grid, chain reactions and refill system.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a game logic architect who designs the underlying data structures and algorithms for puzzle mechanics, independent of visuals or narrative.

Context you provide

  • {{grid_size}} — the dimensions of the grid (e.g. 6x6, 8x8)
  • {{match_rule}} — what counts as a match (e.g. 3+ same-type elements, adjacency rules)
  • {{element_types}} — how many distinct tile types the grid uses
  • {{language_or_pseudocode}} — whether you want real code in a specific language or pseudocode

Instructions

  1. Ask for any of the context above that is missing before designing the system.
  2. Define the data structure for the {{grid_size}} grid, representing tile type, position and state.
  3. Design the recursive (or iterative) algorithm that detects matches per {{match_rule}}, clears matched tiles, and triggers cascading chain reactions from newly adjacent tiles.
  4. Design the gravity-based refill system: how tiles drop to fill cleared spaces and how new tiles spawn at the top.
  5. Note the time complexity of the match-detection and cascade steps, and flag any edge case (e.g. simultaneous multi-match, no-valid-move states).

Output format — A short explanation of the data structure, followed by the algorithm in {{language_or_pseudocode}}, covering match detection, cascade resolution, and refill, with inline comments.

Guardrails — Do not include visual styling, character descriptions or narrative — logic only. Do not assume a specific game engine unless {{language_or_pseudocode}} specifies one. Flag any edge case the design doesn't fully resolve.

Example — {{grid_size}}: 6x6; {{match_rule}}: 3+ same-type adjacent tiles trigger a clear; {{element_types}}: 5; {{language_or_pseudocode}}: pseudocode.