Mercurial > vba-clojure
diff clojure/com/aurellem/run/bootstrap_1.clj @ 368:08f8284e2f1b
cleaning up code
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 10 Apr 2012 03:32:47 -0500 |
parents | 845b2d88bef9 |
children | abcc522a3242 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj Mon Apr 09 13:21:34 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj Tue Apr 10 03:32:47 2012 -0500 1.3 @@ -108,7 +108,7 @@ 1.4 0x01 ;; (item-hack) will never reach this instruction 1.5 1.6 ] 1.7 - (repeat 8 [0x00 0x01]) 1.8 + (repeat 8 [0x00 0x02]);; these can be anything 1.9 1.10 [;; jump to actual program 1.11 0x00 1.12 @@ -206,6 +206,9 @@ 1.13 (repeat-until-different [] item-quantity-selected script) 1.14 script)) 1.15 1.16 +;; TODO use this: 1.17 +;;(wait-until (partial set-cursor-relative 1)) 1.18 + 1.19 (defn wait-for-cursor 1.20 [[moves state :as script]] 1.21 (if (not= (list-offset state) 0) 1.22 @@ -384,7 +387,7 @@ 1.23 [script] 1.24 (->> script 1.25 (delayed-difference [] [:a] 100 1.26 - #(aget (memory %) text-address)))) 1.27 + first-character))) 1.28 1.29 (defn-memo get-money-floor-two 1.30 ([] (get-money-floor-two (go-to-floor-two))) 1.31 @@ -646,13 +649,13 @@ 1.32 (widthdraw-pc-item 0 99) 1.33 (widthdraw-pc-item 0 1) 1.34 (widthdraw-pc-item 2 0xFE) 1.35 - (widthdraw-pc-item 3 0xFE)))) 1.36 + (widthdraw-pc-item 3 0xFE) 1.37 + close-menu))) 1.38 1.39 (defn-memo hacking-4 1.40 ([] (hacking-4 (hacking-3))) 1.41 ([script] 1.42 (->> script 1.43 - close-menu 1.44 begin-deposit 1.45 (deposit-held-item 19 243) 1.46 (deposit-held-item-named :lemonade 16) 1.47 @@ -696,6 +699,23 @@ 1.48 (deposit-held-item-named :burn-heal 12) 1.49 close-menu))) 1.50 1.51 +(defn switch-items [item-fn idx-1 idx-2 script] 1.52 + (->> script 1.53 + (wait-until select-menu-entry) 1.54 + (set-cursor idx-1) 1.55 + (wait-until select-menu-entry) 1.56 + (play-moves [[][:select][]]) 1.57 + (set-cursor idx-2) 1.58 + (delayed-difference [] [:select] 100 1.59 + #(item-fn % (list-offset %))))) 1.60 + 1.61 +(def switch-pc-items (partial switch-items nth-pc-item)) 1.62 +(def switch-held-items (partial switch-items nth-item)) 1.63 + 1.64 +(defn combine-pc-items [idx-1 script] 1.65 + (->> script 1.66 + (switch-pc-items idx-1 (inc idx-1)))) 1.67 + 1.68 (defn combine-items [idx-1 script] 1.69 (->> script 1.70 (wait-until select-menu-entry) 1.71 @@ -731,7 +751,7 @@ 1.72 (widthdraw-pc-item 9 0xFE) 1.73 (multiple-times 1.74 7 1.75 - (partial combine-items 2)) 1.76 + (partial combine-pc-items 2)) 1.77 close-menu))) 1.78 1.79 (defn-memo hacking-10 1.80 @@ -802,7 +822,7 @@ 1.81 select-menu-entry 1.82 (scroll-text)))) 1.83 1.84 -(defn hacking-13 1.85 +(defn-memo hacking-13 1.86 ([] (hacking-13 (hacking-12))) 1.87 ([script] 1.88 (->> script 1.89 @@ -810,14 +830,69 @@ 1.90 (select-menu-entry) 1.91 (toss-pc-item 1 1) 1.92 (toss-pc-item 0 156) 1.93 - (toss-pc-item 0 11) 1.94 + (toss-pc-item 0 11)))) 1.95 + 1.96 +(defn confirm-pattern [] 1.97 + (let [start-address (inc pc-item-list-start) 1.98 + target-pattern (pc-item-writer-program) 1.99 + actual-pattern 1.100 + (subvec (vec (memory (second (hacking-13)))) 1.101 + start-address 1.102 + (+ start-address (count target-pattern)))] 1.103 + (println target-pattern) 1.104 + (println actual-pattern) 1.105 + (= target-pattern actual-pattern))) 1.106 + 1.107 +;; this will be useful for starting program 1.108 + 1.109 + 1.110 +(defn-memo go-to-mansion-for-the-lulz 1.111 + ([] (go-to-mansion-for-the-lulz (hacking-13))) 1.112 + ([script] 1.113 + (->> script 1.114 + close-menu 1.115 + close-menu 1.116 + end-text ;;grr 1.117 + (walk [↓ ← ← ← ← ← ← ← ← ← ↓ ↓ ↓]) 1.118 + (walk (repeat 17 ←)) 1.119 + (walk [↑ → → → → ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑]) 1.120 + (walk [↓ ← ↑]) 1.121 + (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓ 1.122 + ← ← ← ← ↑ ↑ ↑ ← ↑]) 1.123 + (talk) 1.124 + (scroll-text 2) 1.125 close-menu))) 1.126 1.127 +(defn get-cursor [script] 1.128 + (wait-until (partial set-cursor-relative 1) script)) 1.129 + 1.130 +(defn-memo launch-bootstrap-program 1.131 + ([] (launch-bootstrap-program 1.132 + (go-to-mansion-for-the-lulz))) 1.133 + ([script] 1.134 + (->> script 1.135 + ;; must corrupt item list again by switching pokemon 1.136 + activate-start-menu 1.137 + ;;get-cursor 1.138 + (set-cursor 0) 1.139 + select-menu-entry 1.140 + ;;get-cursor 1.141 + (select-menu-entry) 1.142 + ;;get-cursor 1.143 + (set-cursor 1) 1.144 + (select-menu-entry) 1.145 + ;;get-cursor 1.146 + (set-cursor 3) 1.147 + (delayed-difference [] [:a] 50 first-character) 1.148 + close-menu 1.149 + ;; now, open items and set map-function 1.150 + ;;get-cursor 1.151 + (set-cursor 1) 1.152 + (select-menu-entry) 1.153 + (toss-held-item 22 12) 1.154 + (switch-held-items 22 40) 1.155 + close-all-menus))) 1.156 1.157 1.158 1.159 - 1.160 - 1.161 - 1.162 - 1.163 - 1.164 \ No newline at end of file 1.165 + 1.166 \ No newline at end of file