comparison 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
comparison
equal deleted inserted replaced
320:9637a0f52e7b 321:af86b5ba622b
162 (defn different-every-time [& seqs] 162 (defn different-every-time [& seqs]
163 (let [backbone (range (count (first seqs)))] 163 (let [backbone (range (count (first seqs)))]
164 (sort-by 164 (sort-by
165 first 165 first
166 (filter 166 (filter
167 (comp (fn [seq] (reduce #(not= %1 %2) seq)) second) 167 (comp (fn [seq] (not (contains? (set (map - seq (rest seq)))
168 0))) second)
168 (zipmap backbone 169 (zipmap backbone
169 (apply (partial map list) seqs)))))) 170 (apply (partial map list) seqs))))))
170 171
171 172
172 (defn harmonic-compare [& states] 173 (defn harmonic-compare [& states]
175 states))) 176 states)))
176 177
177 (defn mid-game [] 178 (defn mid-game []
178 (read-state "mid-game")) 179 (read-state "mid-game"))
179 180
180 (defn watch-memory [address] 181 (defn watch-memory
181 (loop [] (step) (view-memory address) (recur))) 182 ([^SaveState state address]
183 (set-state! state)
184 (loop [] (step) (view-memory address) (recur)))
185 ([address] (watch-memory @current-state address)))
186
187 (defn watch-fn
188 ([^SaveState state state-fn]
189 (set-state! state)
190 (loop [] (step) (state-fn @current-state) (recur)))
191 ([state-fn] (watch-fn @current-state state-fn)))
182 192
183 (defn disect-bytes-2 193 (defn disect-bytes-2
184 "return a vector consiting of the last 16 bytes of the 194 "return a vector consiting of the last 16 bytes of the
185 integer expressed as two 8 bit numbers (inside an integer) 195 integer expressed as two 8 bit numbers (inside an integer)
186 in the form [high-bits low-bits]." 196 in the form [high-bits low-bits]."