-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample scripts.txt
191 lines (163 loc) · 2.02 KB
/
sample scripts.txt
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#===================================
# Pentagon circle
color 'red'
repeat 10
repeat 5
fd 50+5
lt 360/5+5-5
end
rt 360/10
end
hide
#===================================
# let usage
let side = 100
repeat 4
fd side
lt 90
end
#===================================
# assignment test - spiral
let side = 5
pu
rt 90
fd 150
lt 90
pd
repeat 5000
fd side
lt 2
side = side * 0.999
end
#===================================
# draw circle
let radius = 100
let numsegs = 36
let theta = 360 / numsegs
let side = 2*radius * sin(theta / 2)
let alpha = (180-theta)/2
pushpos
pu
fd radius
lt 90 + (90-alpha)
pd
repeat numsegs
fd side
lt theta
end
poppos
#===================================
# draw concentric circles with proc
proc circle(radius)
let numsegs = 72
let raddelta = 5
let theta = 360 / numsegs
let side = 2*radius * sin(theta / 2)
let alpha = (180-theta)/2
pushpos
pu
fd radius
lt 90 + (90-alpha)
pd
repeat numsegs
fd side
lt theta
end
poppos
end
call circle(160)
#=====================
# rainbow circle
thick 10
repeat 36
color 'hsl(angle)'
pushpos
repeat 36
fd 3
lt 3
end
poppos
lt 10
end
hide
#=================================
# rotating grid of squares
pu
lt 180
fd 140
rt 90
fd 140
rt 90
proc square(side)
pushpos
repeat 4
fd side
rt 90
end
poppos
end
let a = 0
repeat 8
pushpos
repeat 8
pd
lt a
call square(20)
rt a
a = a + 1
pu
fd 20+10
end
poppos
rt 90
fd 20+10
lt 90
end
#===================================
# another curvy rainbow circle
thick 5
repeat 36
pushpos
repeat 20
color 'hsl(angle)'
fd 5
lt 9
end
poppos
lt 10
end
#===================================
# sine wave sweeped in a circle
repeat 36
pushpos
let theta = 0
color 'hsl(angle)'
repeat 500
fd 1
lt 10 * cos(theta)
theta = theta + 5
end
poppos
lt 10
end
#===================================
# Jargon - Grammar Example
# this is a comment
let x = 100
let y = x * 2
x = sqrt(2)
proc square(side)
pushpos
repeat 4
fd side
lt 90
end
poppos
end
repeat 60
call square(5)
lt 90 + 45
rt 90
fd 100
end
#===================================