Skip to content

Instantly share code, notes, and snippets.

@wmealing
Created June 30, 2015 12:36
Show Gist options
  • Save wmealing/3e97f1a4c32fb4a219c3 to your computer and use it in GitHub Desktop.
Save wmealing/3e97f1a4c32fb4a219c3 to your computer and use it in GitHub Desktop.
(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