]> git.jsancho.org Git - dungeon-master.git/blob - src/plugins/default/main.scm
Implementing city generation
[dungeon-master.git] / src / plugins / default / main.scm
1 (define-module (dungeon-master plugins default)
2   #:use-module ((dungeon-master) #:prefix dm:))
3
4 (define (random-bool)
5   (= (random 2) 1))
6
7 (define pi 3.141592654)
8
9 (define (city-map-generator patches)
10   "City generator from https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/towngenerator/building/Model.hx"
11   (set! *random-state* (random-state-from-platform))
12   (when (= patches -1) (set! patches 15))
13   (build-patches patches))
14
15 (define (build-patches patches)
16   (define* (get-points n #:optional (l '()))
17     (cond ((> n 0)
18            (get-points (- n 1) (cons n l)))
19           (else
20            l)))
21
22   (let ((sa (* (random:exp) 2 pi))
23         (points (get-points (* 8 patches))))
24     (display points)
25     (newline)))
26
27 (dm:register-generator "city-map-generator" city-map-generator)