Mercurial > vba-clojure
changeset 320:9637a0f52e7b
located item-list related addresses.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 03 Apr 2012 23:17:33 -0500 |
parents | 92c47a9cdaea |
children | af86b5ba622b |
files | clojure/com/aurellem/gb/saves.clj clojure/com/aurellem/gb/util.clj clojure/com/aurellem/run/bootstrap_0.clj clojure/com/aurellem/run/util.clj save-states/cursor-item-1.sav save-states/cursor-item-2.sav save-states/cursor-item-3.sav save-states/cursor-item-4.sav save-states/cursor-item-5.sav save-states/cursor-item-6.sav save-states/down-1.sav save-states/down-2.sav save-states/down-3.sav save-states/down-4.sav save-states/down-5.sav save-states/pika.sav save-states/up-1.sav save-states/up-2.sav save-states/up-3.sav save-states/up-4.sav save-states/up-5.sav save-states/up-6.sav |
diffstat | 22 files changed, 72 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/saves.clj Tue Apr 03 04:16:20 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/saves.clj Tue Apr 03 23:17:33 2012 -0500 1.3 @@ -28,4 +28,17 @@ 1.4 1.5 (defn end-oak-conv [] 1.6 (read-state "end-oak-conversation")) 1.7 - 1.8 \ No newline at end of file 1.9 + 1.10 + 1.11 +(defmacro gen-save [save-name] 1.12 + `(defn ~save-name 1.13 + ~(str "load " save-name " from disk.") 1.14 + [] 1.15 + (read-state ~(str save-name)))) 1.16 + 1.17 +(gen-save cursor-item-1) 1.18 +(gen-save cursor-item-2) 1.19 +(gen-save cursor-item-3) 1.20 +(gen-save cursor-item-4) 1.21 +(gen-save cursor-item-5) 1.22 +(gen-save cursor-item-6) 1.23 \ No newline at end of file
2.1 --- a/clojure/com/aurellem/gb/util.clj Tue Apr 03 04:16:20 2012 -0500 2.2 +++ b/clojure/com/aurellem/gb/util.clj Tue Apr 03 23:17:33 2012 -0500 2.3 @@ -159,10 +159,26 @@ 2.4 (map (comp vec memory) 2.5 states))) 2.6 2.7 +(defn different-every-time [& seqs] 2.8 + (let [backbone (range (count (first seqs)))] 2.9 + (sort-by 2.10 + first 2.11 + (filter 2.12 + (comp (fn [seq] (reduce #(not= %1 %2) seq)) second) 2.13 + (zipmap backbone 2.14 + (apply (partial map list) seqs)))))) 2.15 + 2.16 + 2.17 +(defn harmonic-compare [& states] 2.18 + (apply different-every-time 2.19 + (map (comp vec memory) 2.20 + states))) 2.21 + 2.22 (defn mid-game [] 2.23 (read-state "mid-game")) 2.24 2.25 - 2.26 +(defn watch-memory [address] 2.27 + (loop [] (step) (view-memory address) (recur))) 2.28 2.29 (defn disect-bytes-2 2.30 "return a vector consiting of the last 16 bytes of the
3.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Tue Apr 03 04:16:20 2012 -0500 3.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Tue Apr 03 23:17:33 2012 -0500 3.3 @@ -1,5 +1,6 @@ 3.4 (ns com.aurellem.run.bootstrap-0 3.5 - (:use (com.aurellem.gb gb-driver util items vbm characters money)) 3.6 + (:use (com.aurellem.gb saves gb-driver util 3.7 + items vbm characters money)) 3.8 (:use (com.aurellem.run util title save-corruption)) 3.9 (:use (com.aurellem.exp item-bridge)) 3.10 (:import [com.aurellem.gb.gb_driver SaveState])) 3.11 @@ -317,6 +318,26 @@ 3.12 (->> script 3.13 (walk [↑ ↑ ←])))) 3.14 3.15 + 3.16 + 3.17 +;; useful addresses 3.18 +52262 ;; --- current-cursor-offset 3.19 +52278 ;; --- current screen-offset 3.20 + 3.21 + 3.22 +(defn exp-item-list [] 3.23 + (clojure.pprint/pprint 3.24 + (apply harmonic-compare 3.25 + (map read-state 3.26 + ["up-1" "down-1" 3.27 + "up-2" "down-2" 3.28 + "up-3" "down-3" 3.29 + "up-4" "down-4" 3.30 + "up-5" "down-5" 3.31 + "up-6"])))) 3.32 + 3.33 + 3.34 + 3.35 (defn buy-item 3.36 "Assumes that the main item-screen is up, and buys 3.37 quantity of the nth item in the list, assuming that you
4.1 --- a/clojure/com/aurellem/run/util.clj Tue Apr 03 04:16:20 2012 -0500 4.2 +++ b/clojure/com/aurellem/run/util.clj Tue Apr 03 23:17:33 2012 -0500 4.3 @@ -107,19 +107,21 @@ 4.4 (move dir script)) script directions)) 4.5 4.6 (defn search-string 4.7 - [^SaveState state string] 4.8 - (let [codes 4.9 - (str->character-codes string) 4.10 - codes-length (count codes) 4.11 - mem (vec (memory state)) 4.12 - mem-length (count mem)] 4.13 - (loop [idx 0] 4.14 - (if (< (- mem-length idx) codes-length) 4.15 - nil 4.16 - (if (= (subvec mem idx (+ idx codes-length)) 4.17 - codes) 4.18 - idx 4.19 - (recur (inc idx))))))) 4.20 + ([^SaveState state string] 4.21 + (let [codes 4.22 + (str->character-codes string) 4.23 + codes-length (count codes) 4.24 + mem (vec (memory state)) 4.25 + mem-length (count mem)] 4.26 + (loop [idx 0] 4.27 + (if (< (- mem-length idx) codes-length) 4.28 + nil 4.29 + (if (= (subvec mem idx (+ idx codes-length)) 4.30 + codes) 4.31 + idx 4.32 + (recur (inc idx))))))) 4.33 + ([string] 4.34 + (search-string @current-state string))) 4.35 4.36 (def text-address 0x9DC1) 4.37 4.38 @@ -143,8 +145,10 @@ 4.39 4.40 (defn end-text 4.41 ([script] 4.42 - (->> (do-nothing 150) 4.43 - (play-moves [[:b]])))) 4.44 + (->> 4.45 + script 4.46 + (do-nothing 150) 4.47 + (play-moves [[:b]])))) 4.48 4.49 (defn do-nothing [n script] 4.50 (->> script
5.1 Binary file save-states/cursor-item-1.sav has changed
6.1 Binary file save-states/cursor-item-2.sav has changed
7.1 Binary file save-states/cursor-item-3.sav has changed
8.1 Binary file save-states/cursor-item-4.sav has changed
9.1 Binary file save-states/cursor-item-5.sav has changed
10.1 Binary file save-states/cursor-item-6.sav has changed
11.1 Binary file save-states/down-1.sav has changed
12.1 Binary file save-states/down-2.sav has changed
13.1 Binary file save-states/down-3.sav has changed
14.1 Binary file save-states/down-4.sav has changed
15.1 Binary file save-states/down-5.sav has changed
16.1 Binary file save-states/pika.sav has changed
17.1 Binary file save-states/up-1.sav has changed
18.1 Binary file save-states/up-2.sav has changed
19.1 Binary file save-states/up-3.sav has changed
20.1 Binary file save-states/up-4.sav has changed
21.1 Binary file save-states/up-5.sav has changed
22.1 Binary file save-states/up-6.sav has changed