diff clojure/com/aurellem/gb/util.clj @ 321:af86b5ba622b

created function to determine total item-offset
author Robert McIntyre <rlm@mit.edu>
date Wed, 04 Apr 2012 00:16:49 -0500
parents 9637a0f52e7b
children 92f0011925d2
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/util.clj	Tue Apr 03 23:17:33 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/util.clj	Wed Apr 04 00:16:49 2012 -0500
     1.3 @@ -164,7 +164,8 @@
     1.4      (sort-by
     1.5       first
     1.6       (filter
     1.7 -      (comp (fn [seq] (reduce #(not= %1 %2) seq)) second)
     1.8 +      (comp (fn [seq] (not (contains? (set (map - seq (rest seq)))
     1.9 +                                      0))) second)
    1.10        (zipmap backbone
    1.11                (apply (partial map list) seqs))))))
    1.12  
    1.13 @@ -177,8 +178,17 @@
    1.14  (defn mid-game []
    1.15    (read-state "mid-game"))
    1.16  
    1.17 -(defn watch-memory [address]
    1.18 -  (loop [] (step) (view-memory address) (recur)))
    1.19 +(defn watch-memory
    1.20 +  ([^SaveState state address]
    1.21 +     (set-state! state)
    1.22 +     (loop [] (step) (view-memory address) (recur)))
    1.23 +  ([address] (watch-memory @current-state address)))
    1.24 +
    1.25 +(defn watch-fn
    1.26 +  ([^SaveState state state-fn]
    1.27 +     (set-state! state)
    1.28 +     (loop [] (step) (state-fn @current-state) (recur)))
    1.29 +  ([state-fn] (watch-fn @current-state state-fn)))
    1.30  
    1.31  (defn disect-bytes-2
    1.32    "return a vector consiting of the last 16 bytes of the