annotate clojure/com/aurellem/pokemon.clj @ 143:cd930ed1fd4d

determined location of sixth pokemon's name's first character.
author Robert McIntyre <rlm@mit.edu>
date Mon, 19 Mar 2012 20:30:37 -0500
parents b12d2408fd9b
children
rev   line source
rlm@142 1 (ns com.aurellem.pokemon
rlm@143 2 "Here I find out how pokemon are stored in memory."
rlm@142 3 (:use (com.aurellem gb-driver vbm
rlm@143 4 rival-name
rlm@142 5 title save-corruption items assembly))
rlm@143 6 (:use com.aurellem.experiments.items)
rlm@142 7 (:import [com.aurellem.gb_driver SaveState]))
rlm@142 8
rlm@142 9
rlm@143 10 (def pidgeot-lvl-36 (mid-game))
rlm@142 11
rlm@142 12
rlm@143 13 (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))
rlm@143 14
rlm@143 15
rlm@143 16 (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38"))
rlm@143 17
rlm@143 18
rlm@143 19 (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39"))
rlm@143 20
rlm@143 21
rlm@143 22 (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40"))
rlm@143 23
rlm@143 24
rlm@143 25 (defn level-analysis []
rlm@143 26 (apply common-differences
rlm@143 27 (map (comp vec memory)
rlm@143 28 [pidgeot-lvl-36
rlm@143 29 pidgeot-lvl-37
rlm@143 30 pidgeot-lvl-38
rlm@143 31 pidgeot-lvl-39
rlm@143 32 pidgeot-lvl-40])))
rlm@143 33
rlm@143 34 ;; inconclusive -- implies that level is calculated from
rlm@143 35 ;; some other values.
rlm@143 36
rlm@143 37
rlm@143 38 (def name-pidgeotto (read-state "name-pidgeotto"))
rlm@143 39 (def named-A (read-state "named-A"))
rlm@143 40 (def named-B (read-state "named-B"))
rlm@143 41 (def named-C (read-state "named-C"))
rlm@143 42 (def named-D (read-state "named-D"))
rlm@143 43 (def named-E (read-state "named-E"))
rlm@143 44 (def named-F (read-state "named-F"))
rlm@143 45
rlm@143 46 (defn name-analysis []
rlm@143 47 (apply common-differences
rlm@143 48 (map (comp vec memory)
rlm@143 49 [named-A
rlm@143 50 named-B
rlm@143 51 named-C
rlm@143 52 named-D
rlm@143 53 named-E
rlm@143 54 named-F])))
rlm@143 55
rlm@143 56 ;; resluted in 3 separate locations that could
rlm@143 57 ;; possibly hold the first letter of the pokemon's name
rlm@143 58
rlm@143 59 0xCF4A
rlm@143 60 0xD2EB
rlm@143 61 0xCEED
rlm@143 62
rlm@143 63 ;; try changing each of them
rlm@143 64
rlm@143 65
rlm@143 66 (defn test-cf4a []
rlm@143 67 (continue!
rlm@143 68 (set-memory named-A 0xCF4A (character->character-code "Z"))))
rlm@143 69 ;; result -- pidgeotto named "A"
rlm@143 70
rlm@143 71 (defn test-d2eb []
rlm@143 72 (continue!
rlm@143 73 (set-memory named-A 0xD2EB (character->character-code "Z"))))
rlm@143 74 ;; result -- pidgeotto named "Z"
rlm@143 75
rlm@143 76 (defn test-ceed []
rlm@143 77 (continue!
rlm@143 78 (set-memory named-A 0xCEED (character->character-code "Z"))))
rlm@143 79 ;; result -- pidgeotto named "A"
rlm@143 80
rlm@143 81 (def sixth-pokemon-name-start 0xD2EB)
rlm@143 82
rlm@143 83
rlm@143 84 (defn set-sixth-pokemon-name-first-character
rlm@143 85 ([state character]
rlm@143 86 (set-memory state sixth-pokemon-name-start
rlm@143 87 (character->character-code character)))
rlm@143 88 ([character]
rlm@143 89 (set-sixth-pokemon-name-first-character @current-state
rlm@143 90 character)))
rlm@143 91
rlm@143 92
rlm@143 93
rlm@143 94