Mercurial > vba-clojure
view clojure/com/aurellem/exp/pokemon.clj @ 146:c5914665012d
made function to get the sixth pokemon's full name
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 19 Mar 2012 21:35:43 -0500 |
parents | 412ca096a9ba |
children | 279e9ee6fccb |
line wrap: on
line source
1 (ns com.aurellem.exp.pokemon2 "Here I find out how pokemon are stored in memory."3 (:use (com.aurellem.gb gb-driver items assembly util4 characters))5 (:import [com.aurellem.gb.gb_driver SaveState]))8 (def pidgeot-lvl-36 (mid-game))11 (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))14 (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38"))17 (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39"))20 (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40"))23 (defn level-analysis []24 (apply common-differences25 (map (comp vec memory)26 [pidgeot-lvl-3627 pidgeot-lvl-3728 pidgeot-lvl-3829 pidgeot-lvl-3930 pidgeot-lvl-40])))32 ;; inconclusive -- implies that level is calculated from33 ;; some other values.36 (def name-pidgeotto (read-state "name-pidgeotto"))37 (def named-A (read-state "named-A"))38 (def named-B (read-state "named-B"))39 (def named-C (read-state "named-C"))40 (def named-D (read-state "named-D"))41 (def named-E (read-state "named-E"))42 (def named-F (read-state "named-F"))44 (defn name-analysis []45 (apply common-differences46 (map (comp vec memory)47 [named-A48 named-B49 named-C50 named-D51 named-E52 named-F])))54 ;; resluted in 3 separate locations that could55 ;; possibly hold the first letter of the pokemon's name57 0xCF4A58 0xD2EB59 0xCEED61 ;; try changing each of them64 (defn test-cf4a []65 (continue!66 (set-memory named-A 0xCF4A (character->character-code "Z"))))67 ;; result -- pidgeotto named "A"69 (defn test-d2eb []70 (continue!71 (set-memory named-A 0xD2EB (character->character-code "Z"))))72 ;; result -- pidgeotto named "Z"74 (defn test-ceed []75 (continue!76 (set-memory named-A 0xCEED (character->character-code "Z"))))77 ;; result -- pidgeotto named "A"79 (def sixth-pokemon-name-start 0xD2EB)82 (defn set-sixth-pokemon-name-first-character83 ([state character]84 (set-memory state sixth-pokemon-name-start85 (character->character-code character)))86 ([character]87 (set-sixth-pokemon-name-first-character @current-state88 character)))91 (def end-of-name-marker 0x50)92 (def max-name-length 11)94 (defn sixth-pokemon-name [^SaveState state]95 (character-codes->str96 (take-while97 (partial not= 0x50)98 (subvec (vec (memory state))99 sixth-pokemon-name-start100 (+ (inc max-name-length)101 sixth-pokemon-name-start)))))