changeset 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
files clojure/com/aurellem/exp/pokemon.clj
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/exp/pokemon.clj	Mon Mar 19 21:23:46 2012 -0500
     1.2 +++ b/clojure/com/aurellem/exp/pokemon.clj	Mon Mar 19 21:35:43 2012 -0500
     1.3 @@ -88,5 +88,16 @@
     1.4                                               character)))
     1.5  
     1.6  
     1.7 +(def end-of-name-marker 0x50)
     1.8 +(def max-name-length 11)
     1.9  
    1.10 +(defn sixth-pokemon-name [^SaveState state]
    1.11 +  (character-codes->str
    1.12 +   (take-while
    1.13 +    (partial not= 0x50)
    1.14 +    (subvec (vec (memory state))
    1.15 +            sixth-pokemon-name-start
    1.16 +            (+ (inc max-name-length)
    1.17 +               sixth-pokemon-name-start)))))
    1.18 +          
    1.19