home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
PASCAL
/
SPLOTCH.ZIP
/
SPLOTCH.DOC
next >
Wrap
Text File
|
1991-09-29
|
2KB
|
56 lines
+------------------------+
| SPLOTCH by Bill Reamy |
+------------------------+
- An example of cellular automata.
- With Turbo Pascal source.
- VGA required.
note: unlike "Life" and many other examples, Splotch has changes that
occur one at a time, instead of an entrie 'generation' at a time.
This program is loosly based on "Vote", ( no I don't remember who wrote
it, I just remember reading about it in a computer magazine).
This program should compile under Turbo Pascal ver 5.0, 5.5, or 6.0.
The file Vga256.bgi must be present in the current directory.
Splotch starts out with random screen. Each pixel is randomly colored.
Then one by one, pixels are averaged with one of their neighbors.
Which pixels are chosen, and which neighbor is used, is determined
by a pseudo-random number generator. The end result is that all pixels
will (probablly) eventualy become the same color. Along the way, areas
on the screen will form, in different colors, one fading into the next.
Be PATIENT, this will take some time. Noticable changes start within
2 to 3 minutes on a 12MHz 286. A full run will take well over an hour.
This program is good for those times when you are reading a book, and
you don't bother to turn off the computer.
If you'd like a change of colors, turning 'Scroll-Lock' on will
cause VGA palette rotation. If you leave it rotating, the pattern will
not progress.
I included the source because this is the sort of program that is fun
to modify. Try changing the starting screen, pixel influence expression,
etc.
For an interesting variation try replacing the following code, which
fills the screen with random dots:
for X := 0 to 319 do
for Y := 0 to 199 do
PutPixel( X, Y, Random(256) );}
Instead try this, it will fill the screen with random rectangles:
for R := 1 to 200
do begin
X := Random( 300 );
Y := Random( 180 );
SetFillStyle( SolidFill, Random(256) );
Bar( X,Y, X+Random(318-X), Y+Random(198-Y) );
end;