Listing: 1 MODULE prog6; 2 (* This program draws patterns on the screen *) 3 FROM Lib IMPORT RANDOM,RANDOMIZE; 4 FROM Graph IMPORT Circle,Disc,GraphMode,TextMode,Width,Depth; 5 IMPORT IO; 6 7 TYPE 8 FunnyType = RECORD 9 q : INTEGER; (* value *) 10 d : INTEGER; (* rate of change *) 11 min : INTEGER; 12 max : INTEGER; 13 END; ***** ^ not supported yet 14 15 PROCEDURE init(VAR v:FunnyType); 16 BEGIN 17 v.q := v.min; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 18 v.d := INTEGER(RANDOM(v.max-v.min)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 19 END init; ***** ^ not supported yet 20 21 PROCEDURE bounce(VAR v:FunnyType); 22 (* Update v.q, 'bouncing' when it goes out of range *) 23 BEGIN 24 WITH v DO ***** ^ not supported yet 25 q := q + d; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 26 IF q < min THEN ***** ^ not supported yet ***** ^ not supported yet 27 q := 2*min-q; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 28 d := -d; ***** ^ not supported yet ***** ^ not supported yet 29 END; 30 IF q > max THEN ***** ^ not supported yet ***** ^ not supported yet 31 q := 2*max-q; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 32 d := -d; ***** ^ not supported yet ***** ^ not supported yet 33 END; 34 END; ***** ^ not supported yet 35 END bounce; ***** ^ not supported yet 36 37 VAR 38 x,y : FunnyType; ***** ^ not supported yet 39 color,radius : CARDINAL; 40 BEGIN 41 RANDOMIZE; ***** ^ not supported yet 42 x.max := Width-1; x.min := 0; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 43 y.max := Depth-1; y.min := 0; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 45 IO.WrStr('Press space to continue, any other key to stop'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 46 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 47 WHILE NOT IO.KeyPressed() DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 48 END; 49 50 GraphMode; ***** ^ not supported yet 51 WHILE IO.RdKey() = ' ' DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 init(x); ***** ^ not supported yet ***** ^ not supported yet 53 init(y); ***** ^ not supported yet ***** ^ not supported yet 54 55 REPEAT 56 color := RANDOM(16); ***** ^ not supported yet ***** ^ not supported yet 57 UNTIL color MOD 5 <> 0; (* fill using 2 colors *) 58 59 radius := 2 + RANDOM(5); ***** ^ not supported yet ***** ^ not supported yet 60 WHILE NOT IO.KeyPressed() DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 61 bounce(x); ***** ^ not supported yet ***** ^ not supported yet 62 bounce(y); ***** ^ not supported yet ***** ^ not supported yet 63 Disc(x.q, y.q, radius, color); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 64 Circle(x.q, y.q, radius, color MOD 4); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 65 END; 66 67 Disc(0,0,Width+Depth, 0); (* clear screen *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 68 END; 69 TextMode; ***** ^ not supported yet 70 END prog6. 71 89 errors