# HG changeset patch # User Robert McIntyre # Date 1333444580 18000 # Node ID 92c47a9cdaea2f56f0275f5434544df0c781de8e # Parent 9a4d3f801c89a3ea8d515f35c29df8168598cbc9 adapting bootstrap to new util functions. diff -r 9a4d3f801c89 -r 92c47a9cdaea clojure/com/aurellem/exp/item_bridge.clj --- a/clojure/com/aurellem/exp/item_bridge.clj Mon Apr 02 23:13:49 2012 -0500 +++ b/clojure/com/aurellem/exp/item_bridge.clj Tue Apr 03 04:16:20 2012 -0500 @@ -1,6 +1,6 @@ (ns com.aurellem.exp.item-bridge (:use (com.aurellem.gb saves util constants gb-driver vbm items assembly)) - (:use (com.aurellem.run title save-corruption)) + (:use (com.aurellem.run util title save-corruption)) ;;(:use (com.aurellem.exp pokemon)) (:import [com.aurellem.gb.gb_driver SaveState])) @@ -88,10 +88,11 @@ (first (->> [[] (mid-game)] - (advance [:b] [:b :start]) - (advance [] [:d]) + (first-difference [:b] [:b :start] AF) + (first-difference [] [:d] AF) (play-moves [[] [] [] [:d] [] [] [] [:d] [] [] [:a]]) - scroll-text + (do-nothing 200) + (play-moves [[:a]]) (play-moves ;; this section is copied from speedrun-2942 ;; and corrupts the save so that the end-of-list marker @@ -100,9 +101,9 @@ [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]]) (title) - (advance [] [:start]) - (advance [] [:a]) - (advance [:a] [:a :start]))) + (first-difference [] [:start] AF) + (first-difference [] [:a] AF) + (first-difference [:a] [:a :start] AF))) [[]])) (defn corrupt @@ -119,7 +120,7 @@ (defn gen-start-game-corrupt [] (->> (second (intro)) - (advance [:b] [:a :b :start]) + (first-difference [:b] [:a :b :start] AF) (play-moves (corrupt-moves)))) (defn start-game-corrupt [] diff -r 9a4d3f801c89 -r 92c47a9cdaea clojure/com/aurellem/gb/saves.clj --- a/clojure/com/aurellem/gb/saves.clj Mon Apr 02 23:13:49 2012 -0500 +++ b/clojure/com/aurellem/gb/saves.clj Tue Apr 03 04:16:20 2012 -0500 @@ -22,4 +22,10 @@ (defn crit-fight [] (read-state "battle-rival")) + +(defn grass-edge [] + (read-state "grass' edge")) + +(defn end-oak-conv [] + (read-state "end-oak-conversation")) \ No newline at end of file diff -r 9a4d3f801c89 -r 92c47a9cdaea clojure/com/aurellem/run/bootstrap_0.clj --- a/clojure/com/aurellem/run/bootstrap_0.clj Mon Apr 02 23:13:49 2012 -0500 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Tue Apr 03 04:16:20 2012 -0500 @@ -1,6 +1,6 @@ (ns com.aurellem.run.bootstrap-0 (:use (com.aurellem.gb gb-driver util items vbm characters money)) - (:use (com.aurellem.run title save-corruption)) + (:use (com.aurellem.run util title save-corruption)) (:use (com.aurellem.exp item-bridge)) (:import [com.aurellem.gb.gb_driver SaveState])) @@ -10,22 +10,18 @@ (defn-memo to-rival-name ([] (to-rival-name (boot-root))) ([script] - (-> script + (->> script title oak name-entry-rlm - scroll-text - scroll-text - scroll-text - scroll-text - scroll-text))) + (scroll-text 5)))) (defn-memo name-rival-bootstrap ([] (name-rival-bootstrap (to-rival-name))) ([script] (->> script - (advance [] [:a]) - (advance [] [:r] DE) + (first-difference [] [:a] AF) + (first-difference [] [:r] DE) (play-moves [[] [] [] [:r] [] [:d] [:a] ;; L @@ -45,7 +41,6 @@ ([script] (->> script finish-title - start-walking walk-to-stairs walk-to-door (walk [↓ ↓])))) @@ -54,7 +49,6 @@ ([] (to-pallet-town-edge (leave-house))) ([script] (->> script - start-walking (walk [→ → → → → ↑ ↑ ↑ ↑ ↑ ↑])))) @@ -63,94 +57,91 @@ (to-pallet-town-edge))) ([script] (->> script - (advance [:b] [:b :a] DE) - (scroll-text) - (play-moves [[:b]]) - (scroll-text) - (end-text) ;; battle begins - (scroll-text)))) + (first-difference [:b] [:b :a] DE) + scroll-text + (do-nothing 200) + (play-moves [[:b]])))) (defn-memo capture-pikachu ([] (capture-pikachu (start-pikachu-battle))) ([script] (->> script - (scroll-text 2) - (end-text)))) + (scroll-text 3)))) (defn-memo go-to-lab ([] (go-to-lab (capture-pikachu))) ([script] (->> script + end-text (scroll-text 5) - (end-text) - (scroll-text) - (end-text) - (scroll-text 8) - (end-text) - (scroll-text) + end-text + ;; oak walks you to his lab; no input required. + (do-nothing 400)))) + +(defn-memo talk-to-oak-in-lab + ([] (talk-to-oak-in-lab (go-to-lab))) + ([script] + (->> script + (scroll-text 14) + end-text))) + +(defn-memo try-to-get-eevee + ([] (try-to-get-eevee (talk-to-oak-in-lab))) + ([script] + (->> script + ;; walk to pokeball + (walk [↓ → →]) + ;; and try to grab it + (play-moves + (concat [↑ ↑ [:a]] + (repeat 100 []))) + (scroll-text 10) (end-text)))) (defn-memo obtain-pikachu - ([] (obtain-pikachu (go-to-lab))) + ([] (obtain-pikachu (try-to-get-eevee))) ([script] (->> script - (scroll-text) - (play-moves - (concat - (repeat 51 []) - [[:a] []])) - (walk [↓ ↓ → → ↑]) - (play-moves - (concat [[] [:a]] - (repeat 100 []))) - (scroll-text 9) - (end-text) - (scroll-text 7) - - (play-moves - (concat - (repeat 50 []) - [[:b] [] []]))))) - + (scroll-text 6) + (end-text)))) + + (defn-memo begin-battle-with-rival ([] (begin-battle-with-rival (obtain-pikachu))) ([script] (->> script - (walk [↓ ↓ ↓ ↓]) + (walk [↓ ↓ ↓]) (scroll-text 3) (end-text) (scroll-text)))) -(defn-memo battle-with-rival - ([] (battle-with-rival +(defn-memo defeat-eevee + ([] (defeat-eevee (begin-battle-with-rival))) ([script] (->> script (do-nothing 400) (play-moves [[:a]]) (critical-hit) - (do-nothing 100) - (scroll-text) - (do-nothing 275) + (do-nothing 200) + (scroll-text 2) ;; for eevee's tail-whip + (do-nothing 10) (play-moves [[:a]]) (critical-hit) - (do-nothing 100) - (scroll-text) - (do-nothing 270) + (do-nothing 200) + (scroll-text 2) ;; tail whip again + (do-nothing 10) (play-moves [[:a]]) (critical-hit) - (do-nothing 100) - (scroll-text)))) + (do-nothing 200)))) (defn-memo finish-rival-text ([] (finish-rival-text - (battle-with-rival))) + (defeat-eevee))) ([script] (->> script - (scroll-text 2) - (end-text) - (scroll-text 9) + (scroll-text 12) (end-text)))) (defn-memo pikachu-comes-out @@ -158,9 +149,7 @@ (finish-rival-text))) ([script] (->> script - (do-nothing 177) - (end-text) - (scroll-text 7) + (scroll-text 8) (end-text)))) (defn-memo leave-oaks-lab @@ -168,17 +157,15 @@ (pikachu-comes-out))) ([script] (->> script - (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓])))) + (walk [↓ ↓ ↓ ↓ ↓ ↓])))) (defn-memo oaks-lab->pallet-town-edge ([] (oaks-lab->pallet-town-edge (leave-oaks-lab))) ([script] (->> script - (walk [← ← ← ← - ↑ ↑ ↑ ↑ - ↑ ↑ ↑ ↑ ↑ ↑ - → ↑])))) + (walk [← ← ← + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ →])))) (defn-memo pallet-edge->viridian-mart ([] (pallet-edge->viridian-mart true @@ -189,7 +176,7 @@ [→]) dodge-2 (if dodge-stupid-guy? [↑ ↑ ←] - [↑ ↑ ←])] + [↑ ↑])] (->> script ;; leave straight grass @@ -232,6 +219,7 @@ (pallet-edge->viridian-mart))) ([script] (->> script + (do-nothing 50) (end-text) (scroll-text 3) (do-nothing 197) @@ -244,22 +232,24 @@ ([script] (->> script (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ - ← ← ← ← ← ← ← ← ← ← + ← ← ← ← ← ← ← ← ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ← ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ → → → → → → → → + ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ + ← ← ← ← ← ↓ ↓ ↓ ↓ - ← ← ← ← ← - ↓ ↓ ↓ ↓]) - + ]) (walk-thru-grass [↓ ↓ ↓ ↓ ↓ ↓ ↓]) + (walk [↓ ↓ ← ↓ ↓ ↓ ← + ↓ ↓ ↓ ↓ ↓ ↓ + → → → ↑]) + + (do-nothing 1)))) - (walk [↓ ↓ ← ↓ ↓ ↓ ← - ↓ ↓ ↓ ↓ ↓ - → → → ↑])))) (defn-memo viridian-store->oaks-lab-like-a-boss ([] (viridian-store->oaks-lab-like-a-boss @@ -267,7 +257,7 @@ ([script] (->> script (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ - ← ← ← ← ← ← ← ← ← ← + ← ← ← ← ← ← ← ← ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓]) (walk-thru-grass @@ -275,18 +265,18 @@ (walk [↓ ↓ ← ↓ - ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ - → →]) + ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ + → → → ↓]) (walk-thru-grass - [→ ↓ ↓ ↓]) + [↓ ↓ ↓]) (walk [↓ ← ← ↓ ↓ ↓ ↓ ↓ ↓]) (walk-thru-grass - [↓ ↓ ↓ ↓ ↓ ↓ ↓]) + [↓ ↓ ↓ ↓ ↓ ↓]) - (walk [↓ ↓ ← ↓ ↓ ↓ ← + (walk [↓ ↓ ↓ ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ → → → ↑])))) @@ -296,25 +286,21 @@ ([script] (->> script (walk [↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑]) - (play-moves [[:a]]) - (scroll-text 11) - (end-text) + (play-moves [[] [:a]]) + (scroll-text 13) (end-text) (do-nothing 200) - (end-text) - (scroll-text 3) + (scroll-text 2) (end-text) (scroll-text 2) (end-text) - (scroll-text 5) - (end-text) - (scroll-text 2) + (scroll-text 8) (end-text) (scroll-text 9) (end-text) (scroll-text 7) - (end-text) - (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])))) + (end-text) + (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])))) (defn-memo return-to-viridian-mart ([] (return-to-viridian-mart @@ -329,7 +315,7 @@ (return-to-viridian-mart))) ([script] (->> script - (walk [↑ ↑ ← ←])))) + (walk [↑ ↑ ←])))) (defn buy-item "Assumes that the main item-screen is up, and buys @@ -472,7 +458,7 @@ (play-moves [[:b]]) (do-nothing 100) (play-moves [[:b] []]) - (advance [:b] [:b :start])))) + (first-difference [:b] [:b :start] AF)))) (defn-memo do-save-corruption @@ -480,7 +466,7 @@ (buy-initial-items))) ([script] (->> script - (advance [] [:d]) + (first-difference [] [:d] AF) (play-moves [[] [] [] [:d] [] [] [] [:d] [] [] [] [:d] @@ -494,9 +480,11 @@ [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]]) (title) - (advance [] [:start]) - (advance [] [:a]) - (advance [:a] [:a :start])))) + (first-difference [] [:start] AF) + (first-difference [] [:a] AF) + (first-difference [:a] [:a :start] AF)))) + +(def menu do-nothing ) (defn-memo corrupt-item-list ([] (corrupt-item-list @@ -562,7 +550,7 @@ (play-moves [[:b]]) (do-nothing 40) (play-moves [[:b]]) - (advance [:b] [:start :b]) + (first-difference [:b] [:start :b] AF) (menu [[:a] ↑ ↑ ↑ ↑ ↑ ; get fifth pokemon [:a] ↓ [:a] ; and corrupt the ↓ ↓ ↓ ↓ ↓ [:a]]) ; item list again by diff -r 9a4d3f801c89 -r 92c47a9cdaea clojure/com/aurellem/run/util.clj --- a/clojure/com/aurellem/run/util.clj Mon Apr 02 23:13:49 2012 -0500 +++ b/clojure/com/aurellem/run/util.clj Tue Apr 03 04:16:20 2012 -0500 @@ -32,7 +32,6 @@ [new-actions new-state] (recur new-actions new-state)))))) - (defn binary-search [metric] (let [baseline (metric 0)] (loop [low 1 @@ -142,6 +141,11 @@ script (range n)))) +(defn end-text + ([script] + (->> (do-nothing 150) + (play-moves [[:b]])))) + (defn do-nothing [n script] (->> script (play-moves diff -r 9a4d3f801c89 -r 92c47a9cdaea save-states/end-oak-conversation.sav Binary file save-states/end-oak-conversation.sav has changed