random_board | R Documentation |
Create a Lights Out board that can be played by the user or solved automatically.
Only square boards of size 3x3, 5x5, 7x7, or 9x9 are supported. The initial
lights configuration is randomly generated, but always solvable. To create a
board with a user-defined configuration, use the new_board
function.
random_board(size, classic = TRUE)
size |
Number of rows and columns for the board |
classic |
If |
A lightsout
board object.
new_board
play
solve_board
set.seed(10)
# Create a random 5x5 classic board
board <- random_board(5)
board
# Get the solution for the board
solution <- solve_board(board)
solution
# Press the lights according to the solution, the result should be a board
# with all lights switched off
play(board, matrix = solution)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.