diff 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/pokemon.clj	Mon Mar 19 19:56:55 2012 -0500
     1.2 +++ b/clojure/com/aurellem/pokemon.clj	Mon Mar 19 20:30:37 2012 -0500
     1.3 @@ -1,8 +1,94 @@
     1.4  (ns com.aurellem.pokemon
     1.5 +  "Here I find out how pokemon are stored in memory."
     1.6    (:use (com.aurellem gb-driver vbm
     1.7 +                      rival-name
     1.8                        title save-corruption items assembly))
     1.9 +  (:use com.aurellem.experiments.items)
    1.10    (:import [com.aurellem.gb_driver SaveState]))
    1.11  
    1.12  
    1.13 +(def pidgeot-lvl-36 (mid-game))
    1.14  
    1.15  
    1.16 +(def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))
    1.17 +
    1.18 +
    1.19 +(def pidgeot-lvl-38  (read-state "pidgeot-lvl-38"))
    1.20 +
    1.21 +
    1.22 +(def pidgeot-lvl-39  (read-state "pidgeot-lvl-39"))
    1.23 +
    1.24 +
    1.25 +(def pidgeot-lvl-40  (read-state "pidgeot-lvl-40"))
    1.26 +
    1.27 +
    1.28 +(defn level-analysis []
    1.29 +  (apply common-differences
    1.30 +         (map (comp vec memory)
    1.31 +              [pidgeot-lvl-36
    1.32 +               pidgeot-lvl-37
    1.33 +               pidgeot-lvl-38
    1.34 +               pidgeot-lvl-39
    1.35 +               pidgeot-lvl-40])))
    1.36 +
    1.37 +;; inconclusive -- implies that level is calculated from
    1.38 +;; some other values.
    1.39 +
    1.40 +
    1.41 +(def name-pidgeotto (read-state "name-pidgeotto"))
    1.42 +(def named-A (read-state "named-A"))
    1.43 +(def named-B (read-state "named-B"))
    1.44 +(def named-C (read-state "named-C"))
    1.45 +(def named-D (read-state "named-D"))
    1.46 +(def named-E (read-state "named-E"))
    1.47 +(def named-F (read-state "named-F"))
    1.48 +
    1.49 +(defn name-analysis []
    1.50 +  (apply common-differences
    1.51 +         (map (comp vec memory)
    1.52 +              [named-A
    1.53 +               named-B
    1.54 +               named-C
    1.55 +               named-D
    1.56 +               named-E
    1.57 +               named-F])))
    1.58 +
    1.59 +;; resluted in 3 separate locations that could
    1.60 +;; possibly hold the first letter of the pokemon's name
    1.61 +
    1.62 +0xCF4A
    1.63 +0xD2EB
    1.64 +0xCEED
    1.65 +
    1.66 +;; try changing each of them
    1.67 +
    1.68 +
    1.69 +(defn test-cf4a []
    1.70 +  (continue!
    1.71 +   (set-memory named-A 0xCF4A (character->character-code "Z"))))
    1.72 +;; result -- pidgeotto named "A"
    1.73 +
    1.74 +(defn test-d2eb []
    1.75 +  (continue!
    1.76 +   (set-memory named-A 0xD2EB (character->character-code "Z"))))
    1.77 +;; result -- pidgeotto named "Z"
    1.78 +
    1.79 +(defn test-ceed []
    1.80 +  (continue!
    1.81 +   (set-memory named-A 0xCEED (character->character-code "Z"))))
    1.82 +;; result -- pidgeotto named "A"
    1.83 +
    1.84 +(def sixth-pokemon-name-start 0xD2EB)
    1.85 +
    1.86 +
    1.87 +(defn set-sixth-pokemon-name-first-character
    1.88 +  ([state character]
    1.89 +     (set-memory state sixth-pokemon-name-start
    1.90 +                 (character->character-code character)))
    1.91 +  ([character]
    1.92 +     (set-sixth-pokemon-name-first-character @current-state
    1.93 +                                             character)))
    1.94 +
    1.95 +
    1.96 +
    1.97 +