Mercurial > vba-clojure
view clojure/com/aurellem/rival_name.clj @ 144:ec477931f077
preparing to refactor:
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 19 Mar 2012 20:43:38 -0500 |
parents | cd930ed1fd4d |
children |
line wrap: on
line source
1 (ns com.aurellem.rival-name2 (:use (com.aurellem gb-driver vbm title save-corruption items assembly))3 (:import [com.aurellem.gb_driver SaveState]))6 (defn talk-to-rival []7 (read-state "talk-to-rival"))9 (def rival-name-start 0xD349)11 (defn set-rival-name [^SaveState state codes]12 (set-state! state)13 (let [mem (memory state)]14 (dorun (map (fn [index val]15 (aset mem index val))16 (range rival-name-start17 (+ rival-name-start18 (count codes))) codes))19 (write-memory! mem)20 (update-state)))22 (defn view-rival-name [name-codes]23 (->24 (set-rival-name (talk-to-rival) name-codes)25 (step [:a])26 (play 50)))28 (defn rival-name-sequence []29 (let [i (atom 1)]30 (fn []31 (let [codes (range @i (+ 5 @i))]32 (println codes)33 (view-rival-name codes)34 (reset! i (+ 5 @i))))))36 (def character-code->character37 {38 0x00 "end-of-name-sentinel"39 0x60 "A-bold"40 0x61 "B-bold"41 0x62 "C-bold"42 0x63 "D-bold"43 0x64 "E-bold"44 0x65 "F-bold"45 0x66 "G-bold"46 0x67 "H-bold"47 0x68 "I-bold"48 0x69 "V-bold"49 0x6A "S-bold"50 0x6B "L-bold"51 0x6C "M-bold"52 0x80 "A"53 0x81 "B"54 0x82 "C"55 0x83 "D"56 0x84 "E"57 0x85 "F"58 0x86 "G"59 0x87 "H"60 0x88 "I"61 0x89 "J"62 0x8A "K"63 0x8B "L"64 0x8C "M"65 0x8D "N"66 0x8E "O"67 0x8F "P"68 0x90 "Q"69 0x91 "R"70 0x92 "S"71 0x93 "T"72 0x94 "U"73 0x95 "V"74 0x96 "W"75 0x97 "X"76 0x98 "Y"77 0x99 "Z"78 0x9A "("79 0x9B ")"80 0x9C ":"81 0x9D ";"82 0xA0 "a"83 0xA1 "b"84 0xA2 "c"85 0xA3 "d"86 0xA4 "e"87 0xA5 "f"88 0xA6 "g"89 0xA7 "h"90 0xA8 "i"91 0xA9 "j"92 0xAA "k"93 0xAB "l"94 0xAC "m"95 0xAD "n"96 0xAE "o"97 0xAF "p"98 0xB0 "q"99 0xB1 "r"100 0xB2 "s"101 0xB3 "t"102 0xB4 "u"103 0xB5 "v"104 0xB6 "w"105 0xB7 "x"106 0xB8 "y"107 0xB9 "z"108 0xBA "e-with-grave"109 0xE0 "'"110 0xE1 "PK"111 0xE2 "MN"112 0xE6 "?"113 0xE7 "!"114 0xE8 "."115 0xEF "male-symbol"116 0xF0 "pokemon-money-symbol"117 0xF1 "."118 0xF2 "/"119 0xF3 ","120 0xF4 "female-symbol"121 0xF6 "0 "122 0xF7 "1"123 0xF8 "2"124 0xF9 "3"125 0xFA "4"126 0xFB "5"127 0xFC "6"128 0xFD "7"129 0xFE "8"130 0xFF "9"131 })133 (def character->character-code134 (zipmap (vals character-code->character)135 (keys character-code->character)))141 ;; 0x00 : end-of-name-sentinel142 ;; 0x01 :143 ;; 0x02 :144 ;; 0x03 :145 ;; 0x04 :146 ;; 0x05 :147 ;; 0x06 :148 ;; 0x07 :149 ;; 0x08 :150 ;; 0x09 :151 ;; 0x0A :152 ;; 0x0B :153 ;; 0x0C :154 ;; 0x0D :155 ;; 0x0E :156 ;; 0x0F :157 ;; 0x10 :158 ;; 0x11 :159 ;; 0x12 :160 ;; 0x13 :161 ;; 0x14 :162 ;; 0x15 :163 ;; 0x16 :164 ;; 0x17 :165 ;; 0x18 :166 ;; 0x19 :167 ;; 0x1A :168 ;; 0x1B :169 ;; 0x1C :170 ;; 0x1D :171 ;; 0x1E :172 ;; 0x1F :173 ;; 0x20 :174 ;; 0x21 :175 ;; 0x22 :176 ;; 0x23 :177 ;; 0x24 :178 ;; 0x25 :179 ;; 0x26 :180 ;; 0x27 :181 ;; 0x28 :182 ;; 0x29 :183 ;; 0x2A :184 ;; 0x2B :185 ;; 0x2C :186 ;; 0x2D :187 ;; 0x2E :188 ;; 0x2F :189 ;; 0x30 :190 ;; 0x31 :191 ;; 0x32 :192 ;; 0x33 :193 ;; 0x34 :194 ;; 0x35 :195 ;; 0x36 :196 ;; 0x37 :197 ;; 0x38 :198 ;; 0x39 :199 ;; 0x3A :200 ;; 0x3B :201 ;; 0x3C :202 ;; 0x3D :203 ;; 0x3E :204 ;; 0x3F :205 ;; 0x40 :206 ;; 0x41 :207 ;; 0x42 :208 ;; 0x43 :209 ;; 0x44 :210 ;; 0x45 :211 ;; 0x46 :212 ;; 0x47 :213 ;; 0x48 :214 ;; 0x49 :215 ;; 0x4A :216 ;; 0x4B :217 ;; 0x4C :218 ;; 0x4D :219 ;; 0x4E :220 ;; 0x4F :221 ;; 0x50 :222 ;; 0x51 :223 ;; 0x52 :224 ;; 0x53 :225 ;; 0x54 :226 ;; 0x55 :227 ;; 0x56 :228 ;; 0x57 :229 ;; 0x58 :230 ;; 0x59 :231 ;; 0x5A :232 ;; 0x5B :233 ;; 0x5C :234 ;; 0x5D :235 ;; 0x5E :236 ;; 0x5F :237 ;; 0x60 : A (small-bold)238 ;; 0x61 : B (small-bold)239 ;; 0x62 : C (small-bold)240 ;; 0x63 : D (small-bold)241 ;; 0x64 : E (small-bold)242 ;; 0x65 : F (small-bold)243 ;; 0x66 : G (small-bold)244 ;; 0x67 : H (small-bold)245 ;; 0x68 : I (small-bold)246 ;; 0x69 : V (small-bold)247 ;; 0x6A : S (small-bold)248 ;; 0x6B : L (small-bold)249 ;; 0x6C : M (small-bold)250 ;; 0x6D :251 ;; 0x6E :252 ;; 0x6F :253 ;; 0x70 :254 ;; 0x71 :255 ;; 0x72 :256 ;; 0x73 :257 ;; 0x74 :258 ;; 0x75 :259 ;; 0x76 :260 ;; 0x77 :261 ;; 0x78 :262 ;; 0x79 :263 ;; 0x7A :264 ;; 0x7B :265 ;; 0x7C :266 ;; 0x7D :267 ;; 0x7E :268 ;; 0x7F :269 ;; 0x80 : A270 ;; 0x81 : B271 ;; 0x82 : C272 ;; 0x83 : D273 ;; 0x84 : E274 ;; 0x85 : F275 ;; 0x86 : G276 ;; 0x87 : H277 ;; 0x88 : I278 ;; 0x89 : J279 ;; 0x8A : K280 ;; 0x8B : L281 ;; 0x8C : M282 ;; 0x8D : N283 ;; 0x8E : O284 ;; 0x8F : P285 ;; 0x90 : Q286 ;; 0x91 : R287 ;; 0x92 : S288 ;; 0x93 : T289 ;; 0x94 : U290 ;; 0x95 : V291 ;; 0x96 : W292 ;; 0x97 : X293 ;; 0x98 : Y294 ;; 0x99 : Z295 ;; 0x9A : (296 ;; 0x9B : )297 ;; 0x9C : :298 ;; 0x9D : ;299 ;; 0x9E :300 ;; 0x9F :301 ;; 0xA0 : a302 ;; 0xA1 : b303 ;; 0xA2 : c304 ;; 0xA3 : d305 ;; 0xA4 : e306 ;; 0xA5 : f307 ;; 0xA6 : g308 ;; 0xA7 : h309 ;; 0xA8 : i310 ;; 0xA9 : j311 ;; 0xAA : k312 ;; 0xAB : l313 ;; 0xAC : m314 ;; 0xAD : n315 ;; 0xAE : o316 ;; 0xAF : p317 ;; 0xB0 : q318 ;; 0xB1 : r319 ;; 0xB2 : s320 ;; 0xB3 : t321 ;; 0xB4 : u322 ;; 0xB5 : v323 ;; 0xB6 : w324 ;; 0xB7 : x325 ;; 0xB8 : y326 ;; 0xB9 : z327 ;; 0xBA : e-with-grave328 ;; 0xBB :329 ;; 0xBC :330 ;; 0xBD :331 ;; 0xBE :332 ;; 0xBF :333 ;; 0xC0 :334 ;; 0xC1 :335 ;; 0xC2 :336 ;; 0xC3 :337 ;; 0xC4 :338 ;; 0xC5 :339 ;; 0xC6 :340 ;; 0xC7 :341 ;; 0xC8 :342 ;; 0xC9 :343 ;; 0xCA :344 ;; 0xCB :345 ;; 0xCC :346 ;; 0xCD :347 ;; 0xCE :348 ;; 0xCF :349 ;; 0xD0 :350 ;; 0xD1 :351 ;; 0xD2 :352 ;; 0xD3 :353 ;; 0xD4 :354 ;; 0xD5 :355 ;; 0xD6 :356 ;; 0xD7 :357 ;; 0xD8 :358 ;; 0xD9 :359 ;; 0xDA :360 ;; 0xDB :361 ;; 0xDC :362 ;; 0xDD :363 ;; 0xDE :364 ;; 0xDF :365 ;; 0xE0 : '366 ;; 0xE1 : PK367 ;; 0xE2 : MN368 ;; 0xE3 :369 ;; 0xE4 :370 ;; 0xE5 :371 ;; 0xE6 : ?372 ;; 0xE7 : !373 ;; 0xE8 : .374 ;; 0xE9 :375 ;; 0xEA :376 ;; 0xEB :377 ;; 0xEC :378 ;; 0xED :379 ;; 0xEE :380 ;; 0xEF : male-symbol381 ;; 0xF0 : pokemon-money-symbol382 ;; 0xF1 : .383 ;; 0xF2 : /384 ;; 0xF3 : ,385 ;; 0xF4 : female-symbol386 ;; 0xF5 :387 ;; 0xF6 : 0388 ;; 0xF7 : 1389 ;; 0xF8 : 2390 ;; 0xF9 : 3391 ;; 0xFA : 4392 ;; 0xFB : 5393 ;; 0xFC : 6394 ;; 0xFD : 7395 ;; 0xFE : 8396 ;; 0xFF : 9