# HG changeset patch # User Robert McIntyre # Date 1331525444 18000 # Node ID b74a578d0c88a5b37452f3027e4aed6b91a824df # Parent 612393a0d3a003144f79d0108c4e3e09afc3ffe4 working on inventory analysis diff -r 612393a0d3a0 -r b74a578d0c88 clojure/com/aurellem/gb_driver.clj --- a/clojure/com/aurellem/gb_driver.clj Sun Mar 11 20:55:21 2012 -0500 +++ b/clojure/com/aurellem/gb_driver.clj Sun Mar 11 23:10:44 2012 -0500 @@ -176,4 +176,4 @@ `(do (defn ~@forms) (alter-var-root (var ~fun-name) memoize)))) - \ No newline at end of file + diff -r 612393a0d3a0 -r b74a578d0c88 clojure/com/aurellem/inspect.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clojure/com/aurellem/inspect.clj Sun Mar 11 23:10:44 2012 -0500 @@ -0,0 +1,78 @@ +(ns com.aurellem.inspect + (:use (com.aurellem gb-driver vbm)) + ;; this is fucking bullshit + (:import [com.aurellem.gb_driver SaveState])) + + + +(defn game-name [] + (map char (subvec (vec (memory)) 0x134 0x142))) + + + + + +(defn current-items [^SaveState state] + (set-state! state) + + + ) + + + + + + + + +;; try just buying five potions in sequence and see what changes +;; each time. + +(defn common-differences [& seqs] + (let [backbone (range (count (first seqs)))] + (filter + (comp (partial apply distinct?) second) + (zipmap backbone + (apply (partial map list) seqs))))) + +;; trying to find how items are represented in memory + +(def empty-inventory @current-state) + +(def one-potion @current-state) + +(def two-potions @current-state) + +(def three-potions @current-state) + +(def four-potions @current-state) + +(def five-potions @current-state) + + +;; result +(def canidates + (apply common-differences + (map (comp vec memory) + [empty-inventory one-potion two-potions three-potions + four-potions five-potions]))) + +(comment + [55875 (37 15 49 27 14 44)] + [55876 (30 1 49 56 55 23)] + [49158 (154 191 78 135 70 73)] + [54087 (49 40 37 34 25 22)] + [49160 (7 24 59 243 50 217)] + [49704 (31 14 72 33 84 27)] + [49162 (126 159 183 110 176 179)] + [39984 (0 254 251 248 127 252)] + [49904 (29 72 64 78 1 95)] + [65491 (222 127 149 132 226 38)] + [65492 (44 20 89 11 253 163)] + [49335 (52 15 6 14 3 17)] + [49720 (78 152 96 60 83 103)] + [65304 (19 89 214 33 18 113)] + [53561 (132 185 145 162 159 183)] + [54046 (0 1 2 3 4 5)]) + +;;; hmmmmmm...... I guess that the potion quantities are at 54046, huh? \ No newline at end of file