A Windows XP inspired Minesweeper game in Zig, using Raylib for graphics.
- All 3 classic minesweeper modes:
- beginner: 9x9 with 10 bombs
- intermediate: 16x16 with 40 bombs
- expert: 30x16 with 99 bombs
- Custom grid.
- Scalable window.
- Custom camera that allows zooming into the grid.
- Clicking on cells with the correct number of flags will open surrounding cells.
You will need Zig version 0.13.0 to compile this project.
zig buildThe compiled program will be in ./zig-out/bin/zig-sweeper.
Try it out directly!
nix run 'github:frost-phoenix/zig-sweeper' -- --help- First you need to import it in your flake inputs
# flake.nix
{
inputs = {
zig-sweeper.url = "github:frost-phoenix/zig-sweeper";
# ...
};
# ...
}- Then, you can add it to your pkgs list
{ inputs, ... }:
{
home.packages = [
inputs.zig-sweeper.packages.${system}.default
# ...
];
# ...
}You can run it directly using the following command:
zig build run -- --helpIf you use this method, all arguments you pass to the program must be placed after --.
Usage: zig-sweeper [difficulty] [custom_grid_options] [options]
Difficulties:
beginner 9x9 with 10 bombs
intermediate 16x16 with 40 bombs
expert 30x16 with 99 bombs
custom <nb_cols> <nb_rows> <nb_bombs>
Custom grid options:
<nb_cols> between 5 and 115
<nb_rows> between 5 and 70
<nb_bombs> must be less than nb_cols * nb_rows
General Options:
-s, --scale <amount> Set window scale (default 2, max 5)
-h, --help Print this help message and exit
Keybinds:
<ESC> Quit
<n> Generate new grid
<o> Open all cells
<r> Reset grid zoom and position
Mouse:
left click Open cell
right click Flag cell
middle click Drag grid when zoomed in
wheel scroll Zoom grid in/out
beginner |
intermediate |
See TODO.md.
A huge thanks to:
- Not-Nik, who made the incredible raylib-zig bindings.
- Cloudef, who created the amazing zig2nix tool and was super helpful in getting it working.
See LICENSE


