Last active
August 29, 2015 13:56
-
-
Save echosa/9028090 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
;; GRID is a vector of vectors that represents a game board | |
;; Example: | |
;; [[1 3 4 9 5] [5 1 2 4 7] [1 "@" 0 0 5] [4 2 3 9 1] [1 2 3 4 5]] | |
;; should print out | |
;; 13495 | |
;; 51247 | |
;; 1@ 5 | |
;; 42391 | |
;; 12345 | |
;; | |
;; I have indicated in <CAPS> the arguments I need to have incremented | |
(defn print-grid [grid] | |
"Prints the grid to the screen." | |
(s/put-string scr 0 0 (print-str grid)) | |
(mapcat (fn [row] | |
(mapcat (fn [item] | |
(s/put-string scr | |
<X-POSITION-INCREMENT-EVERY-INNER-MAPCAT-LOOP> | |
<Y-POSITION-INCREMENT-EVERY-OUTER-MAPCAT-LOOP> | |
(if (= item 0) | |
" " | |
(print-str item)))) | |
row)) | |
grid) | |
(s/redraw scr)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment