comparison clojure/com/aurellem/run/bootstrap_1.clj @ 363:79252378fd22

saving progress...]
author Robert McIntyre <rlm@mit.edu>
date Mon, 09 Apr 2012 10:35:22 -0500
parents 8d8023057b3c
children 958a333f16e2
comparison
equal deleted inserted replaced
362:8d8023057b3c 363:79252378fd22
548 select-menu-entry 548 select-menu-entry
549 select-menu-entry 549 select-menu-entry
550 (scroll-text 6) 550 (scroll-text 6)
551 close-menu))) 551 close-menu)))
552 552
553 (defn to-celadon-poke-center 553 (defn-memo to-celadon-poke-center
554 ([] (to-celadon-poke-center (get-TM13))) 554 ([] (to-celadon-poke-center (get-TM13)))
555 ([script] 555 ([script]
556 (->> script 556 (->> script
557 (walk [↑ → → → → → → → → → ↑]) ; leave roof 557 (walk [↑ → → → → → → → → → ↑]) ; leave roof
558 (walk [↓ ← ← ← ← ↓ ↓ ↓ ← ← ← ← ← 558 (walk [↓ ← ← ← ← ↓ ↓ ↓ ← ← ← ← ←
566 (walk [↓ → → → → → → → → → → ↑ ↑]) 566 (walk [↓ → → → → → → → → → → ↑ ↑])
567 (walk (repeat 23 →)) 567 (walk (repeat 23 →))
568 (walk [↑ ↑ ↑ ↑]) ; enter poke center 568 (walk [↑ ↑ ↑ ↑]) ; enter poke center
569 (walk [↑ ↑ ↑ → → → → → → → → → →]) ; to computer 569 (walk [↑ ↑ ↑ → → → → → → → → → →]) ; to computer
570 (turn ↑)))) 570 (turn ↑))))
571
572 (defn activate-rlm-pc [script]
573 (->> script
574 talk
575 scroll-text
576 wait-for-cursor
577 (set-cursor 1)
578 select-menu-entry
579 (scroll-text 2)))
580
581 (defn begin-deposit [script]
582 (->> script
583 (set-cursor 1)
584 select-menu-entry))
585
586 (defn begin-withdraw [script]
587 (->> script
588 (set-cursor 0)
589 (select-menu-entry)))
590
591 (defn deposit-held-item-named
592 [item-name quantity [moves state :as script]]
593 (let [index (count
594 (take-while
595 (fn [[name quant]]
596 (or (not= name item-name)
597 (< quant quantity)))
598 (inventory state)))]
599 (println "index" index)
600 (deposit-held-item index quantity script)))
601
602
603 (defn-memo begin-hacking
604 ([] (begin-hacking(to-celadon-poke-center)))
605 ([script]
606 (->> script
607 activate-rlm-pc
608 begin-deposit
609 (deposit-held-item-named 0x00 30)
610 (deposit-held-item-named :TM01 63)
611 (deposit-held-item-named :awakening 4)
612 (deposit-held-item-named :thunderstone 98)
613 (deposit-held-item-named :TM09 55)
614 (deposit-held-item-named 0x00 55))))
615
616 (defn open-held-items
617 [script]
618 (->> script
619 select-menu-entry))
620
621 (defn-memo hacking-2
622 ([] (hacking-2 (begin-hacking)))
623 ([script]
624 (->> script
625 close-menu
626 close-menu
627 end-text;;; grr
628
629 activate-start-menu
630 open-held-items
631 (toss-held-item 0 166) ;; discard cruft
632 close-menu
633 close-menu)))
634
635 (defn-memo hacking-3
636 ([] (hacking-3 (hacking-2)))
637 ([script]
638 (->> script
639 activate-rlm-pc
640 begin-withdraw
641 (widthdraw-pc-item 0 99)
642 (widthdraw-pc-item 0 1)
643 (widthdraw-pc-item 2 0xFE)
644 (widthdraw-pc-item 3 0xFE))))
645
646
647