home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pcmagazi
/
1992
/
17
/
bugs
/
bugs.doc
< prev
next >
Wrap
Text File
|
1992-09-21
|
6KB
|
111 lines
BUGS.SCR (Version 1.0) Copyright (c) 1992 Douglas Boling
------------------------------------------------------------------------
First Published in PC Magazine October 13, 1992 (Utilities)
------------------------------------------------------------------------
BUGS & BUGSBC:
BUGS is a Windows 3.1 screen saver utility that creates
voracious "bugs" that gradually eat away the display on your screen when
your monitor stays idle for more than a few minutes.
BUGS souce code should be compiled with the Windows SDK (Software Development
Kit) and Microsoft C 6.0. This version includes a password protection option.
To compile using C 6.0, the command is
NMAKE BUGSMSC.MAK
BUGSBC does not include a password option but can be compiled using the
screen saver routines in PCSCRLIB.C and Borland's C++, 3.0.
To compile with C++ 3.0, enter
MAKE -f BUGSBC.MAK
As with other screen savers, you can instantly restore your normal display
with any keystroke or mouse movement. Note that since it takes a little time
before BUGS covers the display entirely, you'll want to use a different screen
saver if you need instant blanking for security reasons.
BREEDING BUGS
To install the program, just copy BUGS.SCR into your Windows directory
(or into the directory that contains CONTROL.EXE). To select BUGS as your
screen saver, open the Control Panel and double-click on the Desktop. Pull
down the Screen Saver combo box that contains the list of screen savers
installed on your machine and pick the one titled Hungry Bugs.
Like the other Windows 3.1 screen savers, BUGS can be configured and
tested from the Desktop configuration dialog box. By pressing the Screen
Saver Setup button, you can modify the basic parameters that affect the
life of a typical bug. The OK and Cancel buttons close the dialog box, with
only OK saving the changes you have made.
A short course in basic bug biology will help you understand the
configuration options. Each pixel has a specific nutritional value based
on its color. If a bug ingests a bright red pixel, for example, it takes
in 255 calories, since the pixel has an RGB value of Red 255 + Green
0 + Blue 0. The calorie count for a white pixel is 765 (RGB = 255 + 255 +
255). To add a touch of variety, the three sliders in the nutrition level
section of the Setup dialog box let you vary the relative nutritional values
of the different colors.
When a bug eats a pixel, the pixel turns black and the bug moves on,
seeking further nourishment. Movement requires energy, however, so each
time a bug moves, a sustenance value is subtracted from that bug's caloric
reserve. Thus, if you set the sustenance value to 64, 64 calories will be
subtracted from a bug's energy stock each time the bug makes a turn.
Naturally, if the value of a bug's food units falls below zero, it dies
of starvation. Setting a high sustenance value causes bugs to starve
quickly after they are born, while reducing this value permits bugs to
survive on very few dimly colored pixels.
When a bug eats enough pixels to reach the reproduction level set by
the user, a new bug is born automatically. By setting this level low you
can cause something of a population explosion; setting a high level as a
requirement for reproduction will keep only a select few bugs wandering
the screen. Each newborn bug has enough calories to sustain itself forat least a few turns before it finds any food. The birth of the baby
reduces its parent's food reserve by half.
When BUGS starts, one bug is generated at a random location on the
screen. This bug immediately begins to eat away at the display and quickly
reaches its reproduction level, whereupon it reproduces. The second bug
acts just like the first, eating pixels and giving birth to other bugs.
Within a second, anywhere from tens to hundreds of bugs will have been
spawned in the vicinity of the initial insect.
To inject a touch of biospheric variety, some bugs have slightly
different tasks. Thus, 10 percent of the bugs are programmed to be best
at finding bright pixels. These bugs serve as scouts. Scout bugs don't
wander randomly, but tend rather to move in the direction that provides
the best food. If moving up the screen provides a scout bug with a good meal, its next move will more than likely be up. These scout bugs help
prevent a boring herd of bugs clustering around the initial bug.
Calculating the next move for hundreds of bugs is a time-consuming task,
so the Setup box lets you limit the maximum number of bugs. A fast 486 with a
graphics accelerator card can support up to 1,000 bugs without trouble. For
slower machines, 200 or 300 bugs is the recommended maximum. BUGS will still
work if you set the limit higher, but the program will slow down.
As a final customization option, color boxes can be checked that show you
how the bugs are performing. When you enable colorization for new baby bugs,
they show up as green pixels. When you enable colorization for dead bugs,
they are shown as red pixels.
Modifying the sustenance and reproduction level controls can easily
produce excessive results. Since it's possible to create an environment in
which all the bugs starve before reproducing, or, conversely, to bog down
the program by overpopulation, BUGS contains two checks on the environment.
If all the bugs die off, a new seed bug is randomly placed somewhere on the
screen. This repopulation allows the program to blank the screen eventually
no matter what parameters you set. When repopulation takes place, the
sustenance value is automatically lowered by 10 percent, making the new bugs
tougher than their recently deceased predecessors.
To curb overpopulation, the ranks of the bugs are culled if their number
rises to within 80 percent of the maximum number of bugs allowed. (After all,
in an overpopulated environment, predators will soon learn about such a rich
food source.) Trimming the bug population takes place every 15 seconds, with
the least productive 20 percent of the bugs being killed off.
--------------------------------------------------------------------------
DOUGLAS BOLING IS A CONTRIBUTING EDITOR TO PC MAGAZINE.