view clojure/com/aurellem/exp/items.clj @ 145:412ca096a9ba

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