comparison clojure/com/aurellem/run/bootstrap_1.clj @ 361:64d09d021025

route repaired.
author Robert McIntyre <rlm@mit.edu>
date Mon, 09 Apr 2012 09:10:45 -0500
parents 51aa6486c2ab
children 8d8023057b3c
comparison
equal deleted inserted replaced
360:51aa6486c2ab 361:64d09d021025
451 451
452 (defn-memo go-to-floor-three 452 (defn-memo go-to-floor-three
453 ([] (go-to-floor-three (floor-two-items))) 453 ([] (go-to-floor-three (floor-two-items)))
454 ([script] 454 ([script]
455 (->> script 455 (->> script
456 (walk [→ → → → ↑ ↑ ↑ 456 (walk [→ → → → → → → → → → ↑ ↑ ↑
457 → → → → → → → ↑])))) 457 → ↑]))))
458 (defn-memo get-TM18 458 (defn-memo get-TM18
459 ([] (get-TM18 (go-to-floor-three))) 459 ([] (get-TM18 (go-to-floor-three)))
460 ([script] 460 ([script]
461 (->> script 461 (->> script
462 (walk [↓ ↓]) 462 (walk [↓ ↓])
514 (->> script 514 (->> script
515 (walk [→ → → → ↑ ↑ ↑ → → → ↑ ;; leave floor five 515 (walk [→ → → → ↑ ↑ ↑ → → → ↑ ;; leave floor five
516 ↓ ← ← ←]) ;; walk to vending machine 516 ↓ ← ← ←]) ;; walk to vending machine
517 (turn ↑)))) 517 (turn ↑))))
518 518
519 (defn dp
520 [str script]
521 (println str) script)
522
523 (defn buy-drink 519 (defn buy-drink
524 "Assumes you're in front of the vending machine. Buys the indicated 520 "Assumes you're in front of the vending machine. Buys the indicated
525 drink." 521 drink."
526 [n script] 522 [n script]
527 (->> script 523 (->> script
528 (dp "talk") 524 (do-nothing 20)
529 talk 525 (play-moves [[:a][:a]])
530 (dp "scroll-text") 526 scroll-text
531 (scroll-text)
532 (wait-for-cursor) 527 (wait-for-cursor)
533 (set-cursor n) 528 (set-cursor n)
534 select-menu-entry 529 select-menu-entry
535 close-menu)) 530 close-menu))
536 531
537 (defn-memo roof-drinks 532 (defn-memo roof-drinks
538 ([] (roof-drinks (go-to-roof))) 533 ([] (roof-drinks (go-to-roof)))
539 ([script] 534 ([script]
540 (->> script 535 (->> script
541 (buy-drink 0) ;; fresh water (for TM13) 536 (buy-drink 0) ;; fresh water (for TM13)
542
543 ;; buy 16 lemonades 537 ;; buy 16 lemonades
544 ;; LEMONADE is the best item <3 :) 538 ;; LEMONADE is the best item <3 :)
545 (multiple-times 5 (partial buy-drink 2)) 539 (multiple-times 16 (partial buy-drink 2)))))
546 (do-nothing 1) ;; unknown hiccup here :( 540
547 (multiple-times 11 (partial buy-drink 2)))))
548
549 (defn get-TM13 541 (defn get-TM13
550 ([] (get-TM13 (roof-drinks))) 542 ([] (get-TM13 (roof-drinks)))
551 ([script] 543 ([script]
552 (->> script 544 (->> script
553 (walk [↓ ↓ ↓ 545 (walk [← ← ← ← ← ← ↓])
554 ← ← ← ← ← ← 546 (play-moves [[][:a][:a][]])
555 ]) 547 (scroll-text 3)
556 (do-nothing 1) ;; wtf is wrong with talk?
557 talk
558 (scroll-text 2)
559 select-menu-entry 548 select-menu-entry
560 select-menu-entry 549 select-menu-entry
561
562 (scroll-text 6) 550 (scroll-text 6)
563 close-menu))) 551 close-menu)))
564 552