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