Greetings procedure:
Write a procedure
Greetings that greets a person (name to be given as input).
Erase "greetings
To greetings :person
TYPE :person
PRINT [!!]
PRINT [Pleased to meet you.]
END
? greetings "Anita
Anita!!
Pleased to meet you.
MYBACK procedure:
Write a procedure called
MYBACK that behaves exactly like BACK (but without the help of BACK).
Erase "myback
To myback :d
RT 180 FD :d RT 180
End
? myback 200
Dashed line procedure:
Write a procedure that draws a dashed line. The input specifies number of dashes.
ERASE "dash
TO dash :count
REPEAT :count [
FD 50 PU FD 50 PD
]
END
? CS RT 90 dash 5
Procedure that draws “Hi”:
Write a procedure that
draws “Hi” on the screen for the given number of times.
Erase "draw_hi
To draw_hi :number
Repeat :number [
FD 100 BK 50 RT 90 FD 50 LT 90 FD 50 BK 100
PU rt 90 fd 20 lt 90 pd Fd 80 pu fd 10
PD fd 10 pu bk 100 pd Pu rt 90 fd
20 lt 90 pd
]
End
? cs draw_hi 3
Waveform Procedure:
Add a 3rd input to the waveform
procedure to control the height of each wavelet.
ERASE
"waveform
TO
waveform :count :w :h
REPEAT
:count [
FD :H RT 90 FD :w RT 90 FD :H LT 90 FD :
]
END
? CS waveform 5 30 60
Staircase Procedure with 2 inputs:
ERASE
"staircase
TO
staircase :count :s
REPEAT
:count [
FD :s RT 90 FD :
]
END
? CS STAIRCASE 5 60
Pointstar Procedure with 2 inputs:
ERASE
"Pointstar
TO
Pointstar :count :s
REPEAT
:count [
FD :s BK :s RT 360/:count
]
END
? CS POINTSTAR 100 150
Night Sky with many Pointstars:
CS
setbg 0 RT 90 setpc 4 ht
repeat
6 [POINTSTAR 80 30 pu FD 160 PD]
LT
90 PU FD 100 RT 90 PD SETPC 2
repeat
6 [POINTSTAR 80 30 pu FD 160 PD]
LT
90 PU FD 100 RT 90 PD SETPC 14
repeat
6 [POINTSTAR 80 30 pu FD 160 PD]
Collage of figures (as shown below):
;Procedures used in the program
Erase
"PointStar
To
PointStar :raysize :nrays
Repeat
:nrays [
FD :raysize BK :raysize
RT quotient 360 :nrays
]
End
Erase
"square
To
square :size
Repeat
4 [FD :size RT 90]
End
Erase
"pentagon
To
pentagon :size
Repeat
5 [FD :size RT 360/5]
End
;------------------
;Program to draw the
design
CS
setbg 0 setpensize 2 HT
pu
fd 200 Rt 90 BK 370 PD
setpc
2 pointstar 130 10 pu FD 230 PD
setpc
3 pointstar 80 20 pu FD 210 PD
setpc
6 pointstar 95 30 pu FD 180 PD
setpc
11 pointstar 45 40 pu FD 170 PD
setpc
12 pointstar 70 50
pu
BK 850 LT 90 BK 320 PD setpc 7
BK
30*1/2 square 30*1 fd 30*1/2 pu RT 90 FD 30*1/2 LT 90 PD
BK
30*2/2 square 30*2 fd 30*2/2 pu RT 90 FD 30*2/2 LT 90 PD
bk
30*3/2 square 30*3 fd 30*3/2 pu RT 90 FD 30*3/2 LT 90 PD
bk
30*4/2 square 30*4 fd 30*4/2 pu RT 90 FD 30*4/2 LT 90 PD
bk
30*5/2 square 30*5 fd 30*5/2 pu RT 90 FD 30*5/2 LT 90 PD
bk
30*6/2 square 30*6 fd 30*6/2 pu RT 90 FD 30*6/2 LT 90 PD
bk
30*7/2 square 30*7 fd 30*7/2 pu RT 90 FD 30*7/2 LT 90 PD
setpc
8 pu RT 90 fd 200 Lt 90 BK 50 pd
pentagon
15*1
pentagon
15*2
pentagon
15*3
pentagon
15*4
pentagon
15*5
pentagon
15*6
pentagon
15*7
pentagon
15*8
pentagon
15*9
pentagon
15*10