Skip to content

Instantly share code, notes, and snippets.

@u6f6o
Created March 8, 2016 15:07
Show Gist options
  • Select an option

  • Save u6f6o/fb778a2e78870c84857d to your computer and use it in GitHub Desktop.

Select an option

Save u6f6o/fb778a2e78870c84857d to your computer and use it in GitHub Desktop.
(defn- explore-cell
([board idx]
(explore-cell board #{} #{idx}))
([board explored remaining]
(if (empty? remaining)
board
(let [curr (first remaining)
explored (conj explored curr)
remaining (disj remaining curr)
board (set-explored board curr)
candidates (nice-neighbours board curr)
remaining (union remaining (difference candidates explored))]
(recur board explored remaining)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment