Files
2025-05-23 22:01:00 +08:00
..
2025-05-23 22:01:00 +08:00
2025-05-23 22:01:00 +08:00
2025-05-23 22:01:00 +08:00

About

This folder is for generating Minesweeper puzzle questions and answers.

To generate the puzzles, you can run the ./run.sh command.

Folder Structure

  • ./scripts/minesweeper.py: the core logic for generating Minesweeper puzzles.
  • ./scripts/minesweeper_prompt.py: the prompt templates for generating Minesweeper puzzle questions.
  • ./scripts/minesweeper_verifier.py: the verifier for validating Minesweeper puzzle solutions.
  • ./run.sh: a script for generating Minesweeper puzzles with various configurations.

Game Rules

Minesweeper is a logic puzzle where:

  1. The puzzle consists of an n×n grid with some cells containing hidden mines.
  2. Some cells are revealed, showing a number that indicates how many mines are present in the 8 adjacent cells (horizontally, vertically, and diagonally).
  3. Cells marked with "X" are unrevealed and may contain mines.
  4. The goal is to identify all cells that must contain mines based on the revealed numbers using logical deduction.
  5. Only one-step logical deduction is required (no guessing or complex multi-step reasoning).

Parameters

The puzzle generator supports the following parameters:

  • n: Size of the grid (n×n) (default: 8)
  • mine_den: Density of mines in the grid (default: 0.2)
  • reveal_frac: Fraction of non-mine cells to be initially revealed (default: 0.4)
  • num_of_data: Number of puzzles to generate (default: 100)
  • max_attempts: Maximum attempts to generate a valid puzzle (default: 1000)