   (when (pay state side :click 1 :credit 1)
     (add-prop state side card :advance-counter 1)
     (system-msg state side "advance a card")))
-
-(defn gain-agenda-point [state side n]
-  (gain state side :agenda-point n)
-  (when (>= (get-in @state [side :agenda-point]) (get-in @state [side :agenda-point-req]))
-    (system-msg state side "wins the game")))
-
-(defn score [state side {:keys [card]}]
-  (when (>= (:advance-counter card) (:advancementcost card))
-    (let [moved-card (move state side card  :scored)
-          c (card-init state side moved-card)]
-      (system-msg state side (str "scores " (:title c) " and gains " (:agendapoints c) " agenda points"))
-      (gain-agenda-point state side (:agendapoints c))
-      (set-prop state side c :advance-counter 0)
-      (trigger-event state side (if (= side :corp) :agenda-scored :agenda-stolen) c))))

      (swap! state assoc-in [side (first r)] 0)
      (swap! state update-in [side (first r)] #(max (- % (last r)) 0)))))

(defn run [state side {:keys [server] :as args}]
  (pay state :runner :click 1)
  (let [s (case server

    (flatline state))
  (trigger-event state side :turn-ends nil)
  (swap! state assoc :end-turn true))

(defn purge [state side]
  (doseq [card (get-in @state [:runner :rig :program])]
