           p2max (apply max 0 p2-luck-cards)]
       (cond
        (= p1max p2max) (rand-nth [p1 p2])
-       
+
        (> p1max p2max)
        (let [r (rand-int 100)]
          (if (<= r p1max) p1 p2))
-       
+
        :else
        (let [r (rand-int 100)]
          (if (<= p2max r) p2 p1))))))

     (let [c (get-in c/cards [card])]
       (conj v {:key card
                :turns-left (:turns-left c)})))))

;;; API



;; Functions to operate on game state

(def terminal-hierarchy
  (-> (make-hierarchy)
      (derive :terminal-left-paren :terminal)
      (derive :terminal-right-paren :terminal)
      (derive :terminal-left-square :terminal)
      (derive :terminal-right-square :terminal)

      (derive :terminal-id :terminal-param)
      (derive :terminal-num :terminal-param)

