Mercurial > vba-clojure
view clojure/com/aurellem/exp/items.clj @ 509:d2c40a12de28
problem turned out to be nothing.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 20 Jun 2012 22:08:56 -0500 |
parents | 412ca096a9ba |
children |
line wrap: on
line source
1 (ns com.aurellem.exp.items2 (: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 changes6 ;; each time.8 ;; trying to find how items are represented in memory10 (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 ;; result24 (defn item-canidates []25 (apply common-differences26 (map (comp vec memory)27 [zero-potions one-potion two-potions three-potions28 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 -- 9957 [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 -- 9560 [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 -- 9563 ;; pokeball -- 164 [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 -- 9567 ;; pokeball -- 1068 [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 -- 1072 ;; potion -- 9573 [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 -- 1076 ;; potion -- 9577 ;; antidote -- 179 ;;prediction80 ;;[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 codes87 (def inventory-begin88 (read-state "inventory-begin"))90 (defn show-item91 "Run a saved pokemon with the first item replaced by the item named92 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-moves104 [[: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 garbage117 ;; 1 master-ball118 ;; 2 ultra-ball119 ;; 3 great-ball120 ;; 4 poke-ball121 ;; 5 town-map122 ;; 6 bicycle123 ;; 7 ?????124 ;; 8 safari-ball125 ;; 9 pokedex126 ;; 10 moon-stone127 ;; 11 antidote128 ;; 12 burn-heal129 ;; 13 ice-heal130 ;; 14 awakening131 ;; 15 parlyz-heal132 ;; 16 full-restore133 ;; 17 max-potion134 ;; 18 hyper-potion135 ;; 19 super-potion136 ;; 20 potion137 ;; 21 boulderbadge138 ;; 22 cascadebadge139 ;; 23 thunderbadge140 ;; 24 rainbowbadge141 ;; 25 soulbadge142 ;; 26 marshbadge143 ;; 27 volcanobadge144 ;; 28 earthbadge145 ;; 29 escape-rope146 ;; 30 repel147 ;; 31 old amber148 ;; 32 fire-stone149 ;; 33 thunderstone150 ;; 34 water-stone151 ;; 35 hp-up152 ;; 36 protein153 ;; 37 iron154 ;; 38 carbos155 ;; 39 calcium156 ;; 40 rare-candy157 ;; 41 dome-fossil158 ;; 42 helix-fossil159 ;; 43 secret-key160 ;; 44 ?????161 ;; 45 bike-voucher162 ;; 46 x-accuracy163 ;; 47 leaf-stone164 ;; 48 card-key165 ;; 49 nugget166 ;; 50 pp-up167 ;; 51 poke-doll168 ;; 52 full-heal169 ;; 53 revive170 ;; 54 max-revive171 ;; 55 guard-spec.172 ;; 56 super-repel173 ;; 57 max-repel174 ;; 58 dire-hit175 ;; 59 coin176 ;; 60 fresh-water177 ;; 61 soda-pop178 ;; 62 lemonade179 ;; 63 s.s.ticket180 ;; 64 gold-teeth181 ;; 65 x-attach182 ;; 66 x-defend183 ;; 67 x-speed184 ;; 68 x-special185 ;; 69 coin-case186 ;; 70 oak's-parcel187 ;; 71 itemfinder188 ;; 72 silph-scope189 ;; 73 poke-flute190 ;; 74 lift-key191 ;; 75 exp.all192 ;; 76 old-rod193 ;; 77 good-rod194 ;; 78 super-rod195 ;; 79 pp-up196 ;; 80 ether197 ;; 81 max-ether198 ;; 82 elixer199 ;; 83 max-elixer200 ;; 84 B2F201 ;; 85 B1F202 ;; 86 1F203 ;; 87 2F204 ;; 88 3F205 ;; 89 4F206 ;; 90 5F207 ;; 91 6F208 ;; 92 7F209 ;; 93 8F210 ;; 94 9F211 ;; 95 10F212 ;; 96 11F213 ;; 97 B4F214 ;; 98 garbage215 ;; 99 garbage216 ;; 100 garbage217 ;; 101 garbage218 ;; 102 garbage219 ;; 103 garbage220 ;; 104 garbage221 ;; 105 garbage222 ;; 106 garbage223 ;; 107 garbage224 ;; 108 garbage225 ;; 109 garbage226 ;; 110 garbage227 ;; 111 garbage228 ;; 112 garbage229 ;; 113 garbage230 ;; 114 garbage231 ;; 115 garbage232 ;; 116 garbage233 ;; 117 garbage234 ;; 118 garbage235 ;; 119 4236 ;; 120 garbage237 ;; 121 garbage238 ;; 122 slow239 ;; 123 garbage240 ;; 124 garbage241 ;; 125 garbage242 ;; 126 garbage243 ;; 127 garbage244 ;; 128 garbage245 ;; 129 garbage246 ;; 130 garbage247 ;; 131 slow248 ;; 132 slow249 ;; 133 garbage250 ;; 134 slow251 ;; 135 garbage252 ;; 136 garbage253 ;; 137 slow254 ;; 138 garbage255 ;; 139 garbage256 ;; 140 garbage257 ;; 141 slow258 ;; 142 garbage259 ;; 143 garbage260 ;; 144 garbage261 ;; 145 garbage262 ;; 146 garbage263 ;; 147 garbage264 ;; 148 garbage265 ;; 149 garbage266 ;; 150 slow267 ;; 151 garbage268 ;; 152 Q269 ;; 153 garbage270 ;; 154 garbage271 ;; 155 garbage272 ;; 156 garbage273 ;; 157 garbage274 ;; 158 garbage275 ;; 159 garbage276 ;; 160 garbage (alaphabet)277 ;; 161 garbage278 ;; 162 garbage279 ;; 163 garbage280 ;; 164 rival's281 ;; 165 name?282 ;; 166 nickname?283 ;; 167 slow284 ;; 168 garbage285 ;; 169 slow286 ;; 170 garbage287 ;; 171 garbage288 ;; 172 garbage289 ;; 173 garbage290 ;; 174 garbage291 ;; 175 yellow292 ;; 176 ash293 ;; 177 jack294 ;; 178 new-name295 ;; 179 blue296 ;; 180 gary297 ;; 181 john298 ;; 182 garbage299 ;; 183 garbage300 ;; 184 garbage301 ;; 185 garbage302 ;; 186 slow303 ;; 187 garbage304 ;; 188 garbage305 ;; 189 garbage306 ;; 190 garbage307 ;; 191 garbage308 ;; 192 garbage309 ;; 193 garbage310 ;; 194 garbage311 ;; 195 slow312 ;; 196 HM01313 ;; 197 HM02314 ;; 198 HM03315 ;; 199 HM04316 ;; 200 HM05317 ;; 201 TM01318 ;; 202 TM02319 ;; 203 TM03320 ;; 204 TM04321 ;; 205 TM05322 ;; 206 TM06323 ;; 207 TM07324 ;; 208 TM08325 ;; 209 TM09326 ;; 210 TM10327 ;; 211 TM11328 ;; 212 TM12329 ;; 213 TM13330 ;; 214 TM13331 ;; 215 TM15332 ;; 216 TM16333 ;; 217 TM17334 ;; 218 TM18335 ;; 219 TM19336 ;; 220 TM20337 ;; 221 TM21338 ;; 222 TM22339 ;; 223 TM23340 ;; 224 TM24341 ;; 225 TM25342 ;; 226 TM26343 ;; 227 TM27344 ;; 228 TM28345 ;; 229 TM29346 ;; 230 TM30347 ;; 231 TM31348 ;; 232 TM32349 ;; 233 TM33350 ;; 234 TM34351 ;; 235 TM35352 ;; 236 TM36353 ;; 237 TM37354 ;; 238 TM38355 ;; 239 TM39356 ;; 240 TM40357 ;; 241 TM41358 ;; 242 TM42359 ;; 243 TM43360 ;; 244 TM44361 ;; 245 TM45362 ;; 246 TM46363 ;; 247 TM47364 ;; 248 TM48365 ;; 249 TM49366 ;; 250 TM50367 ;; 251 TM51368 ;; 252 TM52369 ;; 253 TM53370 ;; 254 TM54371 ;; 255 end-of-list-sentinel375 (def gliched-tms376 [[:TM51 1]377 [:TM52 1]378 [:TM53 1]379 [:TM54 1]])381 (def good-items382 [[: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-badges396 [[:cascadebadge 1]397 [:thunderbadge 1]398 [:rainbowbadge 1]399 [:soulbadge 1]400 ])