change.msBoard: Changes the state of a tile in a msweepeR board

Description Usage Arguments Details Value See Also Examples

View source: R/msBoard.R

Description

This method updates a msweepeR board by opening a tile or by placing a flag on it. If the opened tile contains a mine, the game it's over.

Usage

1

Arguments

x

A msweepeR board (an R object of class msBoard).

action

A character vector of length 1. Valid options are: "open" and "flag".

row

Row number of the desired tile to interact with. Must be a positive integer. Each tile in the game board has a [row, col] coordinate, ike any other matrix like object in R.

col

Column number of the desired tile to interact with. Must be a positive integer. Each tile in the game board has a [row, col] coordinate, like any other matrix like object in R.

warnings

Logical vector of length 1. Indicates whether warnings are enabled.

Details

This method is called with the S3 method play.msweepeR, and it's recommended that it's only called through such method.

Value

This method returns the updated msweepeR board (an R object of class msBoard).

See Also

msweepeR, msBoard

Examples

1
2
x <- msBoard()
x <- change.msBoard(x, "open", 1, 1, FALSE)

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