changeset 335:abd1ca8a25cc

fixed major bug with first-difference which was causing de-sync.
author Robert McIntyre <rlm@mit.edu>
date Sat, 07 Apr 2012 05:42:26 -0500
parents 57f4c57d2897
children 25b7bb7da3b1
files clojure/com/aurellem/gb/vbm.clj clojure/com/aurellem/run/title.clj clojure/com/aurellem/run/util.clj moves/temp.vbm moves/total-run.vbm
diffstat 5 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/vbm.clj	Fri Apr 06 14:54:39 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/vbm.clj	Sat Apr 07 05:42:26 2012 -0500
     1.3 @@ -125,3 +125,7 @@
     1.4          (.getCanonicalPath yellow-rom-image)))
     1.5    nil)
     1.6  
     1.7 +(defn test-moves [moves]
     1.8 +  (write-moves! moves "temp")
     1.9 +  (play-vbm (moves-filename "temp")))
    1.10 +
     2.1 --- a/clojure/com/aurellem/run/title.clj	Fri Apr 06 14:54:39 2012 -0500
     2.2 +++ b/clojure/com/aurellem/run/title.clj	Sat Apr 07 05:42:26 2012 -0500
     2.3 @@ -13,7 +13,7 @@
     2.4            (first-difference [] [:a] AF)
     2.5            (first-difference [] [:start] AF))))
     2.6  
     2.7 -(defn oak
     2.8 +(defn-memo oak
     2.9    ([] (oak (title)))
    2.10    ([script]
    2.11       (->> script
    2.12 @@ -77,8 +77,8 @@
    2.13    [(read-moves "title-checkpoint")
    2.14     (read-state "title-checkpoint")])
    2.15  
    2.16 -(defn test-intro []
    2.17 -  (play-vbm (moves-filename "title-checkpoint")))
    2.18 +;;(defn test-intro []
    2.19 +;;  (play-vbm (moves-filename "title-checkpoint")))
    2.20  
    2.21  ;; TODO might be able to glue these together more elegantly with monads
    2.22  
     3.1 --- a/clojure/com/aurellem/run/util.clj	Fri Apr 06 14:54:39 2012 -0500
     3.2 +++ b/clojure/com/aurellem/run/util.clj	Sat Apr 07 05:42:26 2012 -0500
     3.3 @@ -17,7 +17,7 @@
     3.4  (defn first-difference
     3.5    [base alt difference-metric [moves root :as script]]
     3.6    (loop [branch-point root
     3.7 -         actions moves]
     3.8 +         actions (vec moves)]
     3.9      (let [base-branch (step branch-point base)
    3.10            base-val (difference-metric base-branch)
    3.11            alt-branch (step branch-point alt)
     4.1 Binary file moves/temp.vbm has changed
     5.1 Binary file moves/total-run.vbm has changed