demine 0.1.0

A minesweeper solver.
Documentation
  • Coverage
  • 48.84%
    42 out of 86 items documented0 out of 55 items with examples
  • Size
  • Source code size: 152.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 7.02 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 44s Average build duration of successful builds.
  • all releases: 44s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • canislupaster/demine
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • canislupaster

demine

CI Crates.io Docs.rs Rust License Unsafe

A minesweeper solver (and soon, engine). Still WIP, and rest of this doc is Claude.

Example

use demine::board::Board;
use demine::solver::Solver;
use rand::SeedableRng;
use rand::rngs::SmallRng;

let (w, h, n_mines) = (8, 8, 10);
let mut rng = SmallRng::seed_from_u64(0);

// Generate a random board and reveal one safe cell to get started.
let mut board = Board::random_mines(w, h, n_mines, &mut rng);
board.reveal_random_non_mine(&mut rng);

// Ask the solver for a guaranteed-safe cell given the current known state.
let mut solver = Solver::new(w, h, 0);
let mut view = solver.with_known(board.known(), Some(n_mines)).unwrap();
let (row, col) = view.find_safe_cell().unwrap();

println!("safe cell: ({row}, {col})");

Crate layout

  • board — board state, cell references, reveal / mine-set primitives.
  • generator — mine placement and board generation.
  • solver — solver entry point; deeper logic lives in src/solver/.
  • utils — shared helpers (parsing, neighbor iteration, formatting).

Features

  • use-mimalloc — swap the global allocator to mimalloc (v3). Off by default; enable for benchmarks and release runs where allocator wins matter.

Profiles

  • release — max optimizations (fat LTO, single codegen unit).
  • testing — release-optimized but with debug_assertions on; used by the cargo test-all alias to catch UB / overflow in hot paths.
  • profiling — release + debug symbols, for perf tools (samply, Instruments).