Mercurial > vba-clojure
view 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 source
1 (ns com.aurellem.run.bootstrap-12 (:use (com.aurellem.gb saves gb-driver util3 items vbm characters money))4 (:use (com.aurellem.run util title save-corruption bootstrap-0))5 (:use (com.aurellem.exp item-bridge))6 (:import [com.aurellem.gb.gb_driver SaveState]))8 (defn pc-item-writer-program9 []10 (let [limit 20111 [target-high target-low] (disect-bytes-2 0xD162)]12 (flatten13 [[0x00 ;; (item-hack) set increment stack pointer no-op14 0x1E ;; load limit into E15 limit16 0x3F ;; (item-hack) set carry flag no-op18 ;; load 2 into C.19 0x0E ;; C == 1 means input-first nybble20 0x04 ;; C == 0 means input-second nybble22 0x21 ;; load target into HL23 target-low24 target-high25 0x37 ;; (item-hack) set carry flag no-op27 0x00 ;; (item-hack) no-op28 0x37 ;; (item-hack) set carry flag no-op30 0x00 ;; (item-hack) no-op31 0xF3 ;; disable interrupts32 ;; Input Section34 0x3E ;; load 0x20 into A, to measure buttons35 0x1037 0x00 ;; (item-hack) no-op38 0xE0 ;; load A into [FF00]39 0x0041 0xF0 ;; load 0xFF00 into A to get42 0x00 ;; button presses44 0xE645 0x0F ;; select bottom four bits of A46 0x37 ;; (item-hack) set carry flag no-op48 0x00 ;; (item-hack) no-op49 0xB8 ;; see if input is different (CP A B)51 0x00 ;; (item-hack) (INC SP)52 0x28 ;; repeat above steps if input is not different53 ;; (jump relative backwards if B != A)54 0xED ;; (literal -19) (item-hack) -19 == egg bomb (TM37)56 0x47 ;; load A into B58 0x0D ;; dec C59 0x37 ;; (item-hack) set-carry flag60 ;; branch based on C:61 0x20 ;; JR NZ62 23 ;; skip "input second nybble" and "jump to target" below64 ;; input second nybble66 0x0C ;; inc C67 0x0C ;; inc C69 0x00 ;; (item-hack) no-op70 0xE6 ;; select bottom bits71 0x0F72 0x37 ;; (item-hack) set-carry flag no-op74 0x00 ;; (item-hack) no-op75 0xB2 ;; (OR A D) -> A77 0x22 ;; (do (A -> (HL)) (INC HL))79 0x1D ;; (DEC E)81 0x00 ;; (item-hack)82 0x20 ;; jump back to input section if not done83 0xDA ;; literal -36 == TM 18 (counter)84 0x01 ;; (item-hack) set BC to literal (no-op)86 ;; jump to target87 0x00 ;; (item-hack) these two bytes can be anything.88 0x0190 0x00 ;; (item-hack) no-op91 0xBF ;; (CP A A) ensures Z93 0xCA ;; (item-hack) jump if Z94 target-low95 target-high96 0x01 ;; (item-hack) will never be reached.98 ;; input first nybble99 0x00100 0xCB101 0x37 ;; swap nybbles on A103 0x57 ;; A -> D105 0x37 ;; (item-hack) set carry flag no-op106 0x18 ;; relative jump backwards107 0xCD ;; literal -51 == TM05; go back to input section108 0x01 ;; (item-hack) will never reach this instruction110 ]111 (repeat 8 [0x00 0x02]);; these can be anything113 [;; jump to actual program114 0x00115 0x37 ;; (item-hack) set carry flag no-op117 0x2E ;; 0x3A -> L118 0x3A121 0x00 ;; (item-hack) no-op122 0x26 ;; 0xD5 -> L123 0xD5124 0x01 ;; (item-hack) set-carry BC126 0x00 ;; (item-hack) these can be anything127 0x01129 0x00130 0xE9 ;; jump to (HL)131 ]])))133 (defn print-desired-item-layout []134 (clojure.pprint/pprint135 (raw-inventory->inventory (pc-item-writer-program))))137 (defn pc-item-writer-state []138 (-> (read-state "bootstrap-init")139 (set-memory pc-item-list-start 50)140 (set-memory-range141 map-function-address-start142 [0x8B 0xD5])143 (set-memory-range144 (inc pc-item-list-start)145 (pc-item-writer-program))))147 (defn test-pc-item-writer []148 (let [orig (read-state "pc-item-writer")]149 (-> orig150 (print-listing 0xD162 (+ 0xD162 20))151 (run-moves (reduce concat152 (repeat 10 [[:a :b :start :select] []])))153 ((fn [_] (println "===========") _))154 (print-listing 0xD162 (+ 0xD162 20)))))156 (defn close-all-menus [[moves state :as script]]157 (loop [s script]158 (let [depth (current-depth (second (do-nothing 50 s)))]159 (println "depth" depth)160 (if (= depth 1)161 s162 (recur (close-menu s))))))164 (defn-memo name-rival165 ([] (name-rival (to-rival-name)))166 ([script]167 (->> script168 (first-difference [] [:a] AF)169 (first-difference [] [:r] DE)170 (play-moves171 [[]172 [] [] [:r] [] [:d] [:a] ;; L173 [:r] [] [:r] [] [:r] [] [:r] []174 [:r] [] [:d] [] [:d] [:a] ;; [PK]175 [:d] [] [:r] [:a]176 ]))))178 (defn-memo to-room-pc179 ([] (to-room-pc (name-rival)))180 ([script]181 (->> script182 finish-title183 (walk [← ← ↑ ← ↑ ↑ ↑]))))185 (defn-memo bootstrap-corrupt-save186 ([] (bootstrap-corrupt-save (to-room-pc)))187 ([script]188 (->> script189 (do-save-corruption 2)190 (corrupt-item-list 0)191 close-all-menus)))193 (defn-memo begin-initial-deposits194 ([] (begin-initial-deposits195 (bootstrap-corrupt-save)))196 ([script]197 (->> script198 (first-difference [] [:a] AF)199 (scroll-text)200 (set-cursor 1)201 select-menu-entry)))203 (defn wait-for-quantity204 [[moves state :as script]]205 (if (not= (item-quantity-selected state) 1)206 (repeat-until-different [] item-quantity-selected script)207 script))209 ;; TODO use this:210 ;;(wait-until (partial set-cursor-relative 1))212 (defn wait-for-cursor213 [[moves state :as script]]214 (if (not= (list-offset state) 0)215 (repeat-until-different [] list-offset script)216 script))218 (defn deposit-held-item [n quantity [moves state :as script]]219 (let [total-quantity (second (nth-item state n))]220 (println "total-quantity" total-quantity)221 (->> script222 (set-cursor n)223 (select-menu-entry 1)224 (wait-for-quantity)225 (set-quantity total-quantity quantity)226 (delayed-difference [] [:a] 100 #(search-string % "stored"))227 (scroll-text))))229 (defn sell-held-item [n quantity [moves state :as script]]230 (let [total-quantity (second (nth-item state n))]231 (->> script232 (wait-for-cursor) ;; when selling, the cursor always233 (set-cursor n) ;; returns to the top of the list.234 (select-menu-entry 1)235 (wait-for-quantity)236 (set-quantity total-quantity quantity)237 (delayed-difference [] [:a] 100 current-depth)238 (play-moves (repeat 20 [:b]))239 (delayed-difference [] [:a] 100 #(search-string % "What"))240 )))242 (defn widthdraw-pc-item [n quantity [moves state :as script]]243 (let [total-quantity (second (nth-pc-item state n))]244 (->> script245 (set-cursor n)246 (select-menu-entry 1)247 (wait-for-quantity)248 (set-quantity total-quantity quantity)249 (delayed-difference [] [:a] 100 #(search-string % "Withdrew"))250 (scroll-text))))252 (defn toss-held-item [n quantity [moves state :as script]]253 (let [total-quantity (second (nth-item state n))]254 (->> script255 (set-cursor n)256 (select-menu-entry 1)257 (set-cursor-relative 1)258 (select-menu-entry -1)259 (wait-for-quantity)260 (set-quantity total-quantity quantity)261 (play-moves [[:a]])262 (scroll-text)263 (delayed-difference [] [:a] 100 #(search-string % "Threw"))264 (scroll-text)265 )))267 (defn buy-item [n quantity [moves state :as script]]268 (->> script269 (set-cursor n)270 (purchase-item quantity)))273 (def desired-zero-quantities274 (map second (filter (comp (partial = 0) first)275 (partition 2 (pc-item-writer-program)))))277 (defn-memo initial-deposits278 ([] (initial-deposits (begin-initial-deposits)))279 ([script]280 (->> script281 (deposit-held-item 0 0x1)282 ((fn [script]283 (reduce284 (fn [script item] (deposit-held-item item 0xFF script))285 script286 (range 3 (+ 13 3)))))287 close-all-menus)))290 (defn-memo prepare-celadon-warp291 ([] (prepare-celadon-warp (initial-deposits)))292 ([script]293 (->> script294 (activate-start-menu)295 (set-cursor-relative 1)296 (select-menu-entry)297 (toss-held-item 35 0xFA)298 (close-all-menus))))301 ;;0 -- 256302 ;;1 -- 254303 ;;2 -- 254304 ;;3 -- 255306 (defn-memo restore-items307 ([] (restore-items (prepare-celadon-warp)))308 ([script]309 (->> script310 (first-difference [] [:a] AF)311 (scroll-text)312 (select-menu-entry)313 (widthdraw-pc-item 0 1)314 ;;(widthdraw-pc-item 0 99)315 ;;(widthdraw-pc-item 1 1)316 (widthdraw-pc-item 13 255)317 (close-all-menus))))319 (defn-memo to-celadon320 ([] (to-celadon (restore-items)))321 ([script]322 (->> script323 (walk [→ → → → → → → ↑324 ↓ ↓ ↓ ↓ ↓ ← ← ← ←325 ↓ ↓]))))328 ;; celadon store inventory330 ;; Floor 2331 ;;=====================================332 ;; Great Ball TM32 (double-team)333 ;; Super Potion TM33 (reflect)334 ;; Revive TM02 (razor-wind)335 ;; Super Repel TM07 (horn-drill)336 ;; Antidote TM37 (egg-bomb)337 ;; Burn Heal TM01 (mega-punch)338 ;; Ice Heal TM05 (mega-kick)339 ;; Awakening TM09 (take-down)340 ;; Parlyz Heal TM17 (submission)343 ;; Floor 3344 ;;=====================================345 ;; TM18 (counter)348 ;; Floor 4349 ;;=====================================350 ;; Poke Doll351 ;; Fire Stone352 ;; Thunder Stone353 ;; Water Stone354 ;; Leaf Stone356 ;; Floor 5357 ;;=====================================358 ;; X Accuracy HP UP359 ;; Guard Spec. Protein360 ;; Dire Hit Iron361 ;; X Attack Carbos362 ;; X Defend Calcium363 ;; X Speed364 ;; X Special366 ;; Roof367 ;;=====================================368 ;; Fresh Water TM13 (ice-beam)369 ;; Soda Pop TM48 (rock-slide)370 ;; Lemonade :) TM49 (tri-attack)373 (defn-memo go-to-floor-two374 ([] (go-to-floor-two (to-celadon)))375 ([script]376 (->> script377 (walk [↑ → → → → → → → → → → →378 ↑ ↑ ↑ ↑ ↑ ↑379 ← ← ← ←380 ↓ ↓ ↓381 ← ←])382 (first-difference [] ↑ AF))))384 (defn talk385 "Assumes that you are facing something that initiates text and386 causes it to do so."387 [script]388 (->> script389 (delayed-difference [] [:a] 100390 first-character)))392 (defn-memo get-money-floor-two393 ([] (get-money-floor-two (go-to-floor-two)))394 ([script]395 (->> script396 talk397 (set-cursor 1)398 (select-menu-entry)399 (sell-held-item 0 1)400 (sell-held-item 0 1)401 (close-menu))))403 (defn-memo floor-two-TMs404 ([] (floor-two-TMs (get-money-floor-two)))405 ([script]406 (->> script407 (wait-for-cursor)408 (select-menu-entry)409 (buy-item 2 98) ;; TM02 (razor-wind)410 (buy-item 4 71) ;; TM37 (doubleteam)411 (buy-item 5 63) ;; TM01 (mega-punch)412 (buy-item 6 1) ;; TM05 (mega-kick)413 (buy-item 7 56) ;; TM09 (take-down)414 (close-menu))))416 (defn end-shop-conversation417 [script]418 (->> script419 (wait-until scroll-text [:b])420 (play-moves [[] [:b]])421 close-menu))423 (defn-memo floor-two-more-money424 ([] (floor-two-more-money (floor-two-TMs)))425 ([script]426 (->> script427 (wait-for-cursor)428 (set-cursor 1)429 (select-menu-entry)430 (sell-held-item 0 1)431 (sell-held-item 0 1)432 close-menu433 end-shop-conversation)))435 (defn turn [direction script]436 (->> script437 (first-difference [] direction AF)))439 (defn-memo floor-two-items440 ([] (floor-two-items (floor-two-more-money)))441 ([script]442 (->> script443 (walk [←])444 (turn ↑)445 talk446 select-menu-entry447 (buy-item 5 12) ;; burn heal448 (buy-item 6 55) ;; ice heal449 (buy-item 7 4) ;; awakening450 (buy-item 8 99) ;; parlyz heal451 (buy-item 8 55) ;; parlyz heal452 close-menu453 end-shop-conversation)))455 (defn-memo go-to-floor-three456 ([] (go-to-floor-three (floor-two-items)))457 ([script]458 (->> script459 (walk [→ → → → → → → → → → ↑ ↑ ↑460 → ↑]))))461 (defn-memo get-TM18462 ([] (get-TM18 (go-to-floor-three)))463 ([script]464 (->> script465 (walk [↓ ↓])466 talk467 (scroll-text 3)468 end-text)))470 (defn-memo go-to-floor-four471 ([] (go-to-floor-four (get-TM18)))472 ([script]473 (->> script474 (walk [← ← ← ← ↑ ↑475 ↓ ← ← ↓ ↓ ↓476 ← ← ← ← ←])477 (turn ↓))))479 (defn-memo floor-four-items480 ([] (floor-four-items (go-to-floor-four)))481 ([script]482 (->> script483 talk484 select-menu-entry485 (buy-item 1 23) ;; Fire Stone486 (buy-item 2 98) ;; Thunder Stone487 (buy-item 3 29) ;; Water Stone488 close-menu489 end-shop-conversation)))491 (defn-memo go-to-floor-five492 ([] (go-to-floor-five (floor-four-items)))493 ([script]494 (->> script495 (walk [→ → → → → →496 ↑ ↑ ↑497 → → → → → ↑ ;; leave floor four498 ↓ ← ← ← ← ← ← ← ←499 ↓ ↓ ↓ ← ← ← ]);; go to five's clerk500 (turn ↑))))502 (defn-memo floor-five-items503 ([] (floor-five-items (go-to-floor-five)))504 ([script]505 (->> script506 talk507 select-menu-entry508 (buy-item 0 58) ;; X-Accuracy509 (buy-item 1 99) ;; Guard Spec.510 (buy-item 1 24) ;; Guard Spec.511 close-menu512 end-shop-conversation)))514 (defn-memo go-to-roof515 ([] (go-to-roof (floor-five-items)))516 ([script]517 (->> script518 (walk [→ → → → ↑ ↑ ↑ → → → ↑ ;; leave floor five519 ↓ ← ← ←]) ;; walk to vending machine520 (turn ↑))))522 (defn buy-drink523 "Assumes you're in front of the vending machine. Buys the indicated524 drink."525 [n script]526 (->> script527 (do-nothing 20)528 (play-moves [[:a][:a]])529 scroll-text530 (wait-for-cursor)531 (set-cursor n)532 select-menu-entry533 close-menu))535 (defn-memo roof-drinks536 ([] (roof-drinks (go-to-roof)))537 ([script]538 (->> script539 (buy-drink 0) ;; fresh water (for TM13)540 ;; buy 16 lemonades541 ;; LEMONADE is the best item <3 :)542 (multiple-times 16 (partial buy-drink 2)))))544 (defn-memo get-TM13545 ([] (get-TM13 (roof-drinks)))546 ([script]547 (->> script548 (walk [← ← ← ← ← ← ↓])549 (play-moves [[][:a][:a][]])550 (scroll-text 3)551 select-menu-entry552 select-menu-entry553 (scroll-text 6)554 close-menu)))556 (defn-memo to-celadon-poke-center557 ([] (to-celadon-poke-center (get-TM13)))558 ([script]559 (->> script560 (walk [↑ → → → → → → → → → ↑]) ; leave roof561 (walk [↓ ← ← ← ← ↓ ↓ ↓ ← ← ← ← ←562 ↑ ↑ ↑ ← ← ↑]) ; to elevator564 (walk [→ → ↑ ↑]) ; to controls565 talk566 select-menu-entry ; to floor 1567 (walk [↓ ↓ ← ←])568 (walk [↓ → ↓ ↓ ↓ ↓ ↓ ↓]) ; leave store569 (walk [↓ → → → → → → → → → → ↑ ↑])570 (walk (repeat 23 →))571 (walk [↑ ↑ ↑ ↑]) ; enter poke center572 (walk [↑ ↑ ↑ → → → → → → → → → →]) ; to computer573 (turn ↑))))575 (defn activate-rlm-pc [script]576 (->> script577 talk578 scroll-text579 wait-for-cursor580 (set-cursor 1)581 select-menu-entry582 (scroll-text 2)))584 (defn begin-deposit [script]585 (->> script586 (set-cursor 1)587 select-menu-entry))589 (defn begin-withdraw [script]590 (->> script591 (set-cursor 0)592 (select-menu-entry)))594 (defn deposit-held-item-named595 [item-name quantity [moves state :as script]]596 (let [index (count597 (take-while598 (fn [[name quant]]599 (or (not= name item-name)600 (< quant quantity)))601 (inventory state)))]602 (println "index" index)603 (deposit-held-item index quantity script)))606 (defn-memo begin-hacking607 ([] (begin-hacking(to-celadon-poke-center)))608 ([script]609 (->> script610 activate-rlm-pc611 begin-deposit612 (deposit-held-item-named 0x00 30)613 (deposit-held-item-named :TM01 63)614 (deposit-held-item-named :awakening 4)615 (deposit-held-item-named :thunderstone 98)616 (deposit-held-item-named :TM09 55)617 (deposit-held-item-named 0x00 55))))619 (defn open-held-items620 [script]621 (->> script622 select-menu-entry))624 (defn to-held-items625 [script]626 (->> script627 close-menu628 close-menu629 end-text;;; grr631 activate-start-menu632 open-held-items))634 (defn-memo hacking-2635 ([] (hacking-2 (begin-hacking)))636 ([script]637 (->> script638 (to-held-items)639 (toss-held-item 0 166) ;; discard cruft640 close-menu641 close-menu)))643 (defn-memo hacking-3644 ([] (hacking-3 (hacking-2)))645 ([script]646 (->> script647 activate-rlm-pc648 begin-withdraw649 (widthdraw-pc-item 0 99)650 (widthdraw-pc-item 0 1)651 (widthdraw-pc-item 2 0xFE)652 (widthdraw-pc-item 3 0xFE)653 close-menu)))655 (defn-memo hacking-4656 ([] (hacking-4 (hacking-3)))657 ([script]658 (->> script659 begin-deposit660 (deposit-held-item 19 243)661 (deposit-held-item-named :lemonade 16)662 (deposit-held-item 18 224))))664 (defn-memo hacking-5665 "clean out the held-item list again"666 ([] (hacking-5 (hacking-4)))667 ([script]668 (->> script669 (to-held-items)670 (toss-held-item 18 30)671 (toss-held-item 17 1)672 close-menu673 close-menu)))675 (defn-memo hacking-6676 ([] (hacking-6 (hacking-5)))677 ([script]678 (->> script679 activate-rlm-pc680 begin-withdraw681 (widthdraw-pc-item 4 0xFE)682 (widthdraw-pc-item 5 0xFE)683 (widthdraw-pc-item 6 0xFE)684 close-menu)))686 (defn-memo hacking-7687 ([] (hacking-7 (hacking-6)))688 ([script]689 (->> script690 begin-deposit691 (deposit-held-item 19 240)692 (deposit-held-item 18 230)693 (deposit-held-item-named :parlyz-heal 55)694 (deposit-held-item 17 184)695 (deposit-held-item 17 40)696 (deposit-held-item-named :TM37 71)697 (deposit-held-item-named :ice-heal 55)698 (deposit-held-item-named :fire-stone 23)699 (deposit-held-item-named :burn-heal 12)700 close-menu)))702 (defn switch-items [item-fn idx-1 idx-2 script]703 (->> script704 (wait-until select-menu-entry)705 (set-cursor idx-1)706 (wait-until select-menu-entry)707 (play-moves [[][:select][]])708 (set-cursor idx-2)709 (delayed-difference [] [:select] 100710 #(item-fn % (list-offset %)))))712 (def switch-pc-items (partial switch-items nth-pc-item))713 (def switch-held-items (partial switch-items nth-item))715 (defn combine-pc-items [idx-1 script]716 (->> script717 (switch-pc-items idx-1 (inc idx-1))))719 (defn combine-items [idx-1 script]720 (->> script721 (wait-until select-menu-entry)722 (set-cursor idx-1)723 (wait-until select-menu-entry)724 (play-moves [[][:select][]])725 (set-cursor-relative 1)726 (delayed-difference [] [:select] 100727 #(nth-pc-item % (list-offset %)))))729 (defn-memo hacking-8730 "Clear cruft away from held item list."731 ([] (hacking-8 (hacking-7)))732 ([script]733 (->> script734 to-held-items735 (toss-held-item 15 1)736 (toss-held-item 14 1)737 (toss-held-item 13 1)738 close-menu739 close-menu)))741 (defn-memo hacking-9742 ([] (hacking-9 (hacking-8)))743 ([script]744 (->> script745 activate-rlm-pc746 begin-withdraw747 (widthdraw-pc-item 7 0xFE)748 (widthdraw-pc-item 8 0xFC)749 (widthdraw-pc-item 8 1)750 (widthdraw-pc-item 8 1)751 (widthdraw-pc-item 9 0xFE)752 (multiple-times753 7754 (partial combine-pc-items 2))755 close-menu)))757 (defn-memo hacking-10758 ([] (hacking-10 (hacking-9)))759 ([script]760 (->> script761 begin-deposit762 (deposit-held-item 17 230)763 (deposit-held-item-named :parlyz-heal 55)764 (deposit-held-item 14 178)765 (deposit-held-item-named :water-stone 29)766 (deposit-held-item 14 32)767 (deposit-held-item-named :TM18 1)768 (deposit-held-item 13 1)769 (deposit-held-item 13 191)770 (deposit-held-item-named :TM02 98)771 (deposit-held-item-named :TM09 1)772 close-menu773 close-menu)))775 (defn-memo hacking-11776 ([] (hacking-11 (hacking-10)))777 ([script]778 (->> script779 begin-withdraw780 (widthdraw-pc-item 3 0xFE)781 (widthdraw-pc-item 4 0xFE)782 (widthdraw-pc-item 5 1)783 (widthdraw-pc-item 5 1)784 (widthdraw-pc-item 5 1)785 (widthdraw-pc-item 5 0xFB)786 (multiple-times787 3788 (partial combine-items 2))789 close-menu)))791 (defn-memo hacking-12792 ([] (hacking-12 (hacking-11)))793 ([script]794 (->> script795 begin-deposit796 (deposit-held-item 18 203)797 (deposit-held-item-named :guard-spec 87)798 (deposit-held-item-named :guard-spec 24)799 (deposit-held-item-named :TM05 1)800 (multiple-times801 8802 (partial deposit-held-item 14 2))803 (deposit-held-item 14 55)804 (deposit-held-item-named :x-accuracy 58)805 (deposit-held-item 14 38)806 (deposit-held-item-named :TM13 1)807 (deposit-held-item 13 1)808 (deposit-held-item 13 233)809 close-menu810 close-menu)))813 (defn toss-pc-item [n quantity [moves state :as script]]814 (let [total-quantity (second (nth-pc-item state n))]815 (->> script816 (set-cursor n)817 (select-menu-entry 1)818 (wait-for-quantity)819 (set-quantity total-quantity quantity)820 (delayed-difference [] [:a] 100 #(search-string % "Is"))821 (scroll-text)822 select-menu-entry823 (scroll-text))))825 (defn-memo hacking-13826 ([] (hacking-13 (hacking-12)))827 ([script]828 (->> script829 (set-cursor-relative 1)830 (select-menu-entry)831 (toss-pc-item 1 1)832 (toss-pc-item 0 156)833 (toss-pc-item 0 11))))835 (defn confirm-pattern []836 (let [start-address (inc pc-item-list-start)837 target-pattern (pc-item-writer-program)838 actual-pattern839 (subvec (vec (memory (second (hacking-13))))840 start-address841 (+ start-address (count target-pattern)))]842 (println target-pattern)843 (println actual-pattern)844 (= target-pattern actual-pattern)))846 ;; this will be useful for starting program849 (defn-memo go-to-mansion-for-the-lulz850 ([] (go-to-mansion-for-the-lulz (hacking-13)))851 ([script]852 (->> script853 close-menu854 close-menu855 end-text ;;grr856 (walk [↓ ← ← ← ← ← ← ← ← ← ↓ ↓ ↓])857 (walk (repeat 17 ←))858 (walk [↑ → → → → ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑])859 (walk [↓ ← ↑])860 (walk [↓ ↓ ↓ ↓ ↓ ↓ ↓861 ← ← ← ← ↑ ↑ ↑ ← ↑])862 (talk)863 (scroll-text 2)864 close-menu)))866 (defn get-cursor [script]867 (wait-until (partial set-cursor-relative 1) script))869 (defn-memo launch-bootstrap-program870 ([] (launch-bootstrap-program871 (go-to-mansion-for-the-lulz)))872 ([script]873 (->> script874 ;; must corrupt item list again by switching pokemon875 activate-start-menu876 ;;get-cursor877 (set-cursor 0)878 select-menu-entry879 ;;get-cursor880 (select-menu-entry)881 ;;get-cursor882 (set-cursor 1)883 (select-menu-entry)884 ;;get-cursor885 (set-cursor 3)886 (delayed-difference [] [:a] 50 first-character)887 close-menu888 ;; now, open items and set map-function889 ;;get-cursor890 (set-cursor 1)891 (select-menu-entry)892 (toss-held-item 22 12)893 (switch-held-items 22 40)894 close-all-menus)))