Mercurial > vba-clojure
diff clojure/com/aurellem/run/bootstrap_0.clj @ 333:61a096a53330
fixed problem with rival's name.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 06 Apr 2012 14:41:28 -0500 |
parents | 5c2041d1cdda |
children | 57f4c57d2897 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Fri Apr 06 13:52:08 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Fri Apr 06 14:41:28 2012 -0500 1.3 @@ -28,38 +28,15 @@ 1.4 [] [] [:r] [] [:d] [:a] ;; L 1.5 [:r] [] [:r] [] [:r] [] [:r] [] 1.6 [:r] [] [:d] [] [:d] [:a] ;; [PK] 1.7 - [:u] [] [:l] [] [:l] [] [:l] [] 1.8 - [:l] [] [:l] [] [:a] ;; U 1.9 - [:r] [] [:r] [] [:r] [] [:r] [] 1.10 - [:r] [] [] [:d] [:a] ;; [PK] 1.11 + [:u] [] [:l] [] [:l] [] 1.12 + [:l] [] [:l] [] [:l] [:a] ;; U 1.13 + [:r] [] [:r] [] [:r] [] 1.14 + [:r] [] [:r] [] [:d] [:a] ;; [PK] 1.15 [] [:a] ;; [PK] 1.16 [] [:a] ;; [PK] 1.17 [:r] [] [:d] [:a] ;; END 1.18 ])))) 1.19 1.20 -;; (defn-memo name-rival-bootstrap 1.21 -;; ([] (name-rival-bootstrap (to-rival-name))) 1.22 -;; ([script] 1.23 -;; (->> script 1.24 -;; (first-difference [] [:a] AF) 1.25 -;; (first-difference [] [:r] DE) 1.26 -;; (play-moves 1.27 -;; [[] 1.28 -;; [] [] [:r] [] 1.29 -;; [:r] [] [:r] [] [:r] [] [:r] [] 1.30 -;; [:r] [] [:d] [] [:d] [] [:d] [:a];; PK 1.31 -;; [] [:a] ;; PK 1.32 -;; [:u] [] [:l] [] [:l] [] [:l] [] 1.33 -;; [:l] [] [:l] [:a] ;; U 1.34 -;; [:d] [] [:r] [] [:r] [] [:r] [] 1.35 -;; [:r] [] [:r] [:a] ;; PK 1.36 -;; [:u] [] [:l] [] [:l] [] [:l] [] 1.37 -;; [:l] [] [:l] [] [:u] [:a] ;; L 1.38 -;; [:d] [] [:r] [] [:r] [] [:r] [] 1.39 -;; [:r] [] [:r] [] [:d] [:a] ;; PK 1.40 -;; [:r] [] [:d] [:a] ;; END 1.41 -;; ])))) 1.42 - 1.43 (defn-memo leave-house 1.44 ([] (leave-house (name-rival-bootstrap))) 1.45 ([script] 1.46 @@ -293,9 +270,9 @@ 1.47 → → → ↓]) 1.48 1.49 (walk-thru-grass 1.50 - [↓ ↓ ↓ ↓]) 1.51 + [↓ ↓ ↓]) 1.52 1.53 - (walk [← ← ↓ ↓ ↓ ↓ ↓ ↓]) 1.54 + (walk [↓ ← ← ↓ ↓ ↓ ↓ ↓ ↓]) 1.55 1.56 (walk-thru-grass 1.57 [↓ ↓ ↓ ↓ ↓ ↓]) 1.58 @@ -375,6 +352,8 @@ 1.59 (aget mem list-cursor-offset-address)))) 1.60 ([] (list-offset @current-state))) 1.61 1.62 + 1.63 + 1.64 (defn exp-item-selection [] 1.65 (clojure.pprint/pprint 1.66 (apply memory-compare 1.67 @@ -488,16 +467,6 @@ 1.68 (defn close-menu [script] 1.69 (first-difference [] [:b] AF script)) 1.70 1.71 - 1.72 - 1.73 -;; (defn select-menu-entry* [script] 1.74 -;; (let [wait-time 1.75 -;; (- (dec (count (first (set-cursor-relative 1 script)))) 1.76 -;; (count (first script)))] 1.77 -;; (println "wait-time" wait-time) 1.78 -;; (play-moves (concat (repeat wait-time []) [[:a] []]) script))) 1.79 - 1.80 - 1.81 (defn purchase-item 1.82 "Assumes that the cursor is over the desired item, and purchases 1.83 quantity of that item." 1.84 @@ -514,8 +483,8 @@ 1.85 "Corrupt the num-of-items variable by switching a corrupted pokemon 1.86 into out-of-bounds memory." 1.87 ([] (corrupt-item-list 1.88 - ;;(corrupted-checkpoint) 1.89 - (do-save-corruption) 1.90 + (corrupted-checkpoint) 1.91 + ;;(do-save-corruption) 1.92 )) 1.93 ([script] 1.94 (->> script 1.95 @@ -530,7 +499,7 @@ 1.96 (set-cursor 9) 1.97 select-menu-entry ; switch 6th with 10th 1.98 close-menu 1.99 - close-menu ))) 1.100 + close-menu))) 1.101 1.102 (defn-memo get-lots-of-money 1.103 "Sell 0xFE cancel buttons to make a tremendous amount of money." 1.104 @@ -546,9 +515,7 @@ 1.105 (set-quantity 0xFF 0xF7) 1.106 (first-difference [] [:a] AF) 1.107 select-menu-entry 1.108 - close-menu 1.109 - ))) 1.110 - 1.111 + close-menu))) 1.112 1.113 (defn note [str script] 1.114 (println str) script) 1.115 @@ -604,29 +571,56 @@ 1.116 select-menu-entry ; do switch 1.117 close-menu 1.118 close-menu))) 1.119 - 1.120 -(defn-memo viridian-store->viridian-poke-center 1.121 - ([] (viridian-store->viridian-poke-center 1.122 - (corrupt-item-list-again))) 1.123 + 1.124 +(defn leave-viridian-store 1.125 + ([] (leave-viridian-store (corrupt-item-list-again))) 1.126 ([script] 1.127 (->> script 1.128 ;; leave store 1.129 - (walk [↓ ↓ 1.130 - → ↓ ↓]) 1.131 - (walk [← ← ← 1.132 - ↓ ↓ ↓ ↓ ↓ 1.133 - ← ← ← ↑])))) 1.134 + (walk [↓ ↓ → ↓]) 1.135 + (do-nothing 1)))) 1.136 + 1.137 +(defn force-encounter [direction script] 1.138 + (delayed-improbability-search 1.139 + 600 1.140 + #(search-string % "Wild") 1.141 + (partial move direction) script)) 1.142 + 1.143 +(defn-memo fight-wild-pokemon 1.144 + ([] (fight-wild-pokemon (leave-viridian-store))) 1.145 + ([script] 1.146 + (->> script 1.147 + (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 1.148 + ← ← ← ← ← ← ← ← 1.149 + ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓]) 1.150 + (force-encounter →)))) 1.151 + 1.152 +(defn-memo run-from-pokemon 1.153 + ([] (run-from-pokemon (fight-wild-pokemon))) 1.154 + ([script] 1.155 + (->> script 1.156 + (scroll-text) 1.157 + (wait-until select-menu-entry) 1.158 + (set-cursor 1) 1.159 + (first-difference [] → AF) 1.160 + (scroll-text) 1.161 + (scroll-text)))) 1.162 1.163 (defn-memo to-poke-center-computer 1.164 ([] (to-poke-center-computer 1.165 - (viridian-store->viridian-poke-center))) 1.166 + (run-from-pokemon))) 1.167 ([script] 1.168 (->> script 1.169 - (walk [→ → 1.170 + (walk-thru-grass [→ ↑]) 1.171 + (walk [↑ ← ← ← 1.172 + ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ 1.173 + ← ← 1.174 + ↑ ↑ ↑ ↑ 1.175 + → → → → ↑]) 1.176 + (walk [→ → 1.177 ↑ ↑ ↑ 1.178 - → → → → → → → → →]) 1.179 - (do-nothing 1)))) 1.180 - 1.181 + → → → → → → → → →])))) 1.182 + 1.183 (defn-memo begin-deposits 1.184 ([] (begin-deposits 1.185 (to-poke-center-computer))) 1.186 @@ -732,9 +726,9 @@ 1.187 1.188 [;; first part of item manipulation program 1.189 0x00 1.190 - 0x21 ;; load target + 1 into HL 1.191 + 0x21 ;; load target into HL 1.192 1.193 - 0x95 ;; this is the target address + 1 1.194 + 0x94 ;; this is the target address 1.195 0xD5 1.196 1.197 0x00 ;; relative jump back to first part