annotate clojure/com/aurellem/run/title.clj @ 330:ecff37d22293

made more progress, have burn heals and correct name for rival.
author Robert McIntyre <rlm@mit.edu>
date Fri, 06 Apr 2012 09:09:52 -0500
parents a452deec2882
children abd1ca8a25cc
rev   line source
rlm@170 1 (ns com.aurellem.run.title
rlm@318 2 (:use (com.aurellem.gb gb-driver vbm))
rlm@318 3 (:use (com.aurellem.run util)))
rlm@81 4
rlm@87 5 (defn start [] [[] (root)])
rlm@81 6
rlm@250 7 (defn-memo title
rlm@250 8 ([] (title (start)))
rlm@250 9 ([script]
rlm@250 10 (->> script
rlm@318 11 (first-difference [] [:a] AF)
rlm@318 12 (first-difference [] [:start] AF)
rlm@318 13 (first-difference [] [:a] AF)
rlm@318 14 (first-difference [] [:start] AF))))
rlm@81 15
rlm@329 16 (defn oak
rlm@250 17 ([] (oak (title)))
rlm@250 18 ([script]
rlm@250 19 (->> script
rlm@256 20 (scroll-text 13))))
rlm@81 21
rlm@250 22 (defn-memo name-entry-rlm
rlm@250 23 ([] (name-entry-rlm (oak)))
rlm@250 24 ([script]
rlm@250 25 (->> script
rlm@318 26 (first-difference [] [:a] AF)
rlm@318 27 (first-difference [] [:r] DE)
rlm@250 28 (play-moves
rlm@250 29 [[]
rlm@250 30 [:r] [] [:r] [] [:r] [] [:r] []
rlm@250 31 [:r] [] [:r] [] [:r] [] [:d] [:a]
rlm@250 32 [:l] [] [:l] [] [:l] [] [:l] []
rlm@250 33 [:l] [] [:l] [:a] [] [:r] [:a]
rlm@250 34 [:r] [] [:r] [] [:r] [] [:r] []
rlm@250 35 [:r] [] [:d] [] [:d] [] [:d] [:a]]))))
rlm@91 36
rlm@250 37 (defn-memo name-entry-ash
rlm@250 38 ([] (name-entry-ash (oak)))
rlm@250 39 ([script]
rlm@250 40 (->> script
rlm@318 41 (first-difference [] [:d] AF)
rlm@318 42 (first-difference [] [:d] AF)
rlm@318 43 (first-difference [] [:a] AF))))
rlm@91 44
rlm@250 45 (defn-memo rival-name-entry-gary
rlm@250 46 ([] (rival-name-entry-gary (name-entry-ash)))
rlm@250 47 ([script]
rlm@250 48 (->> script
rlm@256 49 (scroll-text 5)
rlm@318 50 (first-difference [] [:d] AF)
rlm@318 51 (first-difference [] [:d] AF)
rlm@318 52 (first-difference [] [:a] AF))))
rlm@250 53
rlm@250 54 (defn-memo rival-name-entry-blue
rlm@250 55 ([] (rival-name-entry-blue (name-entry-ash)))
rlm@250 56 ([script]
rlm@250 57 (->> script
rlm@256 58 (scroll-text 5)
rlm@318 59 (first-difference [] [:d] AF)
rlm@318 60 (first-difference [] [:a] AF))))
rlm@81 61
rlm@250 62 (defn-memo finish-title
rlm@250 63 ([] (finish-title (rival-name-entry-blue)))
rlm@250 64 ([script]
rlm@250 65 (->> script
rlm@256 66 (scroll-text 7))))
rlm@256 67
rlm@250 68 (def title-frames 2194)
rlm@89 69
rlm@89 70 (defn title-checkpoint! []
rlm@88 71 (let [[moves state] (finish-title)]
rlm@250 72 (assert (= title-frames (count moves)))
rlm@250 73 [(write-moves! moves "title-checkpoint")
rlm@250 74 (write-state! state "title-checkpoint")]))
rlm@88 75
rlm@88 76 (defn intro []
rlm@250 77 [(read-moves "title-checkpoint")
rlm@250 78 (read-state "title-checkpoint")])
rlm@88 79
rlm@88 80 (defn test-intro []
rlm@254 81 (play-vbm (moves-filename "title-checkpoint")))
rlm@88 82
rlm@87 83 ;; TODO might be able to glue these together more elegantly with monads
rlm@87 84