diff clojure/com/aurellem/run/title.clj @ 250:b7f682bb3090

updated title and save_corruption to work with all the recent updates
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Mar 2012 03:49:33 -0500
parents 09caf6a5bbf4
children 5dafe6188ca5
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/title.clj	Mon Mar 26 03:09:26 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/title.clj	Mon Mar 26 03:49:33 2012 -0500
     1.3 @@ -25,91 +25,104 @@
     1.4  
     1.5  (defn start [] [[] (root)])
     1.6  
     1.7 -(defn-memo title []
     1.8 -  (->> (start)
     1.9 -       (advance [] [:a])
    1.10 -       (advance [] [:start])
    1.11 -       (advance [] [:a])
    1.12 -       (advance [] [:start])))
    1.13 +(defn-memo title
    1.14 +  ([] (title (start)))
    1.15 +  ([script]
    1.16 +     (->> script
    1.17 +          (advance [] [:a])
    1.18 +          (advance [] [:start])
    1.19 +          (advance [] [:a])
    1.20 +          (advance [] [:start]))))
    1.21  
    1.22 -(defn-memo oak []
    1.23 -  (->> (title)
    1.24 -       scroll-text
    1.25 -       scroll-text
    1.26 -       scroll-text
    1.27 -       scroll-text
    1.28 -       scroll-text
    1.29 -       scroll-text
    1.30 -       scroll-text
    1.31 -       scroll-text
    1.32 -       scroll-text
    1.33 -       scroll-text
    1.34 -       scroll-text
    1.35 -       scroll-text
    1.36 -       scroll-text
    1.37 -       ))
    1.38 +(defn-memo oak
    1.39 +  ([] (oak (title)))
    1.40 +  ([script]
    1.41 +     (->> script
    1.42 +          scroll-text
    1.43 +          scroll-text
    1.44 +          scroll-text
    1.45 +          scroll-text
    1.46 +          scroll-text
    1.47 +          scroll-text
    1.48 +          scroll-text
    1.49 +          scroll-text
    1.50 +          scroll-text
    1.51 +          scroll-text
    1.52 +          scroll-text
    1.53 +          scroll-text
    1.54 +          scroll-text)))
    1.55  
    1.56 -(defn-memo name-entry-rlm []
    1.57 -  (->> (oak)
    1.58 -       (advance [] [:a])
    1.59 -       (advance [] [:r] DE)
    1.60 -       (play-moves
    1.61 -        [[]
    1.62 -         [:r] [] [:r] [] [:r] [] [:r] []
    1.63 -         [:r] [] [:r] [] [:r] [] [:d] [:a]  
    1.64 -         [:l] [] [:l] [] [:l] [] [:l] []
    1.65 -         [:l] [] [:l] [:a] [] [:r] [:a]
    1.66 -         [:r] [] [:r] [] [:r] [] [:r] []
    1.67 -         [:r] [] [:d] [] [:d] [] [:d] [:a]
    1.68 -         ])))
    1.69 +(defn-memo name-entry-rlm
    1.70 +  ([] (name-entry-rlm (oak)))
    1.71 +  ([script]
    1.72 +     (->> script
    1.73 +          (advance [] [:a])
    1.74 +          (advance [] [:r] DE)
    1.75 +          (play-moves
    1.76 +           [[]
    1.77 +            [:r] [] [:r] [] [:r] [] [:r] []
    1.78 +            [:r] [] [:r] [] [:r] [] [:d] [:a]  
    1.79 +            [:l] [] [:l] [] [:l] [] [:l] []
    1.80 +            [:l] [] [:l] [:a] [] [:r] [:a]
    1.81 +            [:r] [] [:r] [] [:r] [] [:r] []
    1.82 +            [:r] [] [:d] [] [:d] [] [:d] [:a]]))))
    1.83  
    1.84 -(defn-memo name-entry-ash []
    1.85 -  (->> (oak)
    1.86 -       (advance [] [:d])
    1.87 -       (advance [] [:d])
    1.88 -       (advance [] [:a])))
    1.89 +(defn-memo name-entry-ash
    1.90 +  ([] (name-entry-ash (oak)))
    1.91 +  ([script]
    1.92 +     (->> script
    1.93 +          (advance [] [:d])
    1.94 +          (advance [] [:d])
    1.95 +          (advance [] [:a]))))
    1.96         
    1.97 -(defn-memo rival-name-entry-gary []
    1.98 -  (->> (name-entry-ash)
    1.99 -       scroll-text
   1.100 -       scroll-text
   1.101 -       scroll-text
   1.102 -       scroll-text
   1.103 -       scroll-text
   1.104 -       (advance [] [:d])
   1.105 -       (advance [] [:d])
   1.106 -       (advance [] [:a])))
   1.107 +(defn-memo rival-name-entry-gary
   1.108 +  ([] (rival-name-entry-gary (name-entry-ash)))
   1.109 +  ([script]
   1.110 +     (->> script
   1.111 +          scroll-text
   1.112 +          scroll-text
   1.113 +          scroll-text
   1.114 +          scroll-text
   1.115 +          scroll-text
   1.116 +          (advance [] [:d])
   1.117 +          (advance [] [:d])
   1.118 +          (advance [] [:a]))))
   1.119 +  
   1.120 +(defn-memo rival-name-entry-blue
   1.121 +  ([] (rival-name-entry-blue (name-entry-ash)))
   1.122 +  ([script]
   1.123 +     (->> script
   1.124 +          scroll-text
   1.125 +          scroll-text
   1.126 +          scroll-text
   1.127 +          scroll-text
   1.128 +          scroll-text
   1.129 +          (advance [] [:d])
   1.130 +          (advance [] [:a]))))
   1.131  
   1.132 -(defn-memo rival-name-entry-blue []
   1.133 -  (->> (name-entry-ash)
   1.134 -       scroll-text
   1.135 -       scroll-text
   1.136 -       scroll-text
   1.137 -       scroll-text
   1.138 -       scroll-text
   1.139 -       (advance [] [:d])
   1.140 -       (advance [] [:a])))
   1.141 +(defn-memo finish-title
   1.142 +  ([] (finish-title (rival-name-entry-blue)))
   1.143 +  ([script]
   1.144 +     (->> script
   1.145 +          scroll-text
   1.146 +          scroll-text
   1.147 +          scroll-text
   1.148 +          scroll-text
   1.149 +          scroll-text
   1.150 +          scroll-text
   1.151 +          scroll-text)))
   1.152  
   1.153 -(defn-memo finish-title []
   1.154 -  (->> (rival-name-entry-blue)
   1.155 -       scroll-text
   1.156 -       scroll-text
   1.157 -       scroll-text
   1.158 -       scroll-text
   1.159 -       scroll-text
   1.160 -       scroll-text
   1.161 -       scroll-text))
   1.162 -
   1.163 -(def title-frames 2323)
   1.164 +(def title-frames 2194)
   1.165  
   1.166  (defn title-checkpoint! []
   1.167    (let [[moves state] (finish-title)]
   1.168 -    (assert (= title-frames (:frame state)))
   1.169 -    [(write-moves! moves) (write-state! state)]))
   1.170 +    (assert (= title-frames (count moves)))
   1.171 +    [(write-moves! moves "title-checkpoint")
   1.172 +     (write-state! state "title-checkpoint")]))
   1.173  
   1.174  (defn intro []
   1.175 -  [(read-moves title-frames)
   1.176 -   (read-state title-frames)])
   1.177 +  [(read-moves "title-checkpoint")
   1.178 +   (read-state "title-checkpoint")])
   1.179  
   1.180  (defn test-intro []
   1.181    (play-vbm (moves->filename title-frames)))