Created
February 4, 2010 21:41
-
-
Save duncanmak/295146 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn calculate-offset [value file s r c] | |
(println "Calculating offset for" (.getName file) "at" [s r c]) | |
(if-let [tile (get-tile s r c)] | |
(really-calculate-offset file (:file tile)) | |
(do (Thread/sleep 60000) | |
(recur value file s r c)))) | |
(defn make-offset [file sec row col] | |
(let [->offset #(calculate-offset %1 file sec %2 %3) | |
row-1 (dec row) row+1 (inc row) | |
col-1 (dec col) col+1 (inc col)] | |
(struct-map Offset | |
:north (send (agent []) ->offset row-1 col) | |
:south (send (agent []) ->offset row+1 col) | |
:east (send (agent []) ->offset row col+1) | |
:west (send (agent []) ->offset row col-1)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment