home *** CD-ROM | disk | FTP | other *** search
- (* Conveys LIFE program with 2 states of any cell:
- dead / alive *)
-
- RECIPE XYSize = 50;
- XYBound = 1;
- Colors = 2;
- Zet = 2;
-
- CONST Dead = 0;
- Alive = 1;
-
- VAR state;
-
- EVENT SetUp;
- RingForm;
- RGBPalette(Colors, $0, $FF, $32,0, $B6, 0);
- PlClipActive;
- ShowPlane;
-
- EVENT E0; (* initialization of cell plane *)
- PlFillRandom (Dead,Alive);
- ShowPlane;
-
- EVENT E1; (* life program *)
- PARALLEL DO
- state := MooreSum;
- (* for performance reasons *)
- IF (state = 3) OR (state = 2)
- THEN IF (Self = Alive)
- THEN Self := Alive
- ELSE IF (state = 3)
- THEN Self := Alive
- ELSE Self := Dead
- FI
- FI
- ELSE Self := Dead
- FI;
- OD;
- ShowPlane;
- END.
-
-