Mercurial > vba-clojure
diff clojure/com/aurellem/run/bootstrap_0.clj @ 264:0297d315b574
script: made it to viridian mart
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 26 Mar 2012 22:45:27 -0500 |
parents | 868783405ac2 |
children | c85549460218 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Mon Mar 26 21:00:23 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Mon Mar 26 22:45:27 2012 -0500 1.3 @@ -1,8 +1,8 @@ 1.4 (ns com.aurellem.run.bootstrap-0 1.5 (:use (com.aurellem.gb gb-driver vbm characters)) 1.6 (:use (com.aurellem.run title save-corruption)) 1.7 - (:use (com.aurellem.exp item-bridge))) 1.8 - 1.9 + (:use (com.aurellem.exp item-bridge)) 1.10 + (:import [com.aurellem.gb.gb_driver SaveState])) 1.11 1.12 (defn-memo boot-root [] 1.13 [ [] (root)]) 1.14 @@ -240,3 +240,65 @@ 1.15 ↑ ↑ ↑ ↑ ↑ ↑ 1.16 → ↑])))) 1.17 1.18 + 1.19 +(defn move-thru-grass 1.20 + [direction script] 1.21 + (loop [blanks 0] 1.22 + (let [new-script 1.23 + (->> script 1.24 + (play-moves (repeat blanks [])) 1.25 + (move direction)) 1.26 + 1.27 + future-state 1.28 + (run-moves (second new-script) 1.29 + (repeat 600 [])) 1.30 + 1.31 + result (search-string (memory future-state) 1.32 + "Wild")] 1.33 + (if (nil? result) 1.34 + new-script 1.35 + (recur (inc blanks)))))) 1.36 + 1.37 +(defn walk-thru-grass 1.38 + [directions script] 1.39 + (reduce (fn [script direction] 1.40 + (move-thru-grass direction script)) 1.41 + script directions)) 1.42 + 1.43 +(defn-memo pallet-edge->viridian-mart 1.44 + ([] (pallet-edge->viridian-mart 1.45 + (oaks-lab->pallet-town-edge))) 1.46 + ([script] 1.47 + (->> script 1.48 + ;; leave straight grass 1.49 + (walk-thru-grass 1.50 + [↑ ↑ ↑ ↑ ↑]) 1.51 + 1.52 + (walk [↑ ↑ ↑ ↑]) 1.53 + 1.54 + 1.55 + (walk-thru-grass 1.56 + [← ← ↑]) 1.57 + (walk [↑ ↑ ↑ ↑ → → → ]) 1.58 + 1.59 + (walk-thru-grass 1.60 + [→ ↑ ↑ ←]) 1.61 + 1.62 + (walk 1.63 + [← ← 1.64 + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ 1.65 + → → → → ]) 1.66 + 1.67 + (walk-thru-grass 1.68 + [→ → 1.69 + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ]) 1.70 + 1.71 + (walk 1.72 + [↑ ↑ 1.73 + ← ← ← ← 1.74 + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ 1.75 + ← ← 1.76 + ↑ ↑ ↑ ↑ 1.77 + → → → → → → → → → → 1.78 + ↑ ↑ ↑ ↑ ↑ ↑])))) 1.79 +