home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / elan / intgraph / mondria.eln < prev    next >
Text File  |  1988-10-11  |  928b  |  42 lines

  1.  
  2. make a famous painting:
  3.    prepare the canvas;
  4.    stain it diligently;
  5.    painting is finished.
  6.  
  7.  
  8. prepare the canvas:
  9.    enter graphics mode;
  10.    INT CONST xmin :: graphics x limit DIV 10,
  11.              ymin :: graphics y limit DIV 10,
  12.              xmax :: graphics x limit - xmin,
  13.              ymax :: graphics y limit - ymin;
  14.    INT VAR k, l, x, y;
  15.    move (xmin, ymin);
  16.    draw (xmin, ymax);
  17.    draw (xmax, ymax);
  18.    draw (xmax, ymin);
  19.    draw (xmin, ymin).
  20.  
  21.  
  22. stain it diligently:
  23.    FOR k FROM 1 UPTO 150
  24.    REP
  25.      x := random (2 * xmin, xmax - xmin);
  26.      y := random (2 * ymin, ymax - ymin);
  27.      l := int (real (ymin) * (1.0 - sqrt (random)));
  28.      IF random > 0.5
  29.      THEN
  30.        move (x - l, y);
  31.        draw (x + l, y)
  32.      ELSE
  33.        move (x, y - l);
  34.        draw (x, y + l)
  35.      FI
  36.    ENDREP.
  37.  
  38.  
  39. painting is finished:
  40.    wait for confirmation (5, 5);
  41.    leave graphics mode.
  42.