fun (version 0.2)

lights_out: Play the ``Lights Out'' game in R

Description

By default, the white squares in the plot denote the lights that are on, and black ones for the off. When you click on a light, this light as well as the four neighbors will switch theirs status. Your mission is to close all the lights.

Usage

lights_out(width = 5, height = 5, steps = 3, cheat = FALSE, col.off = "black", 
    col.on = "white", col.frame = "lightblue", seed = NULL)

Arguments

width

number of lights in x axis

height

number of lights in y axis

steps

number of ``seed'' lights to initialize the puzzle. In general, the larger steps is, the more complex this puzzle may be

cheat

logical. If TRUE a data frame indicating the steps to solve this puzzle will be printed

col.off

color when lights off

col.on

color when lights on

col.frame

color of lights border

seed

seed for random number generator

References

http://en.wikipedia.org/wiki/Lights_Out_(game)

Examples

Run this code
# NOT RUN {
## should use Xlib for the x11() device under *nix, e.g
if (interactive()) {
    if (.Platform$OS.type == "windows") 
        x11() else x11(type = "Xlib")
    lights_out()
}
# }

Run the code above in your browser using DataLab