Last chance! 50% off unlimited learning
Sale ends in
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.
lights_out(
width = 5,
height = 5,
steps = 3,
cheat = FALSE,
col.off = "black",
col.on = "white",
col.frame = "lightblue",
seed = NULL
)
number of lights in x axis
number of lights in y axis
number of ``seed'' lights to initialize the puzzle. In general,
the larger steps
is, the more complex this puzzle may be
logical. If TRUE
a data frame indicating the steps to
solve this puzzle will be printed
color when lights off
color when lights on
color of lights border
seed for random number generator
# 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