From: Javier Sancho Date: Thu, 4 Apr 2019 16:09:13 +0000 (+0200) Subject: Implementing city generation X-Git-Url: https://git.jsancho.org/?p=dungeon-master.git;a=commitdiff_plain;h=6457538252f2ecb52022dfd0d56d5862245f822e;ds=sidebyside Implementing city generation --- diff --git a/src/plugins/default/main.scm b/src/plugins/default/main.scm index 866628b..b668684 100644 --- a/src/plugins/default/main.scm +++ b/src/plugins/default/main.scm @@ -4,10 +4,24 @@ (define (random-bool) (= (random 2) 1)) +(define pi 3.141592654) + (define (city-map-generator patches) "City generator from https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/towngenerator/building/Model.hx" + (set! *random-state* (random-state-from-platform)) (when (= patches -1) (set! patches 15)) - (display "lalala")(newline)) - ;(build)) + (build-patches patches)) + +(define (build-patches patches) + (define* (get-points n #:optional (l '())) + (cond ((> n 0) + (get-points (- n 1) (cons n l))) + (else + l))) + + (let ((sa (* (random:exp) 2 pi)) + (points (get-points (* 8 patches)))) + (display points) + (newline))) (dm:register-generator "city-map-generator" city-map-generator)