program atom; var x, y, z, i: integer; f: text; procedure writeheader; begin writeln(f, 'object {'); writeln(f, ' union {'); end; procedure writefooter; begin writeln(f, ' }'); writeln(f, ' pigment { color green 1}'); writeln(f, ' translate <-15, -15, -15>'); writeln(f, ' scale <0.2, 0.2, 0.2>'); writeln(f, '}'); end; procedure writepiece (a, b, c: real); begin writeln(f, ' sphere { <', a, ', ', b, ', ', c, '> .2 }'); write('.'); {progress on text window} end; procedure atom; var x, y, z: real; i: integer; const e = 0.1; begin repeat x := random / 10000; y := random / 10000; z := random / 10000; if (x * x + y * y + z * z - 9 < e) and (x * x + y * y + z * z - 9 > -e) then begin writepiece(x, y, z); i := i + 1; end; until i = 300; end; begin showtext; rewrite(f, 'atom.inc'); writeheader; atom; writefooter; close(f); end.