is_solved: Is the given board is a solved state?

Description Usage Arguments Value See Also Examples

View source: R/solve.R

Description

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

Usage

1
is_solved(board)

Arguments

board

A lightsout board

Value

TRUE if the given board is solved; FALSE otherwise.

See Also

is_solvable solve_board

Examples

1
2
3
4
5
6
7
8
# 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 documentation built on May 2, 2019, 1:10 p.m.