-
Notifications
You must be signed in to change notification settings - Fork 0
/
procsland.rkt
executable file
·77 lines (69 loc) · 2.91 KB
/
procsland.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env racket
#lang racket
(module+ test
(require rackunit))
(module+ test
;; Tests to be run with raco test
)
(module+ main
(require "graphics.rkt")
; command line args
(define screen-width (make-parameter 1366))
(define screen-height (make-parameter 768))
(define map-height (make-parameter 31))
(define map-width (make-parameter 42))
(define land-mass (make-parameter 53))
(define mountain-mass (make-parameter 35))
(define forest-mass (make-parameter 45))
(define beach-mass (make-parameter 100))
(define city-mass (make-parameter 3))
(define iterations (make-parameter 10))
(define parser
(command-line
#:usage-help
"procsland is an hex map island generator"
"based on cellular automata."
#:once-each
[("-W" "--screen-width") SCREEN-WIDTH
"width of the screen in pixels"
(screen-width (string->number SCREEN-WIDTH))]
[("-H" "--screen-height") SCREEN-HEIGHT
"height of the screen in pixels"
(screen-height (string->number SCREEN-HEIGHT))]
[("-e" "--map-height") MAP-HEIGHT
"height of the map in (hex) tiles"
(map-height (string->number MAP-HEIGHT))]
[("-w" "--map-width") MAP-WIDTH
"width of the map in (hex) tiles"
(map-width (string->number MAP-WIDTH))]
[("-l" "--land-mass") LAND-MASS
"probability for land tiles to appear"
(land-mass (string->number LAND-MASS))]
[("-m" "--mountain-mass") MOUNTAIN-MASS
"probability for mountain tiles to appear"
(mountain-mass (string->number MOUNTAIN-MASS))]
[("-f" "--forest-mass") FOREST-MASS
"probability for forest tiles to appear"
(forest-mass (string->number FOREST-MASS))]
[("-b" "--beach-mass") BEACH-MASS
"probability for beach tiles to appear"
(beach-mass (string->number BEACH-MASS))]
[("-c" "--city-mass") CITY-MASS
"probability for city tiles to appear"
(city-mass (string->number CITY-MASS))]
[("-i" "--iterations") ITERATIONS
"number of iterations of the cellular automata to perform"
(iterations (string->number ITERATIONS))]
#:args () (void)))
(new gui%
[screen-width (screen-width)]
[screen-height (screen-height)]
[map-height (map-height)]
[map-width (map-width)]
[land-mass (land-mass)]
[mountain-mass (mountain-mass)]
[forest-mass (forest-mass)]
[beach-mass (beach-mass)]
[city-mass (city-mass)]
[iterations (iterations)])
)