diff clojure/com/aurellem/gb_driver.clj @ 81:db8e0a563c8e

generated intro
author Robert McIntyre <rlm@mit.edu>
date Fri, 09 Mar 2012 01:43:25 -0600
parents 7ab48d728ee4
children 04d539d26bdc
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb_driver.clj	Thu Mar 08 22:29:11 2012 -0600
     1.2 +++ b/clojure/com/aurellem/gb_driver.clj	Fri Mar 09 01:43:25 2012 -0600
     1.3 @@ -6,7 +6,7 @@
     1.4  
     1.5  (Gb/loadVBA)
     1.6  
     1.7 -(def ^:dynamic *max-history* 1e4)
     1.8 +(def ^:dynamic *max-history* 2e4)
     1.9  
    1.10  (def ^:dynamic *backup-saves-to-disk* true)
    1.11  
    1.12 @@ -136,10 +136,11 @@
    1.13    ([] (rewind 1))
    1.14    ([n] (goto (- @current-frame n))))
    1.15  
    1.16 -(defn backup-state [frame]
    1.17 +(defn backup-state
    1.18 +  [frame]
    1.19    (let [save (save-state)]
    1.20      (swap! history #(assoc % frame save))
    1.21 -    (store-save-to-disk save)
    1.22 +    ;;(store-save-to-disk save)
    1.23      (if (> (count @history) *max-history*)
    1.24        (swap! history #(dissoc % (first (first %)))))))
    1.25  
    1.26 @@ -156,6 +157,13 @@
    1.27         (Gb/step mask-or-buttons)
    1.28         (Gb/step (button-mask mask-or-buttons)))))
    1.29  
    1.30 +(defn play-moves
    1.31 +  ([start moves]
    1.32 +     (goto start)
    1.33 +     (dorun (map step moves)))
    1.34 +  ([moves]
    1.35 +     (dorun (map step moves))))
    1.36 +
    1.37  (defn play
    1.38    ([] (play Integer/MAX_VALUE))
    1.39    ([n] (dorun (dotimes [_ n] (step)))))