Mercurial > vba-clojure
comparison clojure/com/aurellem/run/util.clj @ 319:92c47a9cdaea
adapting bootstrap to new util functions.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 03 Apr 2012 04:16:20 -0500 |
parents | 9a4d3f801c89 |
children | 9637a0f52e7b |
comparison
equal
deleted
inserted
replaced
318:9a4d3f801c89 | 319:92c47a9cdaea |
---|---|
29 (let [new-state (step state buttons) | 29 (let [new-state (step state buttons) |
30 new-actions (conj actions buttons)] | 30 new-actions (conj actions buttons)] |
31 (if (not= (metric new-state) baseline) | 31 (if (not= (metric new-state) baseline) |
32 [new-actions new-state] | 32 [new-actions new-state] |
33 (recur new-actions new-state)))))) | 33 (recur new-actions new-state)))))) |
34 | |
35 | 34 |
36 (defn binary-search [metric] | 35 (defn binary-search [metric] |
37 (let [baseline (metric 0)] | 36 (let [baseline (metric 0)] |
38 (loop [low 1 | 37 (loop [low 1 |
39 high 2] | 38 high 2] |
140 (reduce (fn [script _] | 139 (reduce (fn [script _] |
141 (scroll-text script)) | 140 (scroll-text script)) |
142 script | 141 script |
143 (range n)))) | 142 (range n)))) |
144 | 143 |
144 (defn end-text | |
145 ([script] | |
146 (->> (do-nothing 150) | |
147 (play-moves [[:b]])))) | |
148 | |
145 (defn do-nothing [n script] | 149 (defn do-nothing [n script] |
146 (->> script | 150 (->> script |
147 (play-moves | 151 (play-moves |
148 (repeat n [])))) | 152 (repeat n [])))) |
149 | 153 |