comparison 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
comparison
equal deleted inserted replaced
145:412ca096a9ba 146:c5914665012d
86 ([character] 86 ([character]
87 (set-sixth-pokemon-name-first-character @current-state 87 (set-sixth-pokemon-name-first-character @current-state
88 character))) 88 character)))
89 89
90 90
91 (def end-of-name-marker 0x50)
92 (def max-name-length 11)
91 93
94 (defn sixth-pokemon-name [^SaveState state]
95 (character-codes->str
96 (take-while
97 (partial not= 0x50)
98 (subvec (vec (memory state))
99 sixth-pokemon-name-start
100 (+ (inc max-name-length)
101 sixth-pokemon-name-start)))))
102
92 103