Mercurial > vba-clojure
changeset 95:b74a578d0c88
working on inventory analysis
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 11 Mar 2012 23:10:44 -0500 |
parents | 612393a0d3a0 |
children | cb487c4ce5c0 |
files | clojure/com/aurellem/gb_driver.clj clojure/com/aurellem/inspect.clj |
diffstat | 2 files changed, 79 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb_driver.clj Sun Mar 11 20:55:21 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb_driver.clj Sun Mar 11 23:10:44 2012 -0500 1.3 @@ -176,4 +176,4 @@ 1.4 `(do 1.5 (defn ~@forms) 1.6 (alter-var-root (var ~fun-name) memoize)))) 1.7 - 1.8 \ No newline at end of file 1.9 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/clojure/com/aurellem/inspect.clj Sun Mar 11 23:10:44 2012 -0500 2.3 @@ -0,0 +1,78 @@ 2.4 +(ns com.aurellem.inspect 2.5 + (:use (com.aurellem gb-driver vbm)) 2.6 + ;; this is fucking bullshit 2.7 + (:import [com.aurellem.gb_driver SaveState])) 2.8 + 2.9 + 2.10 + 2.11 +(defn game-name [] 2.12 + (map char (subvec (vec (memory)) 0x134 0x142))) 2.13 + 2.14 + 2.15 + 2.16 + 2.17 + 2.18 +(defn current-items [^SaveState state] 2.19 + (set-state! state) 2.20 + 2.21 + 2.22 + ) 2.23 + 2.24 + 2.25 + 2.26 + 2.27 + 2.28 + 2.29 + 2.30 + 2.31 +;; try just buying five potions in sequence and see what changes 2.32 +;; each time. 2.33 + 2.34 +(defn common-differences [& seqs] 2.35 + (let [backbone (range (count (first seqs)))] 2.36 + (filter 2.37 + (comp (partial apply distinct?) second) 2.38 + (zipmap backbone 2.39 + (apply (partial map list) seqs))))) 2.40 + 2.41 +;; trying to find how items are represented in memory 2.42 + 2.43 +(def empty-inventory @current-state) 2.44 + 2.45 +(def one-potion @current-state) 2.46 + 2.47 +(def two-potions @current-state) 2.48 + 2.49 +(def three-potions @current-state) 2.50 + 2.51 +(def four-potions @current-state) 2.52 + 2.53 +(def five-potions @current-state) 2.54 + 2.55 + 2.56 +;; result 2.57 +(def canidates 2.58 + (apply common-differences 2.59 + (map (comp vec memory) 2.60 + [empty-inventory one-potion two-potions three-potions 2.61 + four-potions five-potions]))) 2.62 + 2.63 +(comment 2.64 + [55875 (37 15 49 27 14 44)] 2.65 + [55876 (30 1 49 56 55 23)] 2.66 + [49158 (154 191 78 135 70 73)] 2.67 + [54087 (49 40 37 34 25 22)] 2.68 + [49160 (7 24 59 243 50 217)] 2.69 + [49704 (31 14 72 33 84 27)] 2.70 + [49162 (126 159 183 110 176 179)] 2.71 + [39984 (0 254 251 248 127 252)] 2.72 + [49904 (29 72 64 78 1 95)] 2.73 + [65491 (222 127 149 132 226 38)] 2.74 + [65492 (44 20 89 11 253 163)] 2.75 + [49335 (52 15 6 14 3 17)] 2.76 + [49720 (78 152 96 60 83 103)] 2.77 + [65304 (19 89 214 33 18 113)] 2.78 + [53561 (132 185 145 162 159 183)] 2.79 + [54046 (0 1 2 3 4 5)]) 2.80 + 2.81 +;;; hmmmmmm...... I guess that the potion quantities are at 54046, huh? 2.82 \ No newline at end of file