diff clojure/com/aurellem/run/bootstrap_0.clj @ 336:25b7bb7da3b1

Fixed two major bugs related to restart events which were causing desync. The entire video now syncs properly.
author Robert McIntyre <rlm@mit.edu>
date Sat, 07 Apr 2012 07:31:59 -0500
parents 57f4c57d2897
children 2dd40f6b6a1f
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj	Sat Apr 07 05:42:26 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj	Sat Apr 07 07:31:59 2012 -0500
     1.3 @@ -352,8 +352,6 @@
     1.4            (aget mem list-cursor-offset-address))))
     1.5    ([] (list-offset @current-state)))
     1.6  
     1.7 -
     1.8 -
     1.9  (defn exp-item-selection []
    1.10    (clojure.pprint/pprint
    1.11     (apply memory-compare
    1.12 @@ -433,7 +431,32 @@
    1.13         (wait-until (partial set-cursor-relative 1))
    1.14         (play-moves [[:a] []])))
    1.15  
    1.16 -(defn-memo do-save-corruption
    1.17 +(defn restart
    1.18 +  "Two button presses after a restart event are lost when converting to
    1.19 +   VBM format.  To compensate, step the state forward two steps."
    1.20 +  [[moves state :as script]]
    1.21 +  (->> [(concat moves [[:restart]])
    1.22 +        (run-moves state [[:restart]
    1.23 +
    1.24 +
    1.25 +                          ;;[] []
    1.26 +
    1.27 +                          ])]
    1.28 +       (do-nothing 2)))
    1.29 +
    1.30 +(defn restart
    1.31 +  "The two button presses after a restart event are converted to
    1.32 +   blanks. Due to weirdness with the VBM format. To compensate, ensure
    1.33 +   that the two button presses after restart are both blanks."
    1.34 +  [script]
    1.35 +  (play-moves [[:restart] [] []] script))
    1.36 +
    1.37 +(defn restart-wrong
    1.38 +  [[moves state :as script]]
    1.39 +  [(concat moves [[:restart] [] []])
    1.40 +   (run-moves state [[:restart]])])
    1.41 +    
    1.42 +(defn do-save-corruption
    1.43    ([] (do-save-corruption
    1.44         (walk-to-counter)))
    1.45    ([script]
    1.46 @@ -448,7 +471,8 @@
    1.47             ;; 0xFF, allowing manipulation of non-pokemon data in RAM
    1.48             ;; via the pokemon interface.
    1.49             [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
    1.50 -            [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]])
    1.51 +            [] [] [] [] [] [] [] [] [] [] [] []])
    1.52 +          (restart)
    1.53            (title)
    1.54            (first-difference [] [:start] AF)
    1.55            (first-difference [] [:a] AF))))
    1.56 @@ -479,12 +503,12 @@
    1.57         select-menu-entry
    1.58         scroll-text))
    1.59  
    1.60 -(defn-memo corrupt-item-list
    1.61 +(defn corrupt-item-list
    1.62    "Corrupt the num-of-items variable by switching a corrupted pokemon
    1.63     into out-of-bounds memory."
    1.64    ([] (corrupt-item-list
    1.65 -       (corrupted-checkpoint)
    1.66 -       ;;(do-save-corruption)
    1.67 +       ;;(corrupted-checkpoint)
    1.68 +       (do-save-corruption)
    1.69         ))
    1.70    ([script]
    1.71       (->> script
    1.72 @@ -501,7 +525,7 @@
    1.73            close-menu
    1.74            close-menu)))
    1.75  
    1.76 -(defn-memo get-lots-of-money
    1.77 +(defn get-lots-of-money
    1.78    "Sell 0xFE cancel buttons to make a tremendous amount of money."
    1.79    ([] (get-lots-of-money (corrupt-item-list)))
    1.80    ([script]
    1.81 @@ -520,7 +544,7 @@
    1.82  (defn note [str script]
    1.83    (println str) script)
    1.84  
    1.85 -(defn-memo buy-bootstrapping-items
    1.86 +(defn buy-bootstrapping-items
    1.87    "Buy items that will become part of the bootstrapping
    1.88     program."
    1.89    ([] (buy-bootstrapping-items (get-lots-of-money)))
    1.90 @@ -550,7 +574,7 @@
    1.91            (play-moves [[:b]])
    1.92            end-text)))
    1.93  
    1.94 -(defn-memo corrupt-item-list-again
    1.95 +(defn corrupt-item-list-again
    1.96    ([] (corrupt-item-list-again (buy-bootstrapping-items)))
    1.97    ([script]
    1.98       (->> script
    1.99 @@ -577,8 +601,7 @@
   1.100    ([script]
   1.101       (->> script
   1.102            ;; leave store
   1.103 -          (walk [↓ ↓ → ↓])
   1.104 -          (do-nothing 1))))
   1.105 +          (walk [↓ ↓ → ↓]))))
   1.106  
   1.107  (defn force-encounter [direction script]
   1.108    (delayed-improbability-search
   1.109 @@ -586,7 +609,7 @@
   1.110     #(search-string % "Wild")
   1.111     (partial move direction) script))
   1.112                                  
   1.113 -(defn-memo fight-wild-pokemon
   1.114 +(defn fight-wild-pokemon
   1.115    ([] (fight-wild-pokemon (leave-viridian-store)))
   1.116    ([script]
   1.117       (->> script
   1.118 @@ -595,23 +618,26 @@
   1.119                   ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])
   1.120            (force-encounter →))))
   1.121  
   1.122 -(defn-memo run-from-pokemon
   1.123 +(defn run-from-pokemon
   1.124    ([] (run-from-pokemon (fight-wild-pokemon)))
   1.125    ([script]
   1.126       (->> script
   1.127            (scroll-text)
   1.128 +          (play-moves [[:a]])
   1.129            (wait-until select-menu-entry)
   1.130            (set-cursor 1)
   1.131            (first-difference [] → AF)
   1.132            (scroll-text)
   1.133            (scroll-text))))
   1.134  
   1.135 -(defn-memo to-poke-center-computer
   1.136 +29952
   1.137 +
   1.138 +(defn to-poke-center-computer
   1.139    ([] (to-poke-center-computer
   1.140         (run-from-pokemon)))
   1.141    ([script]
   1.142       (->> script
   1.143 -          (walk-thru-grass [→ ↑])
   1.144 +          (walk-thru-grass [→ → ↑])
   1.145            (walk [↑ ← ← ←
   1.146                   ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
   1.147                   ← ←