MyNixOS website logo
Description

Mine Sweeper Game.

This is the very popular mine sweeper game! The game requires you to find out tiles that contain mines through clues from unmasking neighboring tiles. Each tile that does not contain a mine shows the number of mines in its adjacent tiles. If you unmask all tiles that do not contain mines, you win the game; if you unmask any tile that contains a mine, you lose the game. For further game instructions, please run `help(run_game)` and check details. This game runs in X11-compatible devices with `grDevices::x11()`.

Mine Sweeper Game in R

Lifecycle:experimental CRANstatus R-CMD-check Downloadstats

Package: mineSweepR 0.1.1
Author: Xiurui Zhu
Modified: 2023-10-14 15:22:11
Compiled: 2023-12-02 18:48:53

Let’s have fun with R! This is the very popular mine sweeper game! In this game, you are required to find out tiles that contain mines through clues from unmasking neighboring tiles. Each tile that does not contain a mine shows the number of mines in its adjacent tiles. If you unmask all tiles that do not contain mines, you win the game; if you unmask any tile that contains a mine, you lose the game. While in R, you may also run library(mineSweepR); help(run_game) and check details for game instructions.

Installation

You can install the released version of mineSweepR from CRAN with:

install.packages("mineSweepR")

Alternatively, you can install the developmental version of mineSweepR from github with:

remotes::install_github("zhuxr11/mineSweepR")

Game layout

Below are two screenshots of the mine sweeper game. While game is in progress, there are some tile types and marks:

  • Light gray tiles: unmasked tiles.
  • Dark gray tiles: masked tiles.
  • Count (1/<span style="color:#ff0000;">2/<span style="color:#33a02c;">3/…) marks: number of mines (blank for no mines) in 8 adjacent tiles, revealed through unmasking.
  • “F” marks: flags for possible mines on masked tiles, as found out and marked by player.

There may be some additional tile types and marks after losing a game:

  • Red tile: unmasked tile containing a mine (the tile that leads to loss).
  • <span style="color:#FFFFFF; background-color:#7F1F7F;">Magenta tiles: wrongly flagged tiles (e.g. flagged tiles that do not contain mines).
  • “M” marks: mines in unflagged tiles (automatically unmasked after loss).

The title tells game state, number of unflagged mines and playing time.

  • Game state: there are 3 possible game states:
    • Alive: game in progress
    • Bingo: after winning a game (left)
    • Dead: after losing a game (right)
  • Number of unflagged mines: computed through literally subtracting the number of flags from the total number of mines, it can be negative and does not tell whether the flags are correct or not.
  • Playing time: game timing starts when any tile is unmasked.

Game instructions

Goal

All tiles start masked. If you unmask all tiles without mines, you win the game; if you unmask any tiles containing mines, you lose the game.

Unmask tiles

You may click with left mouse button on any masked tile to unmask. The first tile unmasked cannot contain a mine. Timing starts when any tile is unmasked.

Find out mines

Each unmasked tile tells you the number of mines in adjacent tiles, unless itself contains a mine. You may use these numbers to find out the adjacent tiles with mines.

Flag mines

You may click with right mouse button on an unmasked tile to flag it as a possible mine. Flagged tiles cannot be unmasked, unless you click on them with right mouse button again to remove the flags.

Unmask adjacent tiles

You may click with left mouse button on any unmasked tile to unmask adjacent unflagged tiles, after you have set up the number of flags that equals to the count of adjacent mines shown on this tile. If any unflagged adjacent tiles contain mines, one of them is triggered and you lose the game.

Game statistics

After you win or lose a game, game statistics are recorded.

Restart game

You may restart game with r at any time. If you have not won or lost the game, it is not recorded in game statistics.

BOSS KEY!

You may press boss key (any key other than r) for 2 times to close game window.

Game customization

run_game() offers a handful of options to customize the game, including:

n_mine, n_row, n_col

Integers as numbers of mines/rows/columns in game panel, 0 < n_mines < n_row * n_col.

unmask_button, flag_button

Integers as buttons to unmask/flag tiles. Usually, 0 for left mouse button (to unmask) and 2 for right mouse button (to flag).

digit_char, mine_char, flag_char

Characters to mark counts/mines/flags.

unmask_color, mask_color, hit_color, wrong_color

Strings as colors for unmasked tiles / masked tiles / mine-triggering tile / wrongly flagged tiles.

digit_color, mine_color, flag_color

Strings as colors for digit_char/ mine_char/flag_char on game panel.

window_title

String as window title.

x11_args

Named list of arguments passed on to x11, excluding title.

time_prec

Integer as time precision (e.g. 0 for seconds or 3 for miliseconds).

restart_key

Character as the key to restart game, used when you have won or lost a game.

exit_key_press

Integer as the times of boss key presses (boss key is any key other than restart_key) required to close game window. This may come in handy in emergency (:D).

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows