100 CLEAR:bon=-1
110 p_title "G r a p h d e m o","22.09.85"
120 :
130 CLS
140 SCALE 100,0,0
150 lask=0
160 v=0
170 REPeat draw
180  IF INKEY$<>"" THEN EXIT draw
190  IF v=1 OR v=2:p_pan lask,l,p
200  r=RND
210  IF v=3 AND RND>.99:RECOL 1,2,3,4,5,6,7,0
220  SELect ON r
230   ON r= 0 TO .5:p_point:p_point
240   ON r=.5 TO .6:p_circle
250   ON r=.6 TO .7:p_block
260   ON r=.7 TO .8:p_arc
270   ON r=.8 TO .9:p_square
280   ON r=.9 TO .995:p_triangle
290   ON r=REMAINDER 
300    p_wait:CLS
310    v1 = v
320    IF v1=0 THEN v=1
330    IF v1=1 THEN v=2
340    IF v1=2 THEN v=3
350    IF v1=3 THEN v=0
360    l=RND(1 TO 5)
370    p=RND(2 TO 25)
380  END SELect 
390 END REPeat draw
400 :
410 PAUSE
420 p_init
430 STOP
440 :
2000 DEFine PROCedure p_circle
2010  LOCal x,y,r,e,a
2020  INK RND(0 TO 7)
2030  x=RND(20 TO 145)
2040  y=RND(20 TO 80)
2050  e=RND
2060  a=2*PI*RND
2070  IF RND>.75 THEN 
2080   FILL 1
2090   r=RND(2 TO 25)
2100   ELSE 
2110   FILL 0
2120   r=RND(2 TO 50)
2130  END IF 
2140  CIRCLE x,y,r,e,a
2150 END DEFine p_circle
2160 :
3000 DEFine PROCedure p_point
3010  LOCal x,y
3020  FILL 0
3030  INK RND(0 TO 7)
3040  x=RND(0 TO 165)
3050  y=RND(0 TO 100)
3060  POINT x,y
3070 END DEFine p_point
3080 :
4000 DEFine PROCedure p_block
4010  LOCal w,h,x,y,c
4020  FILL 0
4030  w=RND(1 TO 30)
4040  h=RND(1 TO 30)
4050  x=RND(0 TO 418)
4060  y=RND(0 TO 170)
4070  c=RND(0 TO 7)
4080  BLOCK w,h,x,y,c
4090 END DEFine p_block
4100 :
5000 DEFine PROCedure p_arc
5010  LOCal x1,y1,x2,y2,a
5020  FILL 0
5030  x1=RND(0 TO 165)
5040  y1=RND(0 TO 100)
5050  x2=RND(0 TO 165)
5060  y2=RND(0 TO 100)
5070  a=(2*RND-1)*PI
5080  ARC x1,y1 TO x2,y2,a
5090 END DEFine p_arc
5100 :
6000 DEFine PROCedure p_square
6010  LOCal w,h,x,y,c
6020  FILL 0
6030  w=RND(1 TO 40)
6040  h=RND(1 TO 40)
6050  x=RND(0 TO 165)
6060  y=RND(0 TO 100)
6070  c=RND(0 TO 7)
6080  INK c
6090  LINE x,y TO x+w,y
6100  LINE x+w,y TO x+w,y+h
6110  LINE x+w,y+h TO x,y+h
6120  LINE x,y+h TO x,y
6130 END DEFine p_square
6140 :
7000 DEFine PROCedure p_triangle
7010  LOCal x1,y1,x2,y2,x3,x3
7020  FILL 0
7030  x1=RND(0 TO 165)
7040  y1=RND(0 TO 100)
7050  x2=x1+RND(-30 TO 30)
7060  y2=y1+RND(-30 TO 30)
7070  x3=x1+RND(-30 TO 30)
7080  y3=y1+RND(-30 TO 30)
7090  INK RND(0 TO 7)
7100  LINE x1,y1 TO x2,y2
7110  LINE x2,y2 TO x3,y3
7120  LINE x3,y3 TO x1,y1
7130 END DEFine p_triangle
7140 :
8000 DEFine PROCedure p_pan(lask,l,p)
8010  lask=lask+1
8020  IF lask>l THEN 
8030   IF v=1:PAN p:ELSE :SCROLL INT(p/1.65)
8040   lask=0
8050  END IF 
8060 END DEFine p_pan
8070 :
10000 DEFine PROCedure p_init
10010  WINDOW 513,256,0,0
10020  PAPER 0
10030  CLS
10040  FILL 0
10050  FLASH 0
10060  SCALE 100,0,0
10070  WINDOW 448,200,32,16
10080  PAPER 2
10090  INK 7
10100  CLS
10110 END DEFine p_init
10120 :
11000 DEFine PROCedure p_wait
11010  LOCal i,j
11020  FOR i=1 TO 1000:j=i+1
11030 END DEFine p_wait
11040 :
20000 DEFine PROCedure p_title(ohj$,tpvm$)
20010  WINDOW 513,256,0,0
20020  FLASH 0:PAPER 0:CLS
20030  WINDOW 513,256,0,0
20040  PAPER 0:CLS
20050  AT 7,10:INK 3
20060  PRINT ohj$
20070  AT 9,10:INK 4
20080  PRINT"by Timo Salmi"
20090  AT 11,10:INK 1
20100  PRINT tpvm$
20110  AT 13,10:INK 2
20120  PRINT"To start press any key"
20130  AT 15,10:INK 5
20140  PRINT"To exit press again"
20150  PAUSE
20160 END DEFine p_title
20170 :
