comparison clojure/com/aurellem/items.clj @ 98:08cd8be1edc1

renamed inspect.clj to items.clj
author Robert McIntyre <rlm@mit.edu>
date Mon, 12 Mar 2012 00:31:10 -0500
parents
children 9fad96094950
comparison
equal deleted inserted replaced
97:abb5add24b26 98:08cd8be1edc1
1 (ns com.aurellem.items
2 (:use (com.aurellem gb-driver vbm title))
3 ;; this is fucking bullshit
4 (:import [com.aurellem.gb_driver SaveState]))
5
6
7
8 (defn game-name []
9 (map char (subvec (vec (memory)) 0x134 0x142)))
10
11
12
13
14
15 (defn current-items [^SaveState state]
16 (set-state! state)
17
18
19 )
20
21
22
23 ;; try just buying five potions in sequence and see what changes
24 ;; each time.
25
26 (defn common-differences [& seqs]
27 (let [backbone (range (count (first seqs)))]
28 (filter
29 (comp (partial apply distinct?) second)
30 (zipmap backbone
31 (apply (partial map list) seqs)))))
32
33 ;; trying to find how items are represented in memory
34
35 (comment
36 (def empty-inventory @current-state)
37
38 (def one-potion @current-state)
39
40 (def two-potions @current-state)
41
42 (def three-potions @current-state)
43
44 (def four-potions @current-state)
45
46 (def five-potions @current-state)
47
48
49 ;; result
50 (def canidates
51 (apply common-differences
52 (map (comp vec memory)
53 [empty-inventory one-potion two-potions three-potions
54 four-potions five-potions])))
55
56 [55875 (37 15 49 27 14 44)]
57 [55876 (30 1 49 56 55 23)]
58 [49158 (154 191 78 135 70 73)]
59 [54087 (49 40 37 34 25 22)]
60 [49160 (7 24 59 243 50 217)]
61 [49704 (31 14 72 33 84 27)]
62 [49162 (126 159 183 110 176 179)]
63 [39984 (0 254 251 248 127 252)]
64 [49904 (29 72 64 78 1 95)]
65 [65491 (222 127 149 132 226 38)]
66 [65492 (44 20 89 11 253 163)]
67 [49335 (52 15 6 14 3 17)]
68 [49720 (78 152 96 60 83 103)]
69 [65304 (19 89 214 33 18 113)]
70 [53561 (132 185 145 162 159 183)]
71 [54046 (0 1 2 3 4 5)])
72
73 ;;; hmmmmmm...... I guess that the potion quantities are at 54046,
74 ;;;huh?
75
76
77
78 (def item-hack (read-state 7999))
79
80 (def item-hack2 (read-state 75882))
81
82 (defn get-mem []
83 (subvec (vec (memory @current-state)) 54040 (+ 54046 100)))
84
85
86 ;; potion -- 99
87 [0 16 0 0 1 20 99 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
88
89 ;; potion -- 95
90 [0 16 0 0 1 20 95 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
91
92 ;; potion -- 95
93 ;; pokeball -- 1
94 [0 16 0 0 2 20 95 4 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
95
96 ;; potion -- 95
97 ;; pokeball -- 10
98 [0 16 0 0 2 20 95 4 10 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
99
100
101 ;; pokeball -- 10
102 ;; potion -- 95
103 [0 16 0 0 2 4 10 20 95 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
104
105 ;; pokeball -- 10
106 ;; potion -- 95
107 ;; antidote -- 1
108
109 ;;prediction
110 ;;[0 16 0 0 3 4 10 20 95 ?? 1 255 0 0 0 0 0 ....]
111 [0 16 0 0 3 4 10 20 95 11 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
112
113
114
115 ;; now it's time to learn the item codes
116
117 (def item-hack-3 (read-state 77557))
118 (defn show-item
119 "Run a saved pokemon with the first item replaced by the item named
120 by n."
121 [n]
122 (set-state! item-hack-3)
123 (let [mem (memory)]
124 (aset mem 54045 n)
125 (write-memory! mem))
126 (step)
127 (->> [[] @current-state]
128 (play-moves
129 [[:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
130 [] [] [] [] []])))
131
132
133 (defn get-item-names []
134 (dorun (map (fn [n] (println n)
135 (show-item n)
136 (Thread/sleep 5000))
137 (range 0x00 0xFF))))
138
139
140
141 ;; 0 garbage
142 ;; 1 master-ball
143 ;; 2 ultra-ball
144 ;; 3 great-ball
145 ;; 4 poke-ball
146 ;; 5 town-map
147 ;; 6 bicycle
148 ;; 7 ?????
149 ;; 8 safari-ball
150 ;; 9 pokedex
151 ;; 10 moon-stone
152 ;; 11 antidote
153 ;; 12 burn-heal
154 ;; 13 ice-heal
155 ;; 14 awakening
156 ;; 15 parlyz-heal
157 ;; 16 full-restore
158 ;; 17 max-potion
159 ;; 18 hyper-potion
160 ;; 19 super-potion
161 ;; 20 potion
162 ;; 21 boulderbadge
163 ;; 22 cascadebadge
164 ;; 23 thunderbadge
165 ;; 24 rainbowbadge
166 ;; 25 soulbadge
167 ;; 26 marshbadge
168 ;; 27 volcanobadge
169 ;; 28 earthbadge
170 ;; 29 escape-rope
171 ;; 30 repel
172 ;; 31 old amber
173 ;; 32 fire-stone
174 ;; 33 thunderstone
175 ;; 34 water-stone
176 ;; 35 hp-up
177 ;; 36 protein
178 ;; 37 iron
179 ;; 38 carbos
180 ;; 39 calcium
181 ;; 40 rare-candy
182 ;; 41 dome-fossil
183 ;; 42 helix-fossil
184 ;; 43 secret-key
185 ;; 44 ?????
186 ;; 45 bike-voucher
187 ;; 46 x-accuracy
188 ;; 47 leaf-stone
189 ;; 48 card-key
190 ;; 49 nugget
191 ;; 50 pp-up
192 ;; 51 poke-doll
193 ;; 52 full-heal
194 ;; 53 revive
195 ;; 54 max-revive
196 ;; 55 guard-spec.
197 ;; 56 super-repel
198 ;; 57 max-repel
199 ;; 58 dire-hit
200 ;; 59 coin
201 ;; 60 fresh-water
202 ;; 61 soda-pop
203 ;; 62 lemonade
204 ;; 63 s.s.ticket
205 ;; 64 gold-teeth
206 ;; 65 x-attach
207 ;; 66 x-defend
208 ;; 67 x-speed
209 ;; 68 x-special
210 ;; 69 coin-case
211 ;; 70 oak's-parcel
212 ;; 71 itemfinder
213 ;; 72 silph-scope
214 ;; 73 poke-flute
215 ;; 74 lift-key
216 ;; 75 exp.all
217 ;; 76 old-rod
218 ;; 77 good-rod
219 ;; 78 super-rod
220 ;; 79 pp-up
221 ;; 80 ether
222 ;; 81 max-ether
223 ;; 82 elixer
224 ;; 83 max-elixer
225 ;; 84 B2F
226 ;; 85 B1F
227 ;; 86 1F
228 ;; 87 2F
229 ;; 88 3F
230 ;; 89 4F
231 ;; 90 5F
232 ;; 91 6F
233 ;; 92 7F
234 ;; 93 8F
235 ;; 94 9F
236 ;; 95 10F
237 ;; 96 11F
238 ;; 97 B4F
239 ;; 98 garbage
240 ;; 99 garbage
241 ;; 100 garbage
242 ;; 101 garbage
243 ;; 102 garbage
244 ;; 103 garbage
245 ;; 104 garbage
246 ;; 105 garbage
247 ;; 106 garbage
248 ;; 107 garbage
249 ;; 108 garbage
250 ;; 109 garbage
251 ;; 110 garbage
252 ;; 111 garbage
253 ;; 112 garbage
254 ;; 113 garbage
255 ;; 114 garbage
256 ;; 115 garbage
257 ;; 116 garbage
258 ;; 117 garbage
259 ;; 118 garbage
260 ;; 119 4
261 ;; 120 garbage
262 ;; 121 garbage
263 ;; 122 slow
264 ;; 123 garbage
265 ;; 124 garbage
266 ;; 125 garbage
267 ;; 126 garbage
268 ;; 127 garbage
269 ;; 128 garbage
270 ;; 129 garbage
271 ;; 130 garbage
272 ;; 131 slow
273 ;; 132 slow
274 ;; 133 garbage
275 ;; 134 slow
276 ;; 135 garbage
277 ;; 136 garbage
278 ;; 137 slow
279 ;; 138 garbage
280 ;; 139 garbage
281 ;; 140 garbage
282 ;; 141 slow
283 ;; 142 garbage
284 ;; 143 garbage
285 ;; 144 garbage
286 ;; 145 garbage
287 ;; 146 garbage
288 ;; 147 garbage
289 ;; 148 garbage
290 ;; 149 garbage
291 ;; 150 slow
292 ;; 151 garbage
293 ;; 152 Q
294 ;; 153 garbage
295 ;; 154 garbage
296 ;; 155 garbage
297 ;; 156 garbage
298 ;; 157 garbage
299 ;; 158 garbage
300 ;; 159 garbage
301 ;; 160 garbage (alaphabet)
302 ;; 161 garbage
303 ;; 162 garbage
304 ;; 163 garbage
305 ;; 164 rival's
306 ;; 165 name?
307 ;; 166 nickname?
308 ;; 167 slow
309 ;; 168 garbage
310 ;; 169 slow
311 ;; 170 garbage
312 ;; 171 garbage
313 ;; 172 garbage
314 ;; 173 garbage
315 ;; 174 garbage
316 ;; 175 yellow
317 ;; 176 ash
318 ;; 177 jack
319 ;; 178 new-name
320 ;; 179 blue
321 ;; 180 gary
322 ;; 181 john
323 ;; 182 garbage
324 ;; 183 garbage
325 ;; 184 garbage
326 ;; 185 garbage
327 ;; 186 slow
328 ;; 187 garbage
329 ;; 188 garbage
330 ;; 189 garbage
331 ;; 190 garbage
332 ;; 191 garbage
333 ;; 192 garbage
334 ;; 193 garbage
335 ;; 194 garbage
336 ;; 195 slow
337 ;; 196 HM01
338 ;; 197 HM02
339 ;; 198 HM03
340 ;; 199 HM04
341 ;; 200 HM05
342 ;; 201 TM01
343 ;; 202 TM02
344 ;; 203 TM03
345 ;; 204 TM04
346 ;; 205 TM05
347 ;; 206 TM06
348 ;; 207 TM07
349 ;; 208 TM08
350 ;; 209 TM09
351 ;; 210 TM10
352 ;; 211 TM11
353 ;; 212 TM12
354 ;; 213 TM13
355 ;; 214 TM13
356 ;; 215 TM15
357 ;; 216 TM16
358 ;; 217 TM17
359 ;; 218 TM18
360 ;; 219 TM19
361 ;; 220 TM20
362 ;; 221 TM21
363 ;; 222 TM22
364 ;; 223 TM23
365 ;; 224 TM24
366 ;; 225 TM25
367 ;; 226 TM26
368 ;; 227 TM27
369 ;; 228 TM28
370 ;; 229 TM29
371 ;; 230 TM30
372 ;; 231 TM31
373 ;; 232 TM32
374 ;; 233 TM33
375 ;; 234 TM34
376 ;; 235 TM35
377 ;; 236 TM36
378 ;; 237 TM37
379 ;; 238 TM38
380 ;; 239 TM39
381 ;; 240 TM40
382 ;; 241 TM41
383 ;; 242 TM42
384 ;; 243 TM43
385 ;; 244 TM44
386 ;; 245 TM45
387 ;; 246 TM46
388 ;; 247 TM47
389 ;; 248 TM48
390 ;; 249 TM49
391 ;; 250 TM50
392 ;; 251 TM51
393 ;; 252 TM52
394 ;; 253 TM53
395 ;; 254 TM54
396 ;; 255 end-of-list-sentinel
397
398
399
400
401
402
403