1.0.1 • Published 5 years ago
@burntcoffee/flood-fill v1.0.1
FloodFill
An efficient implementation of the Flood Fill algorithm in javascript.
Install
$ npm install @burntcoffee/flood-fill
Usage
const floodFill = require('@burntcoffee/flood-fill');
let matrix = [
[1, 0, 0, 0, 1, 0, 0],
[1, 1, 0, 1, 0, 0, 1],
[0, 1, 1, 1, 1, 0, 0]
];
matrix = floodFill(matrix, 0, 0, 3);
The floodFill()
function expects a two dimensional array of strings or integers, the x and y positions of the target, and the value that will replace the target.