diff clojure/com/aurellem/run/bootstrap_0.clj @ 255:d9e0752da684

unicode walking :)
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Mar 2012 06:00:30 -0500
parents b7f682bb3090
children 8d1a354f7471
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj	Mon Mar 26 04:17:10 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj	Mon Mar 26 06:00:30 2012 -0500
     1.3 @@ -5,7 +5,70 @@
     1.4  
     1.5  
     1.6  (defn-memo boot-root []
     1.7 -  [(root) []])
     1.8 +  [ [] (root)])
     1.9    
    1.10 +(defn-memo to-rival-name
    1.11 +  ([] (to-rival-name (boot-root)))
    1.12 +  ([script]
    1.13 +     (-> script
    1.14 +         title
    1.15 +         oak
    1.16 +         name-entry-rlm
    1.17 +         scroll-text
    1.18 +         scroll-text
    1.19 +         scroll-text
    1.20 +         scroll-text
    1.21 +         scroll-text
    1.22 +         )))
    1.23  
    1.24 +(defn-memo name-rival-bootstrap
    1.25 +  ([] (name-rival-bootstrap (to-rival-name)))
    1.26 +  ([script]
    1.27 +     (->> script
    1.28 +         (advance [] [:a])
    1.29 +         (advance [] [:r] DE)
    1.30 +         (play-moves
    1.31 +          [[]
    1.32 +           [:r] [] [:r] [] [:r] [] [:r] []
    1.33 +           [:r] [] [:r] [] [:r] [] [:d] []
    1.34 +           [:d] [:a]                         ;; space
    1.35 +           [:l] [] [:d] [:a]                 ;; [PK]
    1.36 +           [:u] [] [:u] [] [:u] [] [:l] [:a] ;; G
    1.37 +           [:d] [] [:d] [] [:d] [] [:r] [:a] ;; [PK]
    1.38 +           [:u] [] [:u] [] [:u] [] [:l] [:a] ;; G
    1.39 +           [:d] [] [:d] [] [:d] [] [:r] [:a] ;; [PK]
    1.40  
    1.41 +           [:d] [] [:r] [:a]                 ;; finish
    1.42 +           ]))))
    1.43 +
    1.44 +(defn walk
    1.45 +  "Move the character along the given directions."
    1.46 +  [directions script]
    1.47 +  (reduce (fn [script direction]
    1.48 +            (move direction script))
    1.49 +          script directions))
    1.50 +
    1.51 +(def ↑ [:u])
    1.52 +(def ↓ [:d])
    1.53 +(def ← [:l])
    1.54 +(def → [:r])
    1.55 +
    1.56 +(defn-memo leave-house
    1.57 +  ([] (leave-house (name-rival-bootstrap)))
    1.58 +  ([script]
    1.59 +     (->> script
    1.60 +          finish-title
    1.61 +          start-walking
    1.62 +          walk-to-stairs
    1.63 +          walk-to-door
    1.64 +          (walk [↓ ↓]))))
    1.65 +
    1.66 +(defn-memo to-pallet-town-edge
    1.67 +  ([] (to-pallet-town-edge (leave-house)))
    1.68 +  ([script]
    1.69 +     (->> script
    1.70 +          start-walking
    1.71 +          (walk [→ → → → →
    1.72 +                 ↑ ↑ ↑ ↑ ↑ ↑]))))
    1.73 +     
    1.74 +