Learn R Programming

Mine Sweeper Game in R

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/2/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).
  • 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

Game customization

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

Copy Link

Version

Install

install.packages('mineSweepR')

Monthly Downloads

169

Version

0.1.1

License

MIT + file LICENSE

Maintainer

Xiurui Zhu

Last Published

December 2nd, 2023

Functions in mineSweepR (0.1.1)

mineSweepR-package

mineSweepR: Mine Sweeper Game
run_game

Run mine sweeper game