msBoard: Creates a new msweepeR board

Description Usage Arguments Details Value See Also Examples

View source: R/msBoard.R

Description

This function creates a new msweepeR board of width w and height h, with the specified number of mines m.

Usage

1
msBoard(w = 10, h = 10, m = as.integer(5))

Arguments

w

Width of the game board. Must be a positive integer > 3.

h

Height of the game board. Must be a positive integer > 3.

m

Number of mines in the board. Must be a positive integer. Please keep in mind that the number of mines can't be higher than half of the total number of tiles.

Details

This function is called with the constructor msweepeR, and it's recommended that it's only called through such class constructor.

Value

This function returns an R object of class msBoard. It contains a matrix representing the mines positions in the game board, a matrix representing the mine count in the 8 neighbouring tiles, and a matrix representing the player's uncovered tiles and flags. The msBoard object also includes some basic info about the game, like the number of turns (moves) playes, whether the player has already opened a mined tile, the total number of flags, the total number of mines, and the board size.

See Also

msweepeR

Examples

1
x <- msBoard()

pablorm296/msweepeR documentation built on Nov. 4, 2019, 11:16 p.m.