Mercurial > vba-clojure
changeset 319:92c47a9cdaea
adapting bootstrap to new util functions.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 03 Apr 2012 04:16:20 -0500 |
parents | 9a4d3f801c89 |
children | 9637a0f52e7b |
files | clojure/com/aurellem/exp/item_bridge.clj clojure/com/aurellem/gb/saves.clj clojure/com/aurellem/run/bootstrap_0.clj clojure/com/aurellem/run/util.clj save-states/end-oak-conversation.sav |
diffstat | 5 files changed, 106 insertions(+), 107 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/exp/item_bridge.clj Mon Apr 02 23:13:49 2012 -0500 1.2 +++ b/clojure/com/aurellem/exp/item_bridge.clj Tue Apr 03 04:16:20 2012 -0500 1.3 @@ -1,6 +1,6 @@ 1.4 (ns com.aurellem.exp.item-bridge 1.5 (:use (com.aurellem.gb saves util constants gb-driver vbm items assembly)) 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 pokemon)) 1.9 (:import [com.aurellem.gb.gb_driver SaveState])) 1.10 1.11 @@ -88,10 +88,11 @@ 1.12 (first 1.13 (->> 1.14 [[] (mid-game)] 1.15 - (advance [:b] [:b :start]) 1.16 - (advance [] [:d]) 1.17 + (first-difference [:b] [:b :start] AF) 1.18 + (first-difference [] [:d] AF) 1.19 (play-moves [[] [] [] [:d] [] [] [] [:d] [] [] [:a]]) 1.20 - scroll-text 1.21 + (do-nothing 200) 1.22 + (play-moves [[:a]]) 1.23 (play-moves 1.24 ;; this section is copied from speedrun-2942 1.25 ;; and corrupts the save so that the end-of-list marker 1.26 @@ -100,9 +101,9 @@ 1.27 [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] 1.28 [] [] [] [] [] [] [] [] [] [] [:select] [:restart]]) 1.29 (title) 1.30 - (advance [] [:start]) 1.31 - (advance [] [:a]) 1.32 - (advance [:a] [:a :start]))) 1.33 + (first-difference [] [:start] AF) 1.34 + (first-difference [] [:a] AF) 1.35 + (first-difference [:a] [:a :start] AF))) 1.36 [[]])) 1.37 1.38 (defn corrupt 1.39 @@ -119,7 +120,7 @@ 1.40 1.41 (defn gen-start-game-corrupt [] 1.42 (->> (second (intro)) 1.43 - (advance [:b] [:a :b :start]) 1.44 + (first-difference [:b] [:a :b :start] AF) 1.45 (play-moves (corrupt-moves)))) 1.46 1.47 (defn start-game-corrupt []
2.1 --- a/clojure/com/aurellem/gb/saves.clj Mon Apr 02 23:13:49 2012 -0500 2.2 +++ b/clojure/com/aurellem/gb/saves.clj Tue Apr 03 04:16:20 2012 -0500 2.3 @@ -22,4 +22,10 @@ 2.4 2.5 (defn crit-fight [] 2.6 (read-state "battle-rival")) 2.7 + 2.8 +(defn grass-edge [] 2.9 + (read-state "grass' edge")) 2.10 + 2.11 +(defn end-oak-conv [] 2.12 + (read-state "end-oak-conversation")) 2.13 2.14 \ No newline at end of file
3.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Mon Apr 02 23:13:49 2012 -0500 3.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Tue Apr 03 04:16:20 2012 -0500 3.3 @@ -1,6 +1,6 @@ 3.4 (ns com.aurellem.run.bootstrap-0 3.5 (:use (com.aurellem.gb gb-driver util items vbm characters money)) 3.6 - (:use (com.aurellem.run title save-corruption)) 3.7 + (:use (com.aurellem.run util title save-corruption)) 3.8 (:use (com.aurellem.exp item-bridge)) 3.9 (:import [com.aurellem.gb.gb_driver SaveState])) 3.10 3.11 @@ -10,22 +10,18 @@ 3.12 (defn-memo to-rival-name 3.13 ([] (to-rival-name (boot-root))) 3.14 ([script] 3.15 - (-> script 3.16 + (->> script 3.17 title 3.18 oak 3.19 name-entry-rlm 3.20 - scroll-text 3.21 - scroll-text 3.22 - scroll-text 3.23 - scroll-text 3.24 - scroll-text))) 3.25 + (scroll-text 5)))) 3.26 3.27 (defn-memo name-rival-bootstrap 3.28 ([] (name-rival-bootstrap (to-rival-name))) 3.29 ([script] 3.30 (->> script 3.31 - (advance [] [:a]) 3.32 - (advance [] [:r] DE) 3.33 + (first-difference [] [:a] AF) 3.34 + (first-difference [] [:r] DE) 3.35 (play-moves 3.36 [[] 3.37 [] [] [:r] [] [:d] [:a] ;; L 3.38 @@ -45,7 +41,6 @@ 3.39 ([script] 3.40 (->> script 3.41 finish-title 3.42 - start-walking 3.43 walk-to-stairs 3.44 walk-to-door 3.45 (walk [↓ ↓])))) 3.46 @@ -54,7 +49,6 @@ 3.47 ([] (to-pallet-town-edge (leave-house))) 3.48 ([script] 3.49 (->> script 3.50 - start-walking 3.51 (walk [→ → → → → 3.52 ↑ ↑ ↑ ↑ ↑ ↑])))) 3.53 3.54 @@ -63,94 +57,91 @@ 3.55 (to-pallet-town-edge))) 3.56 ([script] 3.57 (->> script 3.58 - (advance [:b] [:b :a] DE) 3.59 - (scroll-text) 3.60 - (play-moves [[:b]]) 3.61 - (scroll-text) 3.62 - (end-text) ;; battle begins 3.63 - (scroll-text)))) 3.64 + (first-difference [:b] [:b :a] DE) 3.65 + scroll-text 3.66 + (do-nothing 200) 3.67 + (play-moves [[:b]])))) 3.68 3.69 (defn-memo capture-pikachu 3.70 ([] (capture-pikachu (start-pikachu-battle))) 3.71 ([script] 3.72 (->> script 3.73 - (scroll-text 2) 3.74 - (end-text)))) 3.75 + (scroll-text 3)))) 3.76 3.77 (defn-memo go-to-lab 3.78 ([] (go-to-lab (capture-pikachu))) 3.79 ([script] 3.80 (->> script 3.81 + end-text 3.82 (scroll-text 5) 3.83 - (end-text) 3.84 - (scroll-text) 3.85 - (end-text) 3.86 - (scroll-text 8) 3.87 - (end-text) 3.88 - (scroll-text) 3.89 + end-text 3.90 + ;; oak walks you to his lab; no input required. 3.91 + (do-nothing 400)))) 3.92 + 3.93 +(defn-memo talk-to-oak-in-lab 3.94 + ([] (talk-to-oak-in-lab (go-to-lab))) 3.95 + ([script] 3.96 + (->> script 3.97 + (scroll-text 14) 3.98 + end-text))) 3.99 + 3.100 +(defn-memo try-to-get-eevee 3.101 + ([] (try-to-get-eevee (talk-to-oak-in-lab))) 3.102 + ([script] 3.103 + (->> script 3.104 + ;; walk to pokeball 3.105 + (walk [↓ → →]) 3.106 + ;; and try to grab it 3.107 + (play-moves 3.108 + (concat [↑ ↑ [:a]] 3.109 + (repeat 100 []))) 3.110 + (scroll-text 10) 3.111 (end-text)))) 3.112 3.113 (defn-memo obtain-pikachu 3.114 - ([] (obtain-pikachu (go-to-lab))) 3.115 + ([] (obtain-pikachu (try-to-get-eevee))) 3.116 ([script] 3.117 (->> script 3.118 - (scroll-text) 3.119 - (play-moves 3.120 - (concat 3.121 - (repeat 51 []) 3.122 - [[:a] []])) 3.123 - (walk [↓ ↓ → → ↑]) 3.124 - (play-moves 3.125 - (concat [[] [:a]] 3.126 - (repeat 100 []))) 3.127 - (scroll-text 9) 3.128 - (end-text) 3.129 - (scroll-text 7) 3.130 - 3.131 - (play-moves 3.132 - (concat 3.133 - (repeat 50 []) 3.134 - [[:b] [] []]))))) 3.135 - 3.136 + (scroll-text 6) 3.137 + (end-text)))) 3.138 + 3.139 + 3.140 (defn-memo begin-battle-with-rival 3.141 ([] (begin-battle-with-rival 3.142 (obtain-pikachu))) 3.143 ([script] 3.144 (->> script 3.145 - (walk [↓ ↓ ↓ ↓]) 3.146 + (walk [↓ ↓ ↓]) 3.147 (scroll-text 3) 3.148 (end-text) 3.149 (scroll-text)))) 3.150 3.151 -(defn-memo battle-with-rival 3.152 - ([] (battle-with-rival 3.153 +(defn-memo defeat-eevee 3.154 + ([] (defeat-eevee 3.155 (begin-battle-with-rival))) 3.156 ([script] 3.157 (->> script 3.158 (do-nothing 400) 3.159 (play-moves [[:a]]) 3.160 (critical-hit) 3.161 - (do-nothing 100) 3.162 - (scroll-text) 3.163 - (do-nothing 275) 3.164 + (do-nothing 200) 3.165 + (scroll-text 2) ;; for eevee's tail-whip 3.166 + (do-nothing 10) 3.167 (play-moves [[:a]]) 3.168 (critical-hit) 3.169 - (do-nothing 100) 3.170 - (scroll-text) 3.171 - (do-nothing 270) 3.172 + (do-nothing 200) 3.173 + (scroll-text 2) ;; tail whip again 3.174 + (do-nothing 10) 3.175 (play-moves [[:a]]) 3.176 (critical-hit) 3.177 - (do-nothing 100) 3.178 - (scroll-text)))) 3.179 + (do-nothing 200)))) 3.180 3.181 (defn-memo finish-rival-text 3.182 ([] (finish-rival-text 3.183 - (battle-with-rival))) 3.184 + (defeat-eevee))) 3.185 ([script] 3.186 (->> script 3.187 - (scroll-text 2) 3.188 - (end-text) 3.189 - (scroll-text 9) 3.190 + (scroll-text 12) 3.191 (end-text)))) 3.192 3.193 (defn-memo pikachu-comes-out 3.194 @@ -158,9 +149,7 @@ 3.195 (finish-rival-text))) 3.196 ([script] 3.197 (->> script 3.198 - (do-nothing 177) 3.199 - (end-text) 3.200 - (scroll-text 7) 3.201 + (scroll-text 8) 3.202 (end-text)))) 3.203 3.204 (defn-memo leave-oaks-lab 3.205 @@ -168,17 +157,15 @@ 3.206 (pikachu-comes-out))) 3.207 ([script] 3.208 (->> script 3.209 - (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓])))) 3.210 + (walk [↓ ↓ ↓ ↓ ↓ ↓])))) 3.211 3.212 (defn-memo oaks-lab->pallet-town-edge 3.213 ([] (oaks-lab->pallet-town-edge 3.214 (leave-oaks-lab))) 3.215 ([script] 3.216 (->> script 3.217 - (walk [← ← ← ← 3.218 - ↑ ↑ ↑ ↑ 3.219 - ↑ ↑ ↑ ↑ ↑ ↑ 3.220 - → ↑])))) 3.221 + (walk [← ← ← 3.222 + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ →])))) 3.223 3.224 (defn-memo pallet-edge->viridian-mart 3.225 ([] (pallet-edge->viridian-mart true 3.226 @@ -189,7 +176,7 @@ 3.227 [→]) 3.228 dodge-2 (if dodge-stupid-guy? 3.229 [↑ ↑ ←] 3.230 - [↑ ↑ ←])] 3.231 + [↑ ↑])] 3.232 3.233 (->> script 3.234 ;; leave straight grass 3.235 @@ -232,6 +219,7 @@ 3.236 (pallet-edge->viridian-mart))) 3.237 ([script] 3.238 (->> script 3.239 + (do-nothing 50) 3.240 (end-text) 3.241 (scroll-text 3) 3.242 (do-nothing 197) 3.243 @@ -244,22 +232,24 @@ 3.244 ([script] 3.245 (->> script 3.246 (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.247 - ← ← ← ← ← ← ← ← ← ← 3.248 + ← ← ← ← ← ← ← ← ← 3.249 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.250 ← ← 3.251 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.252 ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.253 → → → → → → → → 3.254 + ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.255 + ← ← ← ← ← 3.256 ↓ ↓ ↓ ↓ 3.257 - ← ← ← ← ← 3.258 - ↓ ↓ ↓ ↓]) 3.259 - 3.260 + ]) 3.261 (walk-thru-grass 3.262 [↓ ↓ ↓ ↓ ↓ ↓ ↓]) 3.263 + (walk [↓ ↓ ← ↓ ↓ ↓ ← 3.264 + ↓ ↓ ↓ ↓ ↓ ↓ 3.265 + → → → ↑]) 3.266 + 3.267 + (do-nothing 1)))) 3.268 3.269 - (walk [↓ ↓ ← ↓ ↓ ↓ ← 3.270 - ↓ ↓ ↓ ↓ ↓ 3.271 - → → → ↑])))) 3.272 3.273 (defn-memo viridian-store->oaks-lab-like-a-boss 3.274 ([] (viridian-store->oaks-lab-like-a-boss 3.275 @@ -267,7 +257,7 @@ 3.276 ([script] 3.277 (->> script 3.278 (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.279 - ← ← ← ← ← ← ← ← ← ← 3.280 + ← ← ← ← ← ← ← ← ← 3.281 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓]) 3.282 3.283 (walk-thru-grass 3.284 @@ -275,18 +265,18 @@ 3.285 3.286 (walk 3.287 [↓ ↓ ← ↓ 3.288 - ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.289 - → →]) 3.290 + ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 3.291 + → → → ↓]) 3.292 3.293 (walk-thru-grass 3.294 - [→ ↓ ↓ ↓]) 3.295 + [↓ ↓ ↓]) 3.296 3.297 (walk [↓ ← ← ↓ ↓ ↓ ↓ ↓ ↓]) 3.298 3.299 (walk-thru-grass 3.300 - [↓ ↓ ↓ ↓ ↓ ↓ ↓]) 3.301 + [↓ ↓ ↓ ↓ ↓ ↓]) 3.302 3.303 - (walk [↓ ↓ ← ↓ ↓ ↓ ← 3.304 + (walk [↓ ↓ ↓ ← ↓ ↓ ↓ 3.305 ↓ ↓ ↓ ↓ ↓ 3.306 → → → ↑])))) 3.307 3.308 @@ -296,25 +286,21 @@ 3.309 ([script] 3.310 (->> script 3.311 (walk [↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑]) 3.312 - (play-moves [[:a]]) 3.313 - (scroll-text 11) 3.314 - (end-text) 3.315 + (play-moves [[] [:a]]) 3.316 + (scroll-text 13) 3.317 (end-text) 3.318 (do-nothing 200) 3.319 - (end-text) 3.320 - (scroll-text 3) 3.321 + (scroll-text 2) 3.322 (end-text) 3.323 (scroll-text 2) 3.324 (end-text) 3.325 - (scroll-text 5) 3.326 - (end-text) 3.327 - (scroll-text 2) 3.328 + (scroll-text 8) 3.329 (end-text) 3.330 (scroll-text 9) 3.331 (end-text) 3.332 (scroll-text 7) 3.333 - (end-text) 3.334 - (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])))) 3.335 + (end-text) 3.336 + (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])))) 3.337 3.338 (defn-memo return-to-viridian-mart 3.339 ([] (return-to-viridian-mart 3.340 @@ -329,7 +315,7 @@ 3.341 (return-to-viridian-mart))) 3.342 ([script] 3.343 (->> script 3.344 - (walk [↑ ↑ ← ←])))) 3.345 + (walk [↑ ↑ ←])))) 3.346 3.347 (defn buy-item 3.348 "Assumes that the main item-screen is up, and buys 3.349 @@ -472,7 +458,7 @@ 3.350 (play-moves [[:b]]) 3.351 (do-nothing 100) 3.352 (play-moves [[:b] []]) 3.353 - (advance [:b] [:b :start])))) 3.354 + (first-difference [:b] [:b :start] AF)))) 3.355 3.356 3.357 (defn-memo do-save-corruption 3.358 @@ -480,7 +466,7 @@ 3.359 (buy-initial-items))) 3.360 ([script] 3.361 (->> script 3.362 - (advance [] [:d]) 3.363 + (first-difference [] [:d] AF) 3.364 (play-moves [[] [] [] [:d] 3.365 [] [] [] [:d] 3.366 [] [] [] [:d] 3.367 @@ -494,9 +480,11 @@ 3.368 [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] 3.369 [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]]) 3.370 (title) 3.371 - (advance [] [:start]) 3.372 - (advance [] [:a]) 3.373 - (advance [:a] [:a :start])))) 3.374 + (first-difference [] [:start] AF) 3.375 + (first-difference [] [:a] AF) 3.376 + (first-difference [:a] [:a :start] AF)))) 3.377 + 3.378 +(def menu do-nothing ) 3.379 3.380 (defn-memo corrupt-item-list 3.381 ([] (corrupt-item-list 3.382 @@ -562,7 +550,7 @@ 3.383 (play-moves [[:b]]) 3.384 (do-nothing 40) 3.385 (play-moves [[:b]]) 3.386 - (advance [:b] [:start :b]) 3.387 + (first-difference [:b] [:start :b] AF) 3.388 (menu [[:a] ↑ ↑ ↑ ↑ ↑ ; get fifth pokemon 3.389 [:a] ↓ [:a] ; and corrupt the 3.390 ↓ ↓ ↓ ↓ ↓ [:a]]) ; item list again by
4.1 --- a/clojure/com/aurellem/run/util.clj Mon Apr 02 23:13:49 2012 -0500 4.2 +++ b/clojure/com/aurellem/run/util.clj Tue Apr 03 04:16:20 2012 -0500 4.3 @@ -32,7 +32,6 @@ 4.4 [new-actions new-state] 4.5 (recur new-actions new-state)))))) 4.6 4.7 - 4.8 (defn binary-search [metric] 4.9 (let [baseline (metric 0)] 4.10 (loop [low 1 4.11 @@ -142,6 +141,11 @@ 4.12 script 4.13 (range n)))) 4.14 4.15 +(defn end-text 4.16 + ([script] 4.17 + (->> (do-nothing 150) 4.18 + (play-moves [[:b]])))) 4.19 + 4.20 (defn do-nothing [n script] 4.21 (->> script 4.22 (play-moves
5.1 Binary file save-states/end-oak-conversation.sav has changed