Skip to content

Instantly share code, notes, and snippets.

@naush
Created February 12, 2011 23:03
Show Gist options
  • Save naush/824219 to your computer and use it in GitHub Desktop.
Save naush/824219 to your computer and use it in GitHub Desktop.
(defn find-liberty-helper [board point size]
(filter #(gray? board % size) (find-neighbors point size)))
(defn find-liberty [board points size]
(loop [points points liberty ()]
(let [point (first points)]
(if (= 0 (count points))
(set liberty)
(recur (rest points) (clojure.set/union (find-liberty-helper board point size) liberty))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment