#!/usr/bin/perl
# ritalinworld.pl
# drugs to make you a screensaver.
#
# if you run it, run on black background (like DOS command prompt.)
# may be projected and accompanied by techno music to taste.
#
# features:
# - gets less interesting but more hypnotic as it goes along.
# - at times, makes nice hypno-patterns
# - wagon wheel effect - can't tell if it's coming or going
# - tries to move toward equilibrium, though it's sort of hard to tell...
# - glitches sometimes
# - barely discernible content
# - messy, disorganized code - an algorithmic snapshot of the author's mind!
use Time::HiRes qw(usleep);
srand();
my $limit = 5000; # TRT around 10 minutes. 10000 gets you about 45.
my $downtime = 0;
my $string = ".";
for ($i=$limit;$i>1;$i--) {
my $range = $i;
my $spacefig;
$downtime = ($downtime * 1.7)/2 + 4;
my $halflife = ($i/2);
my $out = rand($range) + $halflife;
if ($i > 200) {
$spacefig = 10;
}
elsif ($i > 600 and $i < 1000) {
$spacefig = 1000;
}
else {
$spacefig = $downtime - 2;
}
if (rand($range) < ($halflife)) {
for ($j=1;$j<rand($downtime - $spacefig) ;$j++) {
# for ($j=1;$j<rand(10) ;$j++) {
$string = $string . "\.";
}
print "$range $string $halflife . $string";
print "$out\n";
}
else {
if (int(rand($downtime * 3)) == 2) {
sleep 1;
}
usleep (900 * $downtime);
}
}