annotate clojure/com/aurellem/run/save_corruption.clj @ 274:210b465e4720

refactored walking code from buy-initial-objects to its own function.
author Robert McIntyre <rlm@mit.edu>
date Tue, 27 Mar 2012 11:30:58 -0500
parents 8d1a354f7471
children 8e63b0bb8ea3
rev   line source
rlm@170 1 (ns com.aurellem.run.save-corruption
rlm@170 2 (:use (com.aurellem.gb gb-driver vbm))
rlm@170 3 (:use (com.aurellem.run title)))
rlm@90 4
rlm@90 5 (use 'clojure.repl)
rlm@90 6
rlm@250 7 (defn-memo start-walking
rlm@250 8 ([script]
rlm@250 9 (->> script
rlm@250 10 (advance [:b] [:b :r])))
rlm@250 11 ([] (start-walking (finish-title))))
rlm@91 12
rlm@255 13 (def move
rlm@255 14 (partial advance []))
rlm@91 15
rlm@250 16 (defn-memo walk-to-stairs
rlm@250 17 ([] (walk-to-stairs (start-walking)))
rlm@250 18 ([script]
rlm@250 19 (->> script
rlm@255 20 (move [:u])
rlm@255 21 (move [:u])
rlm@255 22 (move [:u])
rlm@255 23 (move [:u])
rlm@255 24 (move [:u])
rlm@255 25 (move [:r])
rlm@255 26 (move [:r])
rlm@255 27 (move [:r]))))
rlm@91 28
rlm@250 29 (defn-memo walk-to-door
rlm@250 30 ([] (walk-to-door (walk-to-stairs)))
rlm@250 31 ([script]
rlm@250 32 (->> script
rlm@255 33 (move [:d])
rlm@255 34 (move [:d])
rlm@255 35 (move [:d])
rlm@255 36 (move [:d])
rlm@255 37 (move [:d])
rlm@255 38 (move [:d])
rlm@255 39 (move [:l])
rlm@255 40 (move [:l])
rlm@255 41 (move [:l])
rlm@255 42 (move [:l]))))
rlm@91 43
rlm@250 44 (defn-memo activate-menu
rlm@250 45 ([] (activate-menu (walk-to-door)))
rlm@250 46 ([script]
rlm@250 47 (->> script
rlm@250 48 (advance [:b] [:a :b :start]))))
rlm@90 49
rlm@250 50 (defn-memo save-game
rlm@250 51 ([] (save-game (activate-menu)))
rlm@250 52 ([script]
rlm@250 53 (->> script
rlm@250 54 (advance [] [:d])
rlm@250 55 (play-moves [[] [] [] [:d] [] [] [] [:d] [] [] [:a]])
rlm@250 56 scroll-text)))
rlm@90 57
rlm@250 58 (defn-memo corrupt-save
rlm@250 59 ([] (corrupt-save (save-game)))
rlm@250 60 ([script]
rlm@250 61 (->>
rlm@250 62 script
rlm@250 63 (play-moves
rlm@250 64 ;; this section is copied from speedrun-2942 and corrupts
rlm@250 65 ;; the save so that the end-of-list marker for the pokemon
rlm@250 66 ;; roster is destroyed, but the save is still playable.
rlm@250 67 [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 68 [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]]))))
rlm@90 69
rlm@250 70 (defn-memo start-game
rlm@250 71 ([] (start-game (corrupt-save)))
rlm@250 72 ([script]
rlm@250 73 (->> script
rlm@250 74 (title)
rlm@250 75 (advance [] [:start])
rlm@250 76 (advance [] [:a])
rlm@250 77 (advance [:a] [:a :start]))))
rlm@90 78
rlm@250 79 (defn-memo destroy-item-end-of-list-marker
rlm@250 80 ([] (destroy-item-end-of-list-marker (start-game)))
rlm@250 81 ([script]
rlm@250 82 (->>
rlm@250 83 script
rlm@250 84 (play-moves
rlm@250 85 [[:start] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 86 [] [] [] [] [] [] [] [] [:a] [] [] [] [] [] [] [] []
rlm@250 87 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 88 [] [] [:d] [] [] [] [:a] [] [] [:d] [] [] [:a] [] []
rlm@250 89 [] [] [] [] [] [] [] [] [] [] [] [:d] [] [] [] []
rlm@250 90 [:d] [] [] [] [] [:d] [] [] [] [] [:d] [] [] [] []
rlm@250 91 [:d] [] [] [] [] [:d] [] [] [] [] [:d] [] [] [] []
rlm@250 92 [:d] [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] []
rlm@250 93 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 94 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:d]
rlm@250 95 [] [] [] [:a] [] [] [:d] [] [] [:a] [] [] [] [] []
rlm@250 96 [] [] [] [] [] [] [] [] [:u] [] [] [] [] [:u] [] []
rlm@250 97 [] [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 98 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 99 [] [] [] [] [] [] [] [] [] [] [] []]))))
rlm@91 100
rlm@91 101 (defn warp-to-elite-four
rlm@250 102 "This is copied from speedrun-2942 to ensure that
rlm@250 103 everything is good up to this point."
rlm@91 104 []
rlm@91 105 (->> (corrupt-save)
rlm@91 106 (play-moves
rlm@250 107 [ [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 108 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 109 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 110 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 111 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 112 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 113 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 114 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 115 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 116 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 117 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 118 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 119 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 120 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 121 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 122 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 123 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 124 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 125 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:a] []
rlm@250 126 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 127 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 128 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 129 [] [] [] [] [] [] [] [] [:start] [] [] [] [] [] []
rlm@250 130 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 131 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 132 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 133 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 134 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 135 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 136 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 137 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 138 [] [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 139 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 140 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 141 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 142 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 143 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 144 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 145 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 146 [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 147 [:start] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 148 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 149 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 150 [] [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 151 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 152 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 153 [:start] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 154 [] [] [] [] [] [] [] [] [:a] [] [] [] [] [] [] [] []
rlm@250 155 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 156 [] [] [:d] [] [] [] [:a] [] [] [:d] [] [] [:a] [] []
rlm@250 157 [] [] [] [] [] [] [] [] [] [] [] [:d] [] [] [] []
rlm@250 158 [:d] [] [] [] [] [:d] [] [] [] [] [:d] [] [] [] []
rlm@250 159 [:d] [] [] [] [] [:d] [] [] [] [] [:d] [] [] [] []
rlm@250 160 [:d] [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] []
rlm@250 161 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 162 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:d]
rlm@250 163 [] [] [] [:a] [] [] [:d] [] [] [:a] [] [] [] [] []
rlm@250 164 [] [] [] [] [] [] [] [] [:u] [] [] [] [] [:u] [] []
rlm@250 165 [] [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 166 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 167 [] [] [] [] [] [] [] [] [] [] [] [] [:b] [] [] [] []
rlm@250 168 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 169 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 170 [] [] [] [] [:d] [] [] [:a] [] [] [] [] [] [] [] []
rlm@250 171 [] [] [] [] [] [] [] [:d] [] [] [] [:d] [] [] []
rlm@250 172 [:d] [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d]
rlm@250 173 [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] []
rlm@250 174 [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] [] [] []
rlm@250 175 [] [] [:d] [] [] [] [] [] [] [:d] [] [] [] [] [] []
rlm@250 176 [:d] [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d]
rlm@250 177 [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] []
rlm@250 178 [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] [] [] []
rlm@250 179 [] [] [:d] [] [] [] [] [] [] [:d] [] [] [] [] [] []
rlm@250 180 [:d] [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d]
rlm@250 181 [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] []
rlm@250 182 [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] [] [] []
rlm@250 183 [] [] [] [] [] [] [] [] [] [:b] [] [] [] [] [] [] []
rlm@250 184 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:select]
rlm@250 185 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 186 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:b]
rlm@250 187 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 188 [] [] [] [] [:d] [] [] [] [] [] [] [] [] [:b] [] []
rlm@250 189 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 190 [] [] [:select] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 191 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 192 [] [] [] [] [] [:b] [] [] [] [] [] [] [] [] [] [] []
rlm@250 193 [] [] [] [] [:d] [] [] [] [] [] [] [] [] [] [] []
rlm@250 194 [:b] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 195 [:d] [] [] [] [] [:b] [] [] [] [] [] [] [] [] [] []
rlm@250 196 [] [] [] [] [] [] [:select] [] [] [] [] [] [] [] []
rlm@250 197 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:b]
rlm@250 198 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:d]
rlm@250 199 [] [] [] [] [] [] [] [:d] [] [] [] [] [] [] [] [:d]
rlm@250 200 [] [] [] [] [] [] [:d] [] [] [] [] [] [] [:d] [] []
rlm@250 201 [] [] [] [] [] [] [] [] [] [:select] [] [] [] [] []
rlm@250 202 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 203 [] [] [] [] [] [] [] [] [] [] [:a] [] [] [:d] [] []
rlm@250 204 [:a] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] []
rlm@250 205 [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u]
rlm@250 206 [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] []
rlm@250 207 [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u]
rlm@250 208 [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] []
rlm@250 209 [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u]
rlm@250 210 [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] []
rlm@250 211 [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u]
rlm@250 212 [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] []
rlm@250 213 [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u] [] [:u]
rlm@250 214 [] [:u] [] [:u] [:a] [] [] [] [] [] [:a] [] [] []
rlm@250 215 [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 216 [] [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 217 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:b] [] []
rlm@250 218 [] [] [] [] [] [] [:b] [:d] [:d] [:d] [:d] [:d] [:d]
rlm@250 219 [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d]
rlm@250 220 [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d]
rlm@250 221 [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d] [:d]
rlm@250 222 [:d] [:d] [:d] [:d] [] [] [] [] [] [] [] [] [] [] []
rlm@250 223 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 224 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 225 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 226 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 227 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 228 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 229 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 230 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 231 [] [] [] [] [] [] [] [] [:a] [] [] [] [] [] [] [] []
rlm@250 232 [] [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 233 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:a] [] []
rlm@250 234 [] [] [] [] [] [] [] [] [] [] [:a] [] [] [] [] [] []
rlm@250 235 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 236 [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 237 [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 238 [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 239 [] [] [] [] [] [] [] [] [] [] [:a] [] [] [] [] [] []
rlm@250 240 [] [] [] [] [] [] [:a] [] [] [] [] [] [] [] [] [] []
rlm@250 241 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [:a]
rlm@250 242 [] [] [] [] [] [] [] [] [] [] [] [] [:a] [] [] [] []
rlm@250 243 [] [] [] [] [] [] [] [] [] [] [] [] [:a] [] [] [] []
rlm@250 244 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 245 [] [] [] [] [] [:a] [] [] [] [] [] [] [] [] [] [] []
rlm@250 246 [] [:a] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@250 247 [:b]])))