Play minesweeper interactively in the current graphics device.
Usage
play_minesweeper(
difficulty = c("expert", "intermediate", "beginner"),
nrow = NULL,
ncol = NULL,
mine_count = NULL,
mine_density = NULL,
os_type = c("guess", "unix", "windows")
)
Arguments
- difficulty
establishes default dimensions and mine count
- nrow, ncol
dimensions of the minesweeper board
- mine_count
number of mines to sweep
- mine_density
proportion of cells that conceal a mine
- os_type
used to interpret button
argument of event handlers
Details
Expert difficulty is 16x30 with 99 mines, intermediate 16x16 with 40 mines,
and beginner 9x9 with 10 mines.
The current graphics device must support event handling
(see grDevices::getGraphicsEvent()
). If onIdle
is not supported,
the timer will only update on mouse events.
Controls
Left click an empty square to reveal it.
Right click an empty square to flag it.
Middle click a number to reveal its adjacent squares.
Press r to reset the board.
Press q to quit.
Examples
if (FALSE) { # .Platform$OS.type == "unix" && interactive()
x11() # Unix-specific example
recording <- play_minesweeper()
dev.off()
}