comparison clojure/com/aurellem/title.clj @ 88:65c2854c5875

can now save moves and states and am ready to continue past the title
author Robert McIntyre <rlm@mit.edu>
date Sat, 10 Mar 2012 15:36:26 -0600
parents e8855121f413
children 2f478abe57d0
comparison
equal deleted inserted replaced
87:e8855121f413 88:65c2854c5875
23 23
24 (def scroll-text (partial advance [:b] [:a :b])) 24 (def scroll-text (partial advance [:b] [:a :b]))
25 25
26 (defn start [] [[] (root)]) 26 (defn start [] [[] (root)])
27 27
28 (defn-memo title [start] 28 (defn-memo title []
29 (->> start 29 (->> (start)
30 (advance [] [:a]) 30 (advance [] [:a])
31 (advance [] [:start]) 31 (advance [] [:start])
32 (advance [] [:a]) 32 (advance [] [:a])
33 (advance [] [:start]))) 33 (advance [] [:start])))
34 34
35 (defn-memo oak [start] 35 (defn-memo oak []
36 (->> (title) 36 (->> (title)
37 scroll-text 37 scroll-text
38 scroll-text 38 scroll-text
39 scroll-text 39 scroll-text
40 scroll-text 40 scroll-text
81 scroll-text 81 scroll-text
82 scroll-text 82 scroll-text
83 scroll-text 83 scroll-text
84 scroll-text)) 84 scroll-text))
85 85
86 (defn-memo intro [] 86 (defn write-intro! []
87 (-> (start) title oak name-entry rival-name-entry finish-title)) 87 (let [[moves state] (finish-title)]
88 [(write-moves! moves) (write-state! state)]))
89
90 (def title-frames 2323)
91
92 (defn intro []
93 [(read-moves title-frames)
94 (read-state title-frames)])
95
96 (defn test-intro []
97 (play-vbm (moves->filename title-frames)))
98
88 99
89 100
90 ;; TODO might be able to glue these together more elegantly with monads 101 ;; TODO might be able to glue these together more elegantly with monads
91 102