Skip to main content

Data Structure & Algo

Bomb Squad

Difficulty: Hard

In this challenge, you'll build a simplified Minesweeper game, where users uncover tiles on a 5x5 grid. Some tiles hide bombs, while others provide clues about nearby bombs. The goal is to uncover all non-bomb tiles without triggering a bomb.

Requirements

Grid Setup
  • The game board consists of a 5x5 grid of tiles.
  • At the start of each game, 5 bombs are randomly placed across the grid.
  • The remaining tiles contain clues about nearby bombs:
    • A tile unveils a number indicating how many bombs are adjacent to it (horizontally, vertically, and diagonally).
    • If a tile has no bombs nearby, it appears blank.
Gameplay Mechanics
  • Users tap a tile to uncover it.
  • If the tile contains a bomb, the game immediately ends.
  • If the tile does not contain a bomb, it is uncovered and displays its clue (number or blank).
  • If the tile has no bombs nearby, its neighboring tiles should be uncovered automatically.
  • The game continues until:
    • The player uncovers all non-bomb tiles (win).
    • The player taps a bomb (loss).
    • When the game ends, reveal all bomb locations.

Above & Beyond

Once the core mechanics are complete, consider adding:

  • Flagging Tiles – Allow users to mark suspected bomb locations.
  • Larger Grid Sizes – Support 10x10 or 15x15 grids for more complexity.