# HG changeset patch # User Robert McIntyre # Date 1332819927 18000 # Node ID 0297d315b574ce06220b39266d1032354ac8ae7e # Parent 868783405ac297285c65d9c6e7ea39568f7324da script: made it to viridian mart diff -r 868783405ac2 -r 0297d315b574 clojure/com/aurellem/run/bootstrap_0.clj --- a/clojure/com/aurellem/run/bootstrap_0.clj Mon Mar 26 21:00:23 2012 -0500 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Mon Mar 26 22:45:27 2012 -0500 @@ -1,8 +1,8 @@ (ns com.aurellem.run.bootstrap-0 (:use (com.aurellem.gb gb-driver vbm characters)) (:use (com.aurellem.run title save-corruption)) - (:use (com.aurellem.exp item-bridge))) - + (:use (com.aurellem.exp item-bridge)) + (:import [com.aurellem.gb.gb_driver SaveState])) (defn-memo boot-root [] [ [] (root)]) @@ -240,3 +240,65 @@ ↑ ↑ ↑ ↑ ↑ ↑ → ↑])))) + +(defn move-thru-grass + [direction script] + (loop [blanks 0] + (let [new-script + (->> script + (play-moves (repeat blanks [])) + (move direction)) + + future-state + (run-moves (second new-script) + (repeat 600 [])) + + result (search-string (memory future-state) + "Wild")] + (if (nil? result) + new-script + (recur (inc blanks)))))) + +(defn walk-thru-grass + [directions script] + (reduce (fn [script direction] + (move-thru-grass direction script)) + script directions)) + +(defn-memo pallet-edge->viridian-mart + ([] (pallet-edge->viridian-mart + (oaks-lab->pallet-town-edge))) + ([script] + (->> script + ;; leave straight grass + (walk-thru-grass + [↑ ↑ ↑ ↑ ↑]) + + (walk [↑ ↑ ↑ ↑]) + + + (walk-thru-grass + [← ← ↑]) + (walk [↑ ↑ ↑ ↑ → → → ]) + + (walk-thru-grass + [→ ↑ ↑ ←]) + + (walk + [← ← + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ + → → → → ]) + + (walk-thru-grass + [→ → + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ]) + + (walk + [↑ ↑ + ← ← ← ← + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ + ← ← + ↑ ↑ ↑ ↑ + → → → → → → → → → → + ↑ ↑ ↑ ↑ ↑ ↑])))) +