percolate.board: percolate.board

Description Usage Arguments Value Examples

View source: R/percolate.R

Description

percolate.board

Usage

1
2
## S3 method for class 'board'
percolate(start_board)

Arguments

start_board

board(matrix) of initial stage

Value

list of result_board(after the percolate end), and result whether it is percolate or not

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
mat_example_list <- list(matrix(c(1,1,1,1,0,
0,0,0,1,0,
1,1,1,1,0,
0,1,0,0,0,
0,1,1,1,1), 5, 5),
matrix(c(1,1,1,1,0,
        0,0,0,1,0,
        0,1,1,1,0,
        0,1,0,0,0,
        0,1,1,1,1), 5, 5),
matrix(c(1,1,1,1,0,
        0,0,0,1,0,
        0,1,1,0,0,
        0,1,1,1,1), 5, 5))
## turn matrices to board
example_boards <- lapply(mat_example_list, board)
## apply boards to percolate.board
laply(example_boards, percolate.board)

sthkindacrazy/percolate documentation built on Nov. 5, 2019, 9:38 a.m.