msweepeR: Create a new msweepeR session

Description Usage Arguments Details Value See Also Examples

View source: R/gameFunctions.R

Description

This function creates a new msweepeR game (session). As in the classic Microsoft Minesweeper included in various Windows standard installs, you can choose between three levels of difficulty: beginner, intermediate, and expert. However, unlike the MS version, you have to manually define the height and width of the board. By default, height and width are set to 10 tiles. Please keep in mind that the board must be narrower than the console width, since a larger game board could not be printed in the console.

Usage

1
msweepeR(w = 10, h = 10, level = 1, mines = NULL)

Arguments

w

Width of the game board. Must be an integer > 3. Please keep in mind that the board must be narrower than the console width.

h

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

level

Difficulty level of the game. Must be an integer between 1 and 3 (beginner, intermediate, and expert). If level is set to NULL, you can manually set the number of mines in the gameboard (see mines).

mines

Number of mines in the game board. Must be a positive integer. You can only manually define the number of mines if you set level to NULL. Please keep in mind that the number of mines can't be higher than half of the total number of tiles.

Details

Once you created a new msweepeR session (by assigning it to a new object x <- msweepeR() ), you can start playing by invoking the play.msweepeR method: play.msweepeR(x). A full explanation on how to play is in this vignette:

vignette("How to play msweepeR", package = "msweepeR")

Value

This function returns an R object of class msweepeR. This object contains basic information about the msweepeR session, like the start time and whether the game has already started. It also contains a msBoard class object, containing all the game board attributes.

See Also

is.msweepeR, draw.msweepeR, play.msweepeR

Examples

1
2
3
4
5
6
7
8
## Not run: 
x <- msweepeR()
x <- play(x)

x <- msweepeR()
x <- play.msweepeR(x)

## End(Not run)

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