Mercurial > vba-clojure
view clojure/com/aurellem/fragments.clj @ 80:ad6ebe886a21
worked out size of save files and reduced MAX_SAVE_SIZE to a more reasonable value
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 08 Mar 2012 22:29:11 -0600 |
parents | d7c38ce83421 |
children |
line wrap: on
line source
1 (ns com.aurellem.fragments2 (:use (com.aurellem gb-driver vbm)))10 (def start-frames 401)13 (defn play-start [start n]14 (let [moves15 (concat (repeat n [])16 [[:a]]17 (repeat (- start-frames n 1) []))18 moves (drop start moves)]19 (goto start)20 (dorun (map step! moves))21 (nth (registers) 2)))23 (defn earliest-press24 [start]25 (print "determining bad program-counter...")26 (reset)27 (dorun (dotimes [_ start-frames] (step)))28 (let [bad-counter (play-start 0 0)]29 (println bad-counter)30 (loop [n start]31 (print "trying" n "...")32 (let [nth-counter (play-start (dec n) n)]33 (println "got" nth-counter)34 (if (= nth-counter bad-counter)35 (recur (inc n)) n)))))39 (def start->menu40 [49 ])53 (defn full-script [] (concat start->menu))56 (defn test-script []57 (reset)58 (dorun (map step (full-script))))