diff clojure/com/aurellem/fragments.clj @ 76:d7c38ce83421

working on disk-backup for save-states
author Robert McIntyre <rlm@mit.edu>
date Thu, 08 Mar 2012 19:48:54 -0600
parents eb7d4efe0f34
children
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/fragments.clj	Thu Mar 08 06:01:09 2012 -0600
     1.2 +++ b/clojure/com/aurellem/fragments.clj	Thu Mar 08 19:48:54 2012 -0600
     1.3 @@ -17,18 +17,19 @@
     1.4                  (repeat (- start-frames n 1) []))
     1.5          moves (drop start moves)]
     1.6      (goto start)
     1.7 -    (dorun (map step moves))
     1.8 +    (dorun (map step! moves))
     1.9      (nth (registers) 2)))
    1.10  
    1.11 -
    1.12  (defn earliest-press
    1.13    [start]
    1.14    (print "determining bad program-counter...")
    1.15 +  (reset)
    1.16 +  (dorun (dotimes [_ start-frames] (step)))
    1.17    (let [bad-counter (play-start 0 0)]
    1.18      (println bad-counter)
    1.19      (loop [n start]
    1.20        (print "trying" n "...")
    1.21 -      (let [nth-counter (play-start n)]
    1.22 +      (let [nth-counter (play-start (dec n) n)]
    1.23          (println "got" nth-counter)
    1.24          (if (= nth-counter bad-counter)
    1.25            (recur (inc n)) n)))))