Skip to content

Instantly share code, notes, and snippets.

@u6f6o
Created March 8, 2016 14:50
Show Gist options
  • Select an option

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

Select an option

Save u6f6o/aeeec66e3783beefe0ba to your computer and use it in GitHub Desktop.
(defn- nice-neighbours
[board idx]
(let [mines (:mines board)
explored (:explored board)
neighbours (neighbours board idx)
is-set? (fn [[k v]] (pos? v))]
(when
(not-any? is-set? (select-keys mines neighbours))
(->> (select-keys explored neighbours)
(remove is-set?)
(keys)
(into #{})))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment