Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is_solved

Is the given board is a solved state?


Description

A board is considered solved if all the lights are switched off (have a state of 0).

Usage

is_solved(board)

Arguments

board

A lightsout board

Value

TRUE if the given board is solved; FALSE otherwise.

See Also

Examples

# Create a board solved with one move and solve it.
lights <- c(1, 1, 0,
            1, 0, 0,
            0, 0, 0 )
board <- new_board(lights)
is_solved(board)
board <- board %>% play(1, 1)
is_solved(board)

lightsout

Implementation of the 'Lights Out' Puzzle Game

v0.3
MIT + file LICENSE
Authors
Dean Attali [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.