# HG changeset patch
# User Robert McIntyre <rlm@mit.edu>
# Date 1333969789 18000
# Node ID 4141489d140668ba65b94577e5038c1539cb265f
# Parent  a9e7507379e97fa07879bc267e92d9f4f4de89fe
script: bought TMs on second floor.

diff -r a9e7507379e9 -r 4141489d1406 clojure/com/aurellem/run/bootstrap_1.clj
--- a/clojure/com/aurellem/run/bootstrap_1.clj	Mon Apr 09 05:36:56 2012 -0500
+++ b/clojure/com/aurellem/run/bootstrap_1.clj	Mon Apr 09 06:09:49 2012 -0500
@@ -261,6 +261,11 @@
          (scroll-text)
          )))
 
+(defn buy-item [n quantity [moves state :as script]]
+  (->> script
+       (set-cursor n)
+       (purchase-item quantity)))
+
 
 (def desired-zero-quantities
   (map second (filter (comp (partial = 0) first)
@@ -270,7 +275,7 @@
   ([] (initial-deposits (begin-initial-deposits)))
   ([script]
      (->> script
-          (deposit-held-item 1 0x2)
+          (deposit-held-item 0 0x1)
           ((fn [script]
              (reduce 
               (fn [script item] (deposit-held-item item 0xFF script))
@@ -303,21 +308,9 @@
           (scroll-text)
           (select-menu-entry)
           (widthdraw-pc-item 0 1)
-          (widthdraw-pc-item 0 99)
-          (widthdraw-pc-item 1 1)
+          ;;(widthdraw-pc-item 0 99)
+          ;;(widthdraw-pc-item 1 1)
           (widthdraw-pc-item 2 5)
-          ;; (widthdraw-pc-item 3 99)
-          ;; (widthdraw-pc-item 3 99)
-          ;; (widthdraw-pc-item 3 57)  ;; take all
-          ;; (widthdraw-pc-item 2 99)
-          ;; (widthdraw-pc-item 2 99)
-          ;; (widthdraw-pc-item 2 56)  ;; take all
-          ;; (widthdraw-pc-item 1 99)
-          ;; (widthdraw-pc-item 1 99)
-          ;; (widthdraw-pc-item 1 55)  ;; leave one
-          ;; (widthdraw-pc-item 0 99)
-          ;; (widthdraw-pc-item 0 99)
-          ;; (widthdraw-pc-item 0 57)  ;; leave one
           (close-all-menus))))
 
 (defn-memo to-celadon
@@ -393,32 +386,56 @@
                       script))
   
 
-(defn get-money-floor-two
+(defn-memo get-money-floor-two
   ([] (get-money-floor-two (go-to-floor-two)))
   ([script]
      (->> script
           talk
           (set-cursor 1)
           (select-menu-entry)
-          (sell-held-item 2 1)
-          (sell-held-item 2 1)
-          
-          ;; (sell-held-item 11)
-          ;; (sell-held-item 10)
-          ;; (sell-held-item 9)
-          ;; (sell-held-item 8)
-          ;; (sell-held-item 7)
-          ;; (sell-held-item 6)
-          (do-nothing 40))))
-          
-          
-     
+          (sell-held-item 0 1)
+          (sell-held-item 0 1)
+          (close-menu))))
 
-(defn floor-two-TMs
-  [])
+(defn-memo floor-two-TMs
+  ([] (floor-two-TMs (get-money-floor-two)))
+  ([script]
+     (->> script
+          (wait-for-cursor)
+          (select-menu-entry)
+          (buy-item 2 98)  ;; TM02 (razor-wind)
+          (buy-item 4 71)  ;; TM37 (doubleteam)
+          (buy-item 5 63)  ;; TM01 (mega-punch)
+          (buy-item 6 1)   ;; TM05 (mega-kick)
+          (buy-item 7 56)  ;; TM09 (take-down)
+          (close-menu))))
+
+(defn end-shop-conversation
+  [script]
+  (->> script
+       (wait-until scroll-text [:b])
+       (play-moves [[] [:b]])
+       close-menu))
+
+(defn-memo floor-two-more-money
+  ([] (floor-two-more-money (floor-two-TMs)))
+  ([script]
+     (->> script
+          (wait-for-cursor)
+          (set-cursor 1)
+          (select-menu-entry)
+          (sell-held-item 0 1)
+          (sell-held-item 0 1)
+          close-menu
+          end-shop-conversation)))
+
+(defn turn [direction script]
+  (->> script
+       (first-difference [] direction AF)))
 
 (defn floor-two-items
   [])
+  
 
 (defn go-to-floor-three
   [])