comparison clojure/com/aurellem/run/bootstrap_1.clj @ 359:8c474d1d6956

script: got leomnades and TM13, shopping is complete.
author Robert McIntyre <rlm@mit.edu>
date Mon, 09 Apr 2012 08:27:45 -0500
parents 016c2bcca08f
children 51aa6486c2ab
comparison
equal deleted inserted replaced
358:016c2bcca08f 359:8c474d1d6956
491 (->> script 491 (->> script
492 (walk [→ → → → → → 492 (walk [→ → → → → →
493 ↑ ↑ ↑ 493 ↑ ↑ ↑
494 → → → → → ↑ ;; leave floor four 494 → → → → → ↑ ;; leave floor four
495 ↓ ← ← ← ← ← ← ← ← 495 ↓ ← ← ← ← ← ← ← ←
496 ↓ ↓ ↓ ← ← ← ;; go to five's clerk 496 ↓ ↓ ↓ ← ← ← ]);; go to five's clerk
497 ])
498 (turn ↑)))) 497 (turn ↑))))
499 498
500 (defn-memo floor-five-items 499 (defn-memo floor-five-items
501 ([] (floor-five-items (go-to-floor-five))) 500 ([] (floor-five-items (go-to-floor-five)))
502 ([script] 501 ([script]
507 (buy-item 1 99) ;; Guard Spec. 506 (buy-item 1 99) ;; Guard Spec.
508 (buy-item 1 24) ;; Guard Spec. 507 (buy-item 1 24) ;; Guard Spec.
509 close-menu 508 close-menu
510 end-shop-conversation))) 509 end-shop-conversation)))
511 510
512 (defn go-to-roof 511 (defn-memo go-to-roof
513 []) 512 ([] (go-to-roof (floor-five-items)))
514 513 ([script]
515 (defn roof-drinks 514 (->> script
516 []) 515 (walk [→ → → → ↑ ↑ ↑ → → → ↑ ;; leave floor five
517 516 ↓ ← ← ←]) ;; walk to vending machine
517 (turn ↑))))
518
519 (defn dp
520 [str script]
521 (println str) script)
522
523 (defn buy-drink
524 "Assumes you're in front of the vending machine. Buys the indicated
525 drink."
526 [n script]
527 (->> script
528 (dp "talk")
529 talk
530 (dp "scroll-text")
531 (scroll-text)
532 (wait-for-cursor)
533 (set-cursor n)
534 select-menu-entry
535 close-menu))
536
537 (defn-memo roof-drinks
538 ([] (roof-drinks (go-to-roof)))
539 ([script]
540 (->> script
541 (buy-drink 0) ;; fresh water (for TM13)
542
543 ;; buy 16 lemonades
544 ;; LEMONADE is the best item <3 :)
545 (multiple-times 5 (partial buy-drink 2))
546 (do-nothing 1) ;; unknown hiccup here :(
547 (multiple-times 11 (partial buy-drink 2)))))
548
518 (defn get-TM13 549 (defn get-TM13
519 []) 550 ([] (get-TM13 (roof-drinks)))
551 ([script]
552 (->> script
553 (walk [↓ ↓ ↓
554 ← ← ← ← ← ←
555 ])
556 (do-nothing 1) ;; wtf is wrong with talk?
557 talk
558 (scroll-text 2)
559 select-menu-entry
560 select-menu-entry
561
562 (scroll-text 6)
563 close-menu)))
564
520 565
521