minesweeper: The Minesweeper game in R

View source: R/minesweeper.r

minesweeperR Documentation

The Minesweeper game in R

Description

A poor man's implementation of the minesweeper game in R. Yes, you are right: it has nothing to do with time series decomposition, changepoint detection, and time series segmentation. Its only remote connection to Rbeast is that this is a practice script I wrote to learn R graphics for implementing Rbeast.

Figure: minesweeper.png

Usage

	minesweeper(height=15, width=12, prob=0.1) 

Arguments

height

integer; number of rows of the mine grid along the vertical direction.

width

integer; number of columns of the mine grid along the horizontal direction.

prob

numeric; a fraction between 0 and 1 to specify the probability of mine occurrence in the mine grid.

Value

Instructions:

  • LEFT-click to clear a spot.

  • RIGHT-click to flag a spot.

  • MIDDLE-click(wheel) a cleared and numbered spot to open neighbor spots, if flagged correctly.

  • Click Restart for a new game

Note

An interactive graphics window is needed to run this function correctly. So it won't run in RStudio's plot pane. The function will use the x11() or x11(type='Xlib') graphic device to open a pop-up window.

References

  1. Zhao, K., Wulder, M.A., Hu, T., Bright, R., Wu, Q., Qin, H., Li, Y., Toman, E., Mallick, B., Zhang, X. and Brown, M., 2019. Detecting change-point, trend, and seasonality in satellite time series data to track abrupt changes and nonlinear dynamics: A Bayesian ensemble algorithm. Remote Sensing of Environment, 232, p.111181 (the beast algorithm paper).

  2. Zhao, K., Valle, D., Popescu, S., Zhang, X. and Mallick, B., 2013. Hyperspectral remote sensing of plant biochemistry using Bayesian model averaging with variable and band selection. Remote Sensing of Environment, 132, pp.102-119 (the Bayesian MCMC scheme used in beast).

  3. Hu, T., Toman, E.M., Chen, G., Shao, G., Zhou, Y., Li, Y., Zhao, K. and Feng, Y., 2021. Mapping fine-scale human disturbances in a working landscape with Landsat time series on Google Earth Engine. ISPRS Journal of Photogrammetry and Remote Sensing, 176, pp.250-261(a beast application paper).

See Also

beast, beast.irreg, beast123, tetris, geeLandsat

Examples



 library(Rbeast)
 
 ## Not run: 
 minesweeper() 
 
 # A mine field of size 20x25 with rougly a 15
 minesweeper(20,25,0.15) 
 
## End(Not run)



Rbeast documentation built on Sept. 12, 2024, 7:36 a.m.