repeat 72[pu fd 30 pd fd 100 bk 100 pu bk 30 rt 360/72 ]
cs repeat 10[arc2 120 45 lt 83]
repeat 10[arc2 150 30 lt 114]
to bacthang :dai :rong
if :dai<:rong [stop]
repeat 2[fd :rong lt 90 fd :dai lt 90]
fd :rong
bacthang :dai:rong :rong
end
hoặc:
to bacthang :dai :rong
while [:dai >:rong][repeat 2[fd :rong lt 90 fd :dai lt 90] fd :rong make "dai
:dai:rong ]
end
to hoa1
setpencolor 5
setpensize [1 3] repeat 36[vuong rt 360/36]
bk 200
fd 80
lt 45
ellipse2 10 40
rt 90
fd 20 rt 30 fd 15 bk 15 lt 30 fd 20 lt 30 fd 15 bk 15
rt 30 fd 20 rt 30 fd 10 bk 10 lt 30 fd 20
bk 80
lt 45 bk 30
lt 135
ellipse2 10 40
rt 90
fd 20 rt 30 fd 15 bk 15 lt 30 fd 20 lt 30 fd 15 bk 15
rt 30 fd 20 rt 30 fd 10 bk 10 lt 30 fd 20
ht
end
to bienbao
setpensize [1 1]
setpc 4
circle 110
circle 90
setpensize [1 10]
rt 45 fd 90 bk 180 fd 90
rt 90
fd 90 bk 180 fd 90
pu fd 100
setfc 4
fill
setxy 0 30 setfc 1 fill
setxy 0 30 setfc 1 fill
setxy 30 0 setfc 1 fill
setxy 30 0 setfc 1 fill
ht
end
to hoatg
repeat 10[tg fd 30 lt 36]
end
to tg
repeat 3[fd 30 rt 120]
end
to thoi
repeat 2[fd 100 rt 45 fd 70 rt 135]
end
to hoa1
lt 90
repeat 5[thoi lt 360/5 fd 5]
ht
end
to thoi
repeat 2[fd 100 rt 60 fd 100 rt 120]
end
to hoa2
repeat 5[thoi rt 360/5]
rt 66
repeat 5[thoi rt 360/5]
end
to hoa3
repeat 5[fd 100 rt 20 thoi lt 20 bk 100 rt 72]
end
to a
fd 100 rt 120 fd 15 lt 60 fd 15 rt 120 fd 100 lt 180
end
to b
repeat 8[a rt 360/8] ht
end
to tg1
repeat 3[fd 50 rt 120]
end
to c
setpc 4
cs repeat 4[fd 50 tg1 fd 50 tg1 fd 100 rt 90]
fd 50
setxy 50 0
pu setxy 0 150
pd
setxy 50 200
pu setxy 150 0
pd setxy 200 50
pu setxy 200 150
pd setxy 150 200
pu setxy 50 50
setpc 5
pd repeat 4[fd 100 rt 90]
fd 50
setpc 1
circle2 50
setpc 9
setxy 100 150
setxy 150 100
setxy 100 50
setxy 50 100
ht
end
to hoa
cs
circle2 152.5
rt 90
pu fd 22.5 lt 90 pd
circle2 130 wait 20
pu setxy 10 0
setfc 0 fill wait 30
home
pd bk 20
repeat 24[arc 180 20 pu fd 40 rt 360/24 pd]
repeat 24[ lt 90 wait 20 pu fd 10 wait 20 setfc 5 fill bk 10
wait 20 rt 90 wait 20 fd 40 rt 360/24 pd]
pu setxy 50 0 setfc 6 fill
end
cs repeat 10[arc2 180 50 lt 72 wait 60]
to khan
repeat 12[thoi rt 360/12]
pu setxy 200 100
pd
repeat 2[fd 200 rt 90 fd 400 rt 90]
end
to thoi
repeat 2[fd 40 rt 50 fd 40 rt 130]
end
to tgtron
rt 30
repeat 3[fd 250 rt 120]
fd 125
rt 90
make "h distance (list 250 0)
make "r :h/3
pu fd :h/3 pd
circle :h/3
setfc 4
repeat 3[pu fd :r + 20 fill bk :r + 20 rt 120]
make "stg :h*250/2
make "stron pi*:r*:r
make "s :stg :stron
setxy 0 50
setheading 90
pd label [dien tich la:] pu fd 120 pd label :s
end
to tong
; tính tong cua day so 5 10 15 20 ...250
make "tong 0
for [i 5 250 5] [make "tong :tong+:i]
rt 90 label [tong cua day so la:] pu fd 200 pd label :tong
end
Make "tong 6375
to h2
repeat 4 [fd 200 rt 90]
fd 100
circle2 100
rt 90 fd 100
fd 100
repeat 4[rt 90 arc2 180 50 fd 100 ]
bk 100 lt 90
end
to tt
repeat 4[vuong rt 90]
circle 100
pu rt 45 repeat 4[ fd 120 fill bk 120 rt 90]
end
to vuong
repeat 4[fd 100 rt 90]
fd 50 rt 90 arc2 180 25
rt 90
fd 100 rt 90 arc2 180 50
bk 50 rt 90
arc2 180 25
rt 90 fd 25 rt 90 setfc 5 pu fd 10 fill bk 10 lt 90 fd 50 rt 90 fd 50 fill bk
50 lt 90 fd 25 rt 90 pd
end