Mercurial > vba-clojure
view clojure/com/aurellem/run/bootstrap_0.clj @ 257:8d1a354f7471
continued work on unoptimized script
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 26 Mar 2012 07:20:30 -0500 |
parents | d9e0752da684 |
children | 2a46422902be |
line wrap: on
line source
1 (ns com.aurellem.run.bootstrap-02 (:use (com.aurellem.gb gb-driver vbm))3 (:use (com.aurellem.run title save-corruption))4 (:use (com.aurellem.exp item-bridge)))7 (defn-memo boot-root []8 [ [] (root)])10 (defn-memo to-rival-name11 ([] (to-rival-name (boot-root)))12 ([script]13 (-> script14 title15 oak16 name-entry-rlm17 scroll-text18 scroll-text19 scroll-text20 scroll-text21 scroll-text22 )))24 (defn-memo name-rival-bootstrap25 ([] (name-rival-bootstrap (to-rival-name)))26 ([script]27 (->> script28 (advance [] [:a])29 (advance [] [:r] DE)30 (play-moves31 [[]32 [:r] [] [:r] [] [:r] [] [:r] []33 [:r] [] [:r] [] [:r] [] [:d] []34 [:d] [:a] ;; space35 [:l] [] [:d] [:a] ;; [PK]36 [:u] [] [:u] [] [:u] [] [:l] [:a] ;; G37 [:d] [] [:d] [] [:d] [] [:r] [:a] ;; [PK]38 [:u] [] [:u] [] [:u] [] [:l] [:a] ;; G39 [:d] [] [:d] [] [:d] [] [:r] [:a] ;; [PK]41 [:d] [] [:r] [:a] ;; finish42 ]))))44 (defn walk45 "Move the character along the given directions."46 [directions script]47 (reduce (fn [script direction]48 (move direction script))49 script directions))51 (def ↑ [:u])52 (def ↓ [:d])53 (def ← [:l])54 (def → [:r])56 (defn-memo leave-house57 ([] (leave-house (name-rival-bootstrap)))58 ([script]59 (->> script60 finish-title61 start-walking62 walk-to-stairs63 walk-to-door64 (walk [↓ ↓]))))66 (defn-memo to-pallet-town-edge67 ([] (to-pallet-town-edge (leave-house)))68 ([script]69 (->> script70 start-walking71 (walk [→ → → → →72 ↑ ↑ ↑ ↑ ↑ ↑]))))74 (defn end-text [script]75 (->> script76 (scroll-text)77 (play-moves [[] [:a]])))79 (defn-memo start-pikachu-battle80 ([] (start-pikachu-battle81 (to-pallet-town-edge)))82 ([script]83 (->> script84 (advance [:b] [:b :a] DE)85 (scroll-text)86 (play-moves [[:b]])87 (scroll-text)88 (end-text) ;; battle begins89 (scroll-text))))91 (defn-memo capture-pikachu92 ([] (capture-pikachu (start-pikachu-battle)))93 ([script]94 (->> script95 (scroll-text 2)96 (end-text))))98 (defn-memo go-to-lab99 ([] (go-to-lab (capture-pikachu)))100 ([script]101 (->> script102 (scroll-text 5)103 (end-text)104 (scroll-text)105 (end-text)106 (scroll-text 8)107 (end-text)108 (scroll-text)109 (end-text))))111 (defn-memo obtain-pikachu112 ([] (obtain-pikachu (go-to-lab)))113 ([script]114 (->> script115 (scroll-text)116 (play-moves117 (concat118 (repeat 51 [])119 [[:a] []]))120 (walk [↓ ↓ → → ↑])121 (play-moves [[:a]]))))