diff 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Mon Apr 09 07:30:44 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Mon Apr 09 08:27:45 2012 -0500
     1.3 @@ -493,8 +493,7 @@
     1.4                   ↑ ↑ ↑
     1.5                   → → → → → ↑ ;; leave floor four
     1.6                   ↓ ← ← ← ← ← ← ← ←
     1.7 -                 ↓ ↓ ↓ ← ← ← ;; go to five's clerk
     1.8 -                 ])
     1.9 +                 ↓ ↓ ↓ ← ← ← ]);; go to five's clerk
    1.10            (turn ↑))))
    1.11                  
    1.12  (defn-memo floor-five-items
    1.13 @@ -509,13 +508,58 @@
    1.14            close-menu
    1.15            end-shop-conversation)))
    1.16  
    1.17 -(defn go-to-roof
    1.18 -  [])
    1.19 +(defn-memo go-to-roof
    1.20 +  ([] (go-to-roof (floor-five-items)))
    1.21 +  ([script]
    1.22 +     (->> script
    1.23 +          (walk [→ → → → ↑ ↑ ↑ → → → ↑ ;; leave floor five
    1.24 +                 ↓ ← ← ←]) ;; walk to vending machine
    1.25 +          (turn ↑))))
    1.26  
    1.27 -(defn roof-drinks
    1.28 -  [])
    1.29 +(defn dp
    1.30 +  [str script]
    1.31 +  (println str) script)
    1.32  
    1.33 +(defn buy-drink
    1.34 +  "Assumes you're in front of the vending machine. Buys the indicated
    1.35 +   drink."
    1.36 +  [n script]
    1.37 +  (->> script
    1.38 +       (dp "talk")
    1.39 +       talk
    1.40 +       (dp "scroll-text")
    1.41 +       (scroll-text)
    1.42 +       (wait-for-cursor)
    1.43 +       (set-cursor n)
    1.44 +       select-menu-entry
    1.45 +       close-menu))
    1.46 +
    1.47 +(defn-memo roof-drinks
    1.48 +  ([] (roof-drinks (go-to-roof)))
    1.49 +  ([script]
    1.50 +     (->> script
    1.51 +          (buy-drink 0)           ;; fresh water (for TM13)
    1.52 +
    1.53 +          ;; buy 16 lemonades
    1.54 +          ;; LEMONADE is the best item <3  :)
    1.55 +          (multiple-times 5 (partial buy-drink 2))
    1.56 +          (do-nothing 1) ;; unknown hiccup here :(
    1.57 +          (multiple-times 11 (partial buy-drink 2)))))
    1.58 +     
    1.59  (defn get-TM13
    1.60 -  [])
    1.61 +  ([] (get-TM13 (roof-drinks)))
    1.62 +  ([script]
    1.63 +     (->> script
    1.64 +          (walk [↓ ↓ ↓
    1.65 +                 ← ← ← ← ← ←
    1.66 +                 ])
    1.67 +          (do-nothing 1) ;; wtf is wrong with talk?
    1.68 +          talk
    1.69 +          (scroll-text 2)
    1.70 +          select-menu-entry
    1.71 +          select-menu-entry
    1.72 +          
    1.73 +          (scroll-text 6)
    1.74 +          close-menu)))
    1.75 +          
    1.76    
    1.77 -  
    1.78 \ No newline at end of file