aUCBLogo Demos and Tests / ccc
to ccc
ct
; compile [p1] p1
; compile [p1 p2] p2
; compile [p3] p3
; compile [p4] p4
; compile [p5] p5
; compile [p6] pr p6
; compile [p7] p7
; compile [p8] p8
; compile [p9] p9
; compile [p10] p10
; compile [p11] p11
; compile [p12] p12
; compile [p13] p13
; compile [p14] p14
; compile [p15] p15
; compile [p16] p16
; compile [p17] p17
; compile [p19 p18] p18
; compile [p20 1 2] p20 1 2
; compile [p22 0 0] p22 1 2
; compile [p22 0 0 p21 0 0] p21 1 2
; compile [p23 1] link [p23 p24] p23 5
; compile [bifurkat] bifurkat
; compile [pixtest] pixtest
; compile [speed] speed
a={1 2 3} b={3 2 1}
p={{0 1 2 3 4}{3 4 5 6 7}{6 7 8 9 10}}
compile [new_edge 1 2] new_edge a b
end
to p1
; pr 5
; pr 6
; pr 2+3
; pr 2+3+4
; pr (2*3+4*5)+6
; pr se word "hal "lo [good bye]
; local [my_var]
; my_var="Blumenkohl
; pr :my_var
;
a=int 0 ; we must copy the 0, because for speed we use "+="
; make "a a+1
t=timefine
; repeat 3 [a+=1 pr a]
; repeat 3 [a+=1 repeat a [a+=1 pr a]]
; repeat 3 [pr repcount break]
; repeat 3 [pr repcount continueLoop break]
; repeat 10000000 [a+=1 if a>0 [if a==100000 [pr a]]]
repeat 10000000 [a=a+1]
pr timefine-t
; pr a
;
; repeat 2 [pr repcount repeat 3 [(pr "\ repcount)] pr repcount] pr repcount
;
; if true
; [ (pr a)
; ]
; output 0
end
to p2
pr [Hallo, I am p2!]
p1
end
to p3
if 2==3 [pr [Bug in if!!!]]
if 4==4 [pr [if looks ok.] 0]
pr 5
end
to p4
repeat 3
[ if repcount==2 [pr repcount]
]
end
to p5
pr 5
if true [stop]
pr [No way!]
end
to p6
pr 6
output 7
pr [No way!]
end
to p7
print (1+2)*(3+4)
end
to p8
forever [pr repcount]
end
to p9
forever [pr repcount break]
end
to p10
forever [pr repcount continueLoop break]
end
to p11
ifelse 2==2 [pr [that's ok.]][pr [Bug!]]
pr 5
ifelse 2==3 [pr [Bug!]][pr [that's ok.]]
pr 6
end
to p12
if true [pr 5]
end
to p13
pr "start
while [not key?][pr repcount]
pr "ok
end
to p14
pr "start
while [not key?][repeat 3 [pr repcount]]
pr "ok
end
to p15
pr "start
while [ifelse key? [false][true]][pr repcount]
pr "ok
end
to p16
pr "start
while [ifelse key? [false][true]][repeat 3 [pr repcount]]
pr "ok
end
to p17
a1="one
a2="two
a3="three
repeat 3
[ run list "print word ":a repcount
]
pr 5
end
to p18
a=1
b=2
local [c]
c=3
pr "18_1###########################################
(pr a b)
p19
(pr a b)
pr "18_2###########################################
end
to p19
local [a b]
a=11
b=22
(show a b c)
pr "19###########################################
end
to p20 a b
(show a b)
end
to p21 a b
c=3
(show a b c)
p22 a b
(show a b c)
end
to p22 a b
(show a b)
local [a b c]
a=11
b=22
c=33
(show a b c)
end
to p23 a
if a <= 0 [stop]
(pr 23 a)
p24 a-1
; pr 23
end
to p24 a
if a <= 0 [stop]
(pr 24 a)
p23 a-1
; pr 24
end
to new_edge a b
local [m py]
(pr a b m)
; m=b+(a-b)/2
m=sum a -1
(pr a b m)
py=(p.(int m.3)).(int m.1)
pr "B
ifelse empty? py
[ m.2=m.2+(a.2-b.2)*(rnd-0.5)
setItem int m.1 p.(int m.3) m.2
][ m.2=py
]
pr m
; output m
end