This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lisp
132 lines (95 loc) · 4.84 KB
/
main.lisp
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
;; sc2 strategy analyzer
;; rule based
(defun population-of (unit)
(cond ((eq unit 'queen) 2)
((eq unit 'zergline) 1)
((eq unit 'roach) 2)
((eq unit 'drone) 1)
((eq unit 'overlord) 0)
(t -1)))
(defun define-rule (rule-name rule)
"Define a rule. rule: list"
(loop
for round in
(let ((current-population 6))
(loop
for sequence in rule
for n from 0
collect
(cond ((= (length sequence) 1)
(let ((unit (car sequence)))
(setf current-population
(+ current-population (population-of unit)))
unit))
(t
(let* ((drone-number (car sequence))
(build (cdr sequence))
(population-delta (loop
for unit in build
sum
(population-of unit))))
(let ((drone-to-produce (- drone-number current-population)))
(setf current-population
(+ drone-number population-delta))
(let ((sequence (loop
for i from 1 to drone-to-produce
collect
'drone)))
(append sequence build))))))))
nconc round))
;;; start to define a bunch of zerg strategy
(define-rule '10-pool '((10 pool)
(10 overlord)
(12 zergling zergline zergline)))
(define-rule '10-pool-speedling '((10 pool)
(10 extractor)
(10 overlord zergline zergline zergline)
(drone)))
(define-rule '13-pool '((10 overlord)
(13 pool)))
(define-rule '14-hatch-14-pool '((9 overlord)
(14 hatch)
(14 pool)
(16 extractor)
(16 overlord)
(17 queen queen)))
(define-rule '14-gas-14-pool '((14 extractor)
(14 pool)))
(define-rule '14-pool-baneling-basic '((9 overlord)
(14 pool extractor)
(14 overlord zergline zergline zergline queen)
(20 zergline zergline baneling-nest)
(22 overlord)))
(define-rule '14-pool-baneling-safe '((9 overlord)
(14 pool extractor)
(14 overlord zergline zergline zergline queen)
(20 zergline zergline zergline zergline zergline zergline baneling-nest lair)
(26 extractor overlord)))
(define-rule '14-pool-15-hatch '((9 overlord)
(14 pool)
(15 hatch)
(16 queen extractor)
(18 overlord)))
(define-rule '15-pool-fast-expand '((9 overlord)
(15 pool)
(16 hatch)))
(define-rule '1-base-roach '((9 overlord)
(13 pool)
(15 extractor)
(16 roach-warren queen overlord overlord roach roach roach roach roach roach roach roach)
(overlord)))
(define-rule '2-hatch-speedling-muta '((9 overlord)
(14 extractor)
(15 pool)
(16 overlord queen lair hatch spire)))
(define-rule 'ling-speed-lair '((9 overlord)
(14 extractor pool)
(16 overlord queen lair hatch)))
(define-rule 'ling-speed-lair-2-base '((9 overlord)
(14 extractor)
(14 pool)
(16 overlord queen hatch lair)))
(define-rule 'roach-build '((10 overlord)
(15 pool)
(15 extractor)
(17 roach-warren queen overlord)))