diff clojure/com/aurellem/run/adv_choreo.clj @ 604:c8cda378e1a0

fixed flaw in advanced move recording.
author Robert McIntyre <rlm@mit.edu>
date Sun, 02 Sep 2012 10:34:14 -0500
parents b3e5006e23f0
children 54644b08da1a
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Sun Sep 02 09:33:40 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Sun Sep 02 10:34:14 2012 -0500
     1.3 @@ -303,7 +303,7 @@
     1.4                       (+ (count init) start-address)))])]
     1.5      (concat init header glyph-display state-machine return-to-header)))
     1.6  
     1.7 -(defn begin-glyph-bootstrap
     1.8 +(defn-memo begin-glyph-bootstrap
     1.9    ([] (begin-glyph-bootstrap (launch-main-bootstrap-program)))
    1.10    ([script]
    1.11       (let [glyph-init (glyph-init-program relocated-bootstrap-start)
    1.12 @@ -322,19 +322,20 @@
    1.13              (transfer-control relocated-bootstrap-start)
    1.14              (do-nothing 1)))))
    1.15  
    1.16 -(defn write-all-program-data
    1.17 +(defn-memo write-all-program-data
    1.18    ([] (write-all-program-data (begin-glyph-bootstrap)))
    1.19    ([script]
    1.20       (let [base-address main-program-base-address]
    1.21         (->> script
    1.22              (write-RAM base-address (program-data base-address))))))
    1.23  
    1.24 -(defn activate-program
    1.25 +(defn-memo activate-program
    1.26    ([] (activate-program (write-all-program-data)))
    1.27    ([script]
    1.28       (->> script
    1.29            (transfer-control main-program-base-address)
    1.30 -          (do-nothing 1800))))
    1.31 +          (do-nothing 1800)
    1.32 +          (play-moves [[:a]]))))
    1.33  
    1.34  (def advanced-render-dir
    1.35    (File. user-home "proj/vba-clojure/render/advanced"))
    1.36 @@ -399,7 +400,7 @@
    1.37        move-images screenshots targets))))
    1.38  
    1.39  (defn write-advanced-script!
    1.40 -  [] (write-script! (launch-bootstrap-program) "advanced"))
    1.41 +  [] (write-script! (activate-program) "advanced"))
    1.42                      
    1.43  (defn advanced-script []
    1.44    (read-script "advanced"))