Intelligence Community Game

I made a little game about the U.S. "Intelligence Community"

I had heard, during the U.S. presidential election debates, that "...all 17 intelligence agencies agree on..." and my immediate thought was "wait, we have 17 intelligence agencies?" I figured there was CIA, NSA, and FBI, but what are the others?

I went and read about the agencies on Wikipedia and had also been looking for something simple and fun to do while learning clojure and clojurescript.

I made a little game that tests your knowledge of the U.S. Intelligence Community in clojurescript. Using Parens of the Dead as a guideline, I set of to make a simple game that would force me to learn a bit about how to organize the code and what pieces to use.

I learned some things along the way. For instance, update-in, assoc-in, and get-in don't work when it turns out you are indexing into a LazySeq. When you map a vec, for example, it can get turned into a LazySeq. In the code below I "fixed" it by turning it back into a vec explicitly. Not sure if that is a good idea or not, but it works.

(defn reset-matched
  [coll]
  (vec (map #(dissoc % :matched?) coll)))

(-> state
    (update-in [:game :agencies] reset-matched)
    (update-in [:game :shields] reset-matched))