A Clojure Library for the Flood Fill algorithm.
The code was copied from a reddit challenge and only minor changes were made.
Add the following entry to the :dependencies
vector of your project.clj
file:
[]
(https://clojars.org/the-flood)
user=> (require '[the-flood.core :refer [flood-fill]])
nil
user=> (flood-fill [["O" "O" "O" "O" "O"]
["O" "O" "O" "O" "O"]
["O" "A" "O" "O" "O"]
["O" "O" "O" "O" "O"]
["O" "O" "O" "O" "O"]
["O" "O" "O" "O" "O"]]
[1 1] "R" nil)
;=>
[["R" "R" "R" "R" "R"]
["R" "R" "R" "R" "R"]
["R" "A" "R" "R" "R"]
["R" "R" "R" "R" "R"]
["R" "R" "R" "R" "R"]
["R" "R" "R" "R" "R"]]