view clojure/com/aurellem/inspect.clj @ 95:b74a578d0c88

working on inventory analysis
author Robert McIntyre <rlm@mit.edu>
date Sun, 11 Mar 2012 23:10:44 -0500
parents
children cb487c4ce5c0
line wrap: on
line source
1 (ns com.aurellem.inspect
2 (:use (com.aurellem gb-driver vbm))
3 ;; this is fucking bullshit
4 (:import [com.aurellem.gb_driver SaveState]))
8 (defn game-name []
9 (map char (subvec (vec (memory)) 0x134 0x142)))
15 (defn current-items [^SaveState state]
16 (set-state! state)
19 )
28 ;; try just buying five potions in sequence and see what changes
29 ;; each time.
31 (defn common-differences [& seqs]
32 (let [backbone (range (count (first seqs)))]
33 (filter
34 (comp (partial apply distinct?) second)
35 (zipmap backbone
36 (apply (partial map list) seqs)))))
38 ;; trying to find how items are represented in memory
40 (def empty-inventory @current-state)
42 (def one-potion @current-state)
44 (def two-potions @current-state)
46 (def three-potions @current-state)
48 (def four-potions @current-state)
50 (def five-potions @current-state)
53 ;; result
54 (def canidates
55 (apply common-differences
56 (map (comp vec memory)
57 [empty-inventory one-potion two-potions three-potions
58 four-potions five-potions])))
60 (comment
61 [55875 (37 15 49 27 14 44)]
62 [55876 (30 1 49 56 55 23)]
63 [49158 (154 191 78 135 70 73)]
64 [54087 (49 40 37 34 25 22)]
65 [49160 (7 24 59 243 50 217)]
66 [49704 (31 14 72 33 84 27)]
67 [49162 (126 159 183 110 176 179)]
68 [39984 (0 254 251 248 127 252)]
69 [49904 (29 72 64 78 1 95)]
70 [65491 (222 127 149 132 226 38)]
71 [65492 (44 20 89 11 253 163)]
72 [49335 (52 15 6 14 3 17)]
73 [49720 (78 152 96 60 83 103)]
74 [65304 (19 89 214 33 18 113)]
75 [53561 (132 185 145 162 159 183)]
76 [54046 (0 1 2 3 4 5)])
78 ;;; hmmmmmm...... I guess that the potion quantities are at 54046, huh?