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