annotate clojure/com/aurellem/experiments/items.clj @ 101:37711ff4a7bc

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