diff clojure/com/aurellem/run/bootstrap_0.clj @ 319:92c47a9cdaea

adapting bootstrap to new util functions.
author Robert McIntyre <rlm@mit.edu>
date Tue, 03 Apr 2012 04:16:20 -0500
parents 8e63b0bb8ea3
children 9637a0f52e7b
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj	Mon Apr 02 23:13:49 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj	Tue Apr 03 04:16:20 2012 -0500
     1.3 @@ -1,6 +1,6 @@
     1.4  (ns com.aurellem.run.bootstrap-0
     1.5    (:use (com.aurellem.gb gb-driver util items vbm characters money))
     1.6 -  (:use (com.aurellem.run title save-corruption))
     1.7 +  (:use (com.aurellem.run util title save-corruption))
     1.8    (:use (com.aurellem.exp item-bridge))
     1.9    (:import [com.aurellem.gb.gb_driver SaveState]))
    1.10  
    1.11 @@ -10,22 +10,18 @@
    1.12  (defn-memo to-rival-name
    1.13    ([] (to-rival-name (boot-root)))
    1.14    ([script]
    1.15 -     (-> script
    1.16 +     (->> script
    1.17           title
    1.18           oak
    1.19           name-entry-rlm
    1.20 -         scroll-text
    1.21 -         scroll-text
    1.22 -         scroll-text
    1.23 -         scroll-text
    1.24 -         scroll-text)))
    1.25 +         (scroll-text 5))))
    1.26  
    1.27  (defn-memo name-rival-bootstrap
    1.28    ([] (name-rival-bootstrap (to-rival-name)))
    1.29    ([script]
    1.30       (->> script
    1.31 -         (advance [] [:a])
    1.32 -         (advance [] [:r] DE)
    1.33 +         (first-difference [] [:a] AF)
    1.34 +         (first-difference [] [:r] DE)
    1.35           (play-moves
    1.36            [[]
    1.37             [] [] [:r] [] [:d] [:a]           ;; L
    1.38 @@ -45,7 +41,6 @@
    1.39    ([script]
    1.40       (->> script
    1.41            finish-title
    1.42 -          start-walking
    1.43            walk-to-stairs
    1.44            walk-to-door
    1.45            (walk [↓ ↓]))))
    1.46 @@ -54,7 +49,6 @@
    1.47    ([] (to-pallet-town-edge (leave-house)))
    1.48    ([script]
    1.49       (->> script
    1.50 -          start-walking
    1.51            (walk [→ → → → →
    1.52                   ↑ ↑ ↑ ↑ ↑ ↑]))))
    1.53  
    1.54 @@ -63,94 +57,91 @@
    1.55         (to-pallet-town-edge)))
    1.56    ([script]
    1.57       (->> script
    1.58 -          (advance [:b] [:b :a] DE)
    1.59 -          (scroll-text)
    1.60 -          (play-moves [[:b]])
    1.61 -          (scroll-text)
    1.62 -          (end-text) ;; battle begins
    1.63 -          (scroll-text))))
    1.64 +          (first-difference [:b] [:b :a] DE)
    1.65 +          scroll-text
    1.66 +          (do-nothing 200)
    1.67 +          (play-moves [[:b]]))))
    1.68  
    1.69  (defn-memo capture-pikachu
    1.70    ([] (capture-pikachu (start-pikachu-battle)))
    1.71    ([script]
    1.72       (->> script
    1.73 -          (scroll-text 2)
    1.74 -          (end-text))))
    1.75 +          (scroll-text 3))))
    1.76  
    1.77  (defn-memo go-to-lab
    1.78    ([] (go-to-lab (capture-pikachu)))
    1.79    ([script]
    1.80       (->> script
    1.81 +          end-text
    1.82            (scroll-text 5)
    1.83 -          (end-text)
    1.84 -          (scroll-text)
    1.85 -          (end-text)
    1.86 -          (scroll-text 8)
    1.87 -          (end-text)
    1.88 -          (scroll-text)
    1.89 +          end-text
    1.90 +          ;; oak walks you to his lab; no input required.
    1.91 +          (do-nothing 400))))
    1.92 +
    1.93 +(defn-memo talk-to-oak-in-lab
    1.94 +  ([] (talk-to-oak-in-lab (go-to-lab)))
    1.95 +  ([script]
    1.96 +     (->> script
    1.97 +          (scroll-text 14)
    1.98 +          end-text)))
    1.99 +
   1.100 +(defn-memo try-to-get-eevee
   1.101 +  ([] (try-to-get-eevee (talk-to-oak-in-lab)))
   1.102 +  ([script]
   1.103 +     (->> script
   1.104 +          ;; walk to pokeball
   1.105 +          (walk [↓ → →])
   1.106 +          ;; and try to grab it
   1.107 +          (play-moves
   1.108 +           (concat [↑ ↑ [:a]]
   1.109 +                   (repeat 100 [])))
   1.110 +          (scroll-text 10)
   1.111            (end-text))))
   1.112  
   1.113  (defn-memo obtain-pikachu
   1.114 -  ([] (obtain-pikachu (go-to-lab)))
   1.115 +  ([] (obtain-pikachu (try-to-get-eevee)))
   1.116    ([script]
   1.117       (->> script
   1.118 -          (scroll-text)
   1.119 -          (play-moves
   1.120 -           (concat 
   1.121 -            (repeat 51 [])
   1.122 -            [[:a] []]))
   1.123 -          (walk [↓ ↓ → → ↑])
   1.124 -          (play-moves
   1.125 -           (concat [[] [:a]]
   1.126 -                   (repeat 100 [])))
   1.127 -          (scroll-text 9)
   1.128 -          (end-text)
   1.129 -          (scroll-text 7)
   1.130 -
   1.131 -          (play-moves
   1.132 -           (concat
   1.133 -            (repeat 50 [])
   1.134 -                   [[:b] [] []])))))
   1.135 -
   1.136 +          (scroll-text 6)
   1.137 +          (end-text))))
   1.138 +  
   1.139 +          
   1.140  (defn-memo begin-battle-with-rival
   1.141    ([] (begin-battle-with-rival
   1.142          (obtain-pikachu)))
   1.143    ([script]
   1.144       (->> script
   1.145 -          (walk [↓ ↓ ↓ ↓])
   1.146 +          (walk [↓ ↓ ↓])
   1.147            (scroll-text 3)
   1.148            (end-text)
   1.149            (scroll-text))))
   1.150  
   1.151 -(defn-memo battle-with-rival
   1.152 -  ([] (battle-with-rival
   1.153 +(defn-memo defeat-eevee
   1.154 +  ([] (defeat-eevee
   1.155          (begin-battle-with-rival)))
   1.156    ([script]
   1.157       (->> script
   1.158            (do-nothing 400)
   1.159            (play-moves [[:a]])
   1.160            (critical-hit)
   1.161 -          (do-nothing 100)
   1.162 -          (scroll-text)
   1.163 -          (do-nothing 275)
   1.164 +          (do-nothing 200)
   1.165 +          (scroll-text 2) ;; for eevee's tail-whip
   1.166 +          (do-nothing 10)
   1.167            (play-moves [[:a]])
   1.168            (critical-hit)
   1.169 -          (do-nothing 100)
   1.170 -          (scroll-text)
   1.171 -          (do-nothing 270)
   1.172 +          (do-nothing 200)
   1.173 +          (scroll-text 2) ;; tail whip again
   1.174 +          (do-nothing 10)
   1.175            (play-moves [[:a]])
   1.176            (critical-hit)
   1.177 -          (do-nothing 100)
   1.178 -          (scroll-text))))
   1.179 +          (do-nothing 200))))
   1.180  
   1.181  (defn-memo finish-rival-text
   1.182    ([] (finish-rival-text
   1.183 -       (battle-with-rival)))
   1.184 +       (defeat-eevee)))
   1.185    ([script]
   1.186       (->> script
   1.187 -          (scroll-text 2)
   1.188 -          (end-text)
   1.189 -          (scroll-text 9)
   1.190 +          (scroll-text 12)
   1.191            (end-text))))
   1.192  
   1.193  (defn-memo pikachu-comes-out
   1.194 @@ -158,9 +149,7 @@
   1.195         (finish-rival-text)))
   1.196    ([script]
   1.197       (->> script
   1.198 -          (do-nothing 177)
   1.199 -          (end-text)
   1.200 -          (scroll-text 7)
   1.201 +          (scroll-text 8)
   1.202            (end-text))))
   1.203  
   1.204  (defn-memo leave-oaks-lab
   1.205 @@ -168,17 +157,15 @@
   1.206         (pikachu-comes-out)))
   1.207    ([script]
   1.208       (->> script 
   1.209 -          (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓]))))
   1.210 +          (walk [↓ ↓ ↓ ↓ ↓ ↓]))))
   1.211  
   1.212  (defn-memo oaks-lab->pallet-town-edge
   1.213    ([] (oaks-lab->pallet-town-edge
   1.214         (leave-oaks-lab)))
   1.215    ([script]
   1.216       (->> script
   1.217 -          (walk [← ← ← ←
   1.218 -                 ↑ ↑ ↑ ↑
   1.219 -                 ↑ ↑ ↑ ↑ ↑ ↑
   1.220 -                 → ↑]))))
   1.221 +          (walk [← ← ←
   1.222 +                 ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ →]))))
   1.223  
   1.224  (defn-memo pallet-edge->viridian-mart
   1.225    ([] (pallet-edge->viridian-mart true
   1.226 @@ -189,7 +176,7 @@
   1.227                      [→])
   1.228             dodge-2 (if dodge-stupid-guy?
   1.229                       [↑ ↑ ←]
   1.230 -                     [↑ ↑ ←])]
   1.231 +                     [↑ ↑])]
   1.232         
   1.233         (->> script
   1.234            ;; leave straight grass
   1.235 @@ -232,6 +219,7 @@
   1.236         (pallet-edge->viridian-mart)))
   1.237    ([script]
   1.238       (->> script
   1.239 +          (do-nothing 50)
   1.240            (end-text)
   1.241            (scroll-text 3)
   1.242            (do-nothing 197)
   1.243 @@ -244,22 +232,24 @@
   1.244    ([script]
   1.245       (->> script
   1.246            (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.247 -                 ← ← ← ← ← ← ← ← ← ← 
   1.248 +                 ← ← ← ← ← ← ← ← ← 
   1.249                   ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.250                   ← ←
   1.251                   ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.252                   ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.253                   → → → → → → → →
   1.254 +                 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.255 +                 ← ← ← ← ←
   1.256                   ↓ ↓ ↓ ↓
   1.257 -                 ← ← ← ← ←
   1.258 -                 ↓ ↓ ↓ ↓])
   1.259 -
   1.260 +                 ])
   1.261            (walk-thru-grass
   1.262             [↓ ↓ ↓ ↓ ↓ ↓ ↓])
   1.263 +          (walk [↓ ↓ ← ↓ ↓ ↓ ←
   1.264 +                 ↓ ↓ ↓ ↓ ↓ ↓
   1.265 +                 → → → ↑])
   1.266 +                
   1.267 +          (do-nothing 1))))
   1.268  
   1.269 -          (walk [↓ ↓ ← ↓ ↓ ↓ ←
   1.270 -                 ↓ ↓ ↓ ↓ ↓
   1.271 -                 → → → ↑]))))
   1.272                   
   1.273  (defn-memo viridian-store->oaks-lab-like-a-boss
   1.274    ([] (viridian-store->oaks-lab-like-a-boss
   1.275 @@ -267,7 +257,7 @@
   1.276    ([script]
   1.277       (->> script
   1.278            (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.279 -                 ← ← ← ← ← ← ← ← ← ← 
   1.280 +                 ← ← ← ← ← ← ← ← ← 
   1.281                   ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])
   1.282  
   1.283            (walk-thru-grass
   1.284 @@ -275,18 +265,18 @@
   1.285  
   1.286            (walk
   1.287             [↓ ↓ ← ↓
   1.288 -            ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.289 -            → →])
   1.290 +            ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
   1.291 +            → → → ↓])
   1.292  
   1.293            (walk-thru-grass
   1.294 -           [→ ↓ ↓ ↓])
   1.295 +           [↓ ↓ ↓])
   1.296  
   1.297            (walk [↓ ← ← ↓ ↓ ↓ ↓ ↓ ↓])
   1.298            
   1.299            (walk-thru-grass
   1.300 -           [↓ ↓ ↓ ↓ ↓ ↓ ↓])
   1.301 +           [↓ ↓ ↓ ↓ ↓ ↓])
   1.302            
   1.303 -          (walk [↓ ↓ ← ↓ ↓ ↓ ←
   1.304 +          (walk [↓ ↓ ↓ ← ↓ ↓ ↓ 
   1.305                   ↓ ↓ ↓ ↓ ↓
   1.306                   → → → ↑]))))
   1.307  
   1.308 @@ -296,25 +286,21 @@
   1.309    ([script]
   1.310       (->> script
   1.311            (walk [↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑])
   1.312 -          (play-moves [[:a]])
   1.313 -          (scroll-text 11)
   1.314 -          (end-text)
   1.315 +          (play-moves [[] [:a]])
   1.316 +          (scroll-text 13)
   1.317            (end-text)
   1.318            (do-nothing 200)
   1.319 -          (end-text)
   1.320 -          (scroll-text 3)
   1.321 +          (scroll-text 2)
   1.322            (end-text)
   1.323            (scroll-text 2)
   1.324            (end-text)
   1.325 -          (scroll-text 5)
   1.326 -          (end-text)
   1.327 -          (scroll-text 2)
   1.328 +          (scroll-text 8)
   1.329            (end-text)
   1.330            (scroll-text 9)
   1.331            (end-text)
   1.332            (scroll-text 7)
   1.333 -          (end-text)
   1.334 -          (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓]))))
   1.335 +          (end-text)                    
   1.336 +          (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓]))))
   1.337  
   1.338  (defn-memo return-to-viridian-mart
   1.339    ([] (return-to-viridian-mart
   1.340 @@ -329,7 +315,7 @@
   1.341         (return-to-viridian-mart)))
   1.342    ([script]
   1.343       (->> script 
   1.344 -          (walk [↑ ↑ ← ←]))))
   1.345 +          (walk [↑ ↑ ←]))))
   1.346  
   1.347  (defn buy-item
   1.348    "Assumes that the main item-screen is up, and buys
   1.349 @@ -472,7 +458,7 @@
   1.350            (play-moves [[:b]])
   1.351            (do-nothing 100)
   1.352            (play-moves [[:b] []])
   1.353 -          (advance [:b] [:b :start]))))
   1.354 +          (first-difference [:b] [:b :start] AF))))
   1.355  
   1.356  
   1.357  (defn-memo do-save-corruption
   1.358 @@ -480,7 +466,7 @@
   1.359         (buy-initial-items)))
   1.360    ([script]
   1.361       (->> script
   1.362 -          (advance [] [:d])
   1.363 +          (first-difference [] [:d] AF)
   1.364            (play-moves [[] [] [] [:d]
   1.365                         [] [] [] [:d]
   1.366                         [] [] [] [:d]
   1.367 @@ -494,9 +480,11 @@
   1.368             [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
   1.369              [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]])
   1.370            (title)
   1.371 -          (advance [] [:start])
   1.372 -          (advance [] [:a])
   1.373 -          (advance [:a] [:a :start]))))
   1.374 +          (first-difference [] [:start] AF)
   1.375 +          (first-difference [] [:a] AF)
   1.376 +          (first-difference [:a] [:a :start] AF))))
   1.377 +
   1.378 +(def menu do-nothing )
   1.379  
   1.380  (defn-memo corrupt-item-list
   1.381    ([] (corrupt-item-list
   1.382 @@ -562,7 +550,7 @@
   1.383            (play-moves [[:b]])
   1.384            (do-nothing 40)
   1.385            (play-moves [[:b]])
   1.386 -          (advance [:b] [:start :b])
   1.387 +          (first-difference [:b] [:start :b] AF)
   1.388            (menu [[:a] ↑ ↑ ↑ ↑ ↑         ; get fifth pokemon
   1.389                   [:a] ↓ [:a]            ; and corrupt the
   1.390                   ↓ ↓ ↓ ↓ ↓ [:a]])       ; item list again by