Created
June 30, 2015 12:36
-
-
Save wmealing/3e97f1a4c32fb4a219c3 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
(ns world_builder.land | |
(:require [quil.core :as q :include-macros true] | |
[clojure.set :as set] | |
) | |
) | |
(defn unique-random-numbers [count n] | |
(let [a-set (set (take count (repeatedly #(rand-int n))))] | |
(concat a-set (set/difference (set (take count (range))) a-set)))) | |
(defn draw-point [x y] | |
(.log js/console "Drawing point!!") | |
(q/stroke 0 0 0 ) | |
(q/rect x y 20 20 )) | |
(defn draw-land [width height divs] | |
(let [x-offsets (take divs (repeatedly #(rand-int 50))) | |
y-offsets (take divs (repeatedly #(rand-int 50)))] | |
(let [points (map vector x-offsets y-offsets)] | |
; (.log js/console (pr-str points)) | |
(map draw-point points) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment