clear(row, col, border)
Clears a specific cell and all connected cells holding the same value as it via flood fill; with border = true, the rim where the flood stops is cleared too.
Example
(click on any cell to perform flood fill with selected border option; press any key to reset)
Note
Connected means same value, and sameness is identity (
===) — see clear(row, col, directions). Withborder = true, the flood also clears the rim: the non-matching cells adjacent to the region, exactly where the expansion stops — the classic Minesweeper cascade, revealing the numbers that surround a cleared area.
Syntax
clear(row, col, border)
Parameters
| Param | Description |
|---|---|
row |
Number: row index of the cell to start clearing [0..height] |
col |
Number: column index of the cell to start clearing [0..width] |
border |
Boolean: Specifies whether to include the border of the flood fill area. Default is false |
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillecellLengthmouseRowmouseColrandclear- p5.js
createCanvasbackgroundcolorvaluecreateSelectoptionselected
Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.