Description Usage Arguments Details See Also Examples
View source: R/gameFunctions.R
Once you started a msweepeR game session, by assigning it to a new object x <- msweepeR()
,
you can start playing by using this method (play.msweepeR
). See details for more info on how
to play msweepeR.
1 |
x |
A msweepeR session (an R object of class |
Once you started a msweepeR session, by assigning it to a new object x <- msweepeR()
,
you can start playing by using this method (play.msweepeR(x)
). This method will first print basic info about
the game session and the game board (contained in the msweepeR
object), and then it will draw the game board in
the output console. After that, you'll be asked to make a move. As in any other minsweeper game, you can either open
a tile to reveal its content, or you can put a flag on top of a tile.
To make a move you have to use a special msweepeR command syntax:
action @ row_num, col_num
.
Where action
is either 'open' or 'flag', and row_num, col_num
correspond to the
coordinates of the desired tile in the game board. Imagine that the game board is a matrix,
and each tile is an element within such matrix; therefore, each tile has an row, col coordinate (like any other matrix
in R). You'll see the row and column numbers printed in the first column and first row of the board respectively.
For example, if you want to open tile [1,1], you'll have to type: open @ 1,1
If you want to put a flag on tile [3,7], you'll have to type: flag @ 3,7
Once you introduced a valid command, it will be parsed and evaluated. If you opened an empty tile, or you placed a flag, the board will be printed again in the console and you'll be asked again what's your desired move. If you have flaged all mined tiles, you'll win. However, if you open a mined tile, you'll loose.
If you type an invalid command, a warning will be printed, and you'll be asked again to type a valid command.
is.msweepeR
, draw.msweepeR
, msweepeR
1 2 3 4 | ## Not run:
x <- msweepeR(); play.msweepeR(x)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.