Mercurial > vba-clojure
view clojure/com/aurellem/exp/item_bridge.clj @ 159:d92f7d68445a
found out how to increase Max PP of a move
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 20 Mar 2012 03:54:15 -0500 |
parents | 3a3bb2197b7f |
children | 09caf6a5bbf4 |
line wrap: on
line source
1 (ns com.aurellem.item-bridge2 (:use (com.aurellem.gb gb-driver vbm title save-corruption items assembly))3 (:import [com.aurellem.gb.gb_driver SaveState]))6 (defn corrupt-item-state []7 (second (destroy-item-end-of-list-marker)))9 (defn corrupt-item-state []10 (read-state "corrupt-items"))13 (defn view-memory-range [state start end]14 (dorun15 (map (fn [loc val]16 (println (format "%04X : %02X" loc val)))18 (range start end) (subvec (vec (memory state)) start end)))19 state)21 (defn almost-broken22 "if one more memory location is turned into 0x03, the game crashes."23 [n]24 (view-memory-range25 (set-inv-mem (mid-game)26 (concat [0xFF] (repeat 64 0x03)27 (subvec (vec (memory (mid-game)))28 (+ item-list-start 65)29 (+ item-list-start 65 n))30 (repeat (- 255 65 n) 0x03)31 ))33 item-list-start (+ item-list-start 255)))35 (defn actually-broken36 "if one more memory location is turned into 0x03, the game crashes."37 []38 (set-memory (mid-game) 0xD35D 0x03))41 ;; (almost-broken 20) more or less works43 (defn capture-program-counter44 "records the program counter for each tick"45 [^SaveState state ticks]46 (let [i (atom 0)]47 (reduce (fn [[program-counters state] _]48 (println (swap! i inc))49 [(conj program-counters (PC state))50 (tick state)])51 [[] state]52 (range ticks))))55 (defn capture-program-counter56 [^SaveState state ticks]57 (set-state! state)58 (loop [i 059 pcs []]60 (if (= i ticks)61 pcs62 (do63 (com.aurellem.gb.Gb/tick)64 (recur (inc i)65 (conj pcs (first (registers))))))))