changeset 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
files clojure/com/aurellem/gb/vbm.clj clojure/com/aurellem/run/adv_choreo.clj clojure/com/aurellem/run/bootstrap_1.clj clojure/com/aurellem/run/final_cut.clj
diffstat 4 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/vbm.clj	Sun Sep 02 09:33:40 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/vbm.clj	Sun Sep 02 10:34:14 2012 -0500
     1.3 @@ -111,6 +111,9 @@
     1.4      (clojure.java.io/copy (buttons->vbm-bytes moves) target)
     1.5      target))
     1.6  
     1.7 +(defn write-moves-to-file! [moves file]
     1.8 +  (clojure.java.io/copy (buttons->vbm-bytes moves) file))
     1.9 +
    1.10  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.11  
    1.12  (use 'clojure.java.shell)
     2.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Sun Sep 02 09:33:40 2012 -0500
     2.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Sun Sep 02 10:34:14 2012 -0500
     2.3 @@ -303,7 +303,7 @@
     2.4                       (+ (count init) start-address)))])]
     2.5      (concat init header glyph-display state-machine return-to-header)))
     2.6  
     2.7 -(defn begin-glyph-bootstrap
     2.8 +(defn-memo begin-glyph-bootstrap
     2.9    ([] (begin-glyph-bootstrap (launch-main-bootstrap-program)))
    2.10    ([script]
    2.11       (let [glyph-init (glyph-init-program relocated-bootstrap-start)
    2.12 @@ -322,19 +322,20 @@
    2.13              (transfer-control relocated-bootstrap-start)
    2.14              (do-nothing 1)))))
    2.15  
    2.16 -(defn write-all-program-data
    2.17 +(defn-memo write-all-program-data
    2.18    ([] (write-all-program-data (begin-glyph-bootstrap)))
    2.19    ([script]
    2.20       (let [base-address main-program-base-address]
    2.21         (->> script
    2.22              (write-RAM base-address (program-data base-address))))))
    2.23  
    2.24 -(defn activate-program
    2.25 +(defn-memo activate-program
    2.26    ([] (activate-program (write-all-program-data)))
    2.27    ([script]
    2.28       (->> script
    2.29            (transfer-control main-program-base-address)
    2.30 -          (do-nothing 1800))))
    2.31 +          (do-nothing 1800)
    2.32 +          (play-moves [[:a]]))))
    2.33  
    2.34  (def advanced-render-dir
    2.35    (File. user-home "proj/vba-clojure/render/advanced"))
    2.36 @@ -399,7 +400,7 @@
    2.37        move-images screenshots targets))))
    2.38  
    2.39  (defn write-advanced-script!
    2.40 -  [] (write-script! (launch-bootstrap-program) "advanced"))
    2.41 +  [] (write-script! (activate-program) "advanced"))
    2.42                      
    2.43  (defn advanced-script []
    2.44    (read-script "advanced"))
     3.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Sun Sep 02 09:33:40 2012 -0500
     3.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Sun Sep 02 10:34:14 2012 -0500
     3.3 @@ -150,7 +150,7 @@
     3.4    (map second (filter (comp (partial = 0) first)
     3.5                        (partition 2 (pc-item-writer-program)))))
     3.6  
     3.7 -(defn bootstrap-corrupt-save
     3.8 +(defn-memo bootstrap-corrupt-save
     3.9    ([] (bootstrap-corrupt-save (to-room-pc)))
    3.10    ([script]
    3.11     (->> script
    3.12 @@ -198,7 +198,7 @@
    3.13  ;;2 -- 254
    3.14  ;;3 -- 255
    3.15  
    3.16 -(defn activate-home-pc
    3.17 +(defn-memo activate-home-pc
    3.18    [script]
    3.19    (->> script
    3.20         (delayed-difference [] [:a]
    3.21 @@ -560,7 +560,7 @@
    3.22            (deposit-held-item-named :TM09          55)
    3.23            (deposit-held-item-named 0x00           55))))
    3.24  
    3.25 -(defn hacking-2
    3.26 +(defn-memo hacking-2
    3.27    ([] (hacking-2 (hacking-1)))
    3.28    ([script]
    3.29       (->> script
    3.30 @@ -809,7 +809,7 @@
    3.31          (pc-item-writer-program)))])
    3.32  
    3.33  
    3.34 -(defn launch-main-bootstrap-program
    3.35 +(defn-memo launch-main-bootstrap-program
    3.36    ([] (launch-main-bootstrap-program
    3.37         ;;(control-checkpoint)
    3.38         (launch-bootstrap-program)
     4.1 --- a/clojure/com/aurellem/run/final_cut.clj	Sun Sep 02 09:33:40 2012 -0500
     4.2 +++ b/clojure/com/aurellem/run/final_cut.clj	Sun Sep 02 10:34:14 2012 -0500
     4.3 @@ -22,7 +22,7 @@
     4.4      render-ram-map?
     4.5      initial-state
     4.6      moves]
     4.7 -     (write-moves! moves (File. target-dir "rlm-yellow-hack.vbm"))
     4.8 +     (write-moves-to-file! moves (File. target-dir "rlm-yellow-hack.vbm"))
     4.9       (let [ram-map-dir (File. target-dir "ram-map")
    4.10             frames-dir (File. target-dir "frames")
    4.11             moves-dir (File. target-dir "moves")