Yureka LogoDocs

Minesweeper

A classic Minesweeper game implementation with a 9×9 board, 10 mines, and first-click mine relocation for a safe start.

Core Features

  • 9×9 Board: Standard Minesweeper grid with 10 mines.
  • First-Click Safety: If the first click hits a mine, the mine is relocated to ensure a safe start.
  • Recursive Flood-Fill: Clicking an empty cell automatically reveals adjacent empty cells.
  • Flag System: Right-click to flag suspected mine locations.
  • Timer: Game timer capped at 999 seconds.
  • Win/Loss Detection: Smiley face indicator (:-D for win, :-X for loss).

Technical Details

  • Controller Class: UMinesweeperApp (Inherits from UAppBase)
  • Widget Class: UMinesweeperWidget (Slate host, implements IAppContentWidget)
  • Window Specs:
    • Initial Size: 360x440
    • Resizable: false
    • Maximizable: false
  • Category: "Games"
  • Installed By Default: false (must be installed via Software Center)

Data Structures

  • FMineCell: Row, Col, bIsMine, bIsRevealed, bIsFlagged, AdjacentMines.

Game Logic

All game logic is self-contained in UMinesweeperWidget, with private inline SMineCellWidget Slate components:

  • StartNewGame() — Random mine scatter across the 9×9 grid.
  • RevealCell(Row, Col) — Recursive flood-fill for empty cells.
  • FlagCell(Row, Col) — Toggle flag on unrevealed cells.
  • GameOver(bWon) — End game state with smiley indicator.
  • CheckWinCondition() — Verifies all non-mine cells are revealed.