Description Usage Arguments Details Value See Also Examples
View source: R/gameFunctions.R
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.
1 |
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 |
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 |
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")
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.
is.msweepeR
, draw.msweepeR
, play.msweepeR
1 2 3 4 5 6 7 8 | ## Not run:
x <- msweepeR()
x <- play(x)
x <- msweepeR()
x <- play.msweepeR(x)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.