#!/afs/athena/contrib/perl/perl

do "./xbase.perl";

&xlib'x_open_display($ENV{'DISPLAY'});
&xlib'x_clear_area($xlib'root_window, 0, 0, 0, $xlib'rootw, $xlib'rooth);

$mygc = &xlib'x_create_gc($xlib'root_window,$xlib'defines{'GCForeground'}
| $xlib'defines{'GCBackground'}, $xlib'root_black, $xlib'root_white);
    
while(1){
$cl = rand(20);
int($cl);
$xp = rand($xlib'rootw);
$yp = rand($xlib'rooth);
&drawpent($cl, $xp, $yp);
sleep(1);
}
sub drawline {
    local($color, $x, $y, $nx, $ny) = @_;
    $mygc = &xlib'x_create_gc($xlib'root_window,$xlib'defines{'GCForeground'}
| $xlib'defines{'GCBackground'}, $color, $xlib'root_white);
&xlib'x_line($xlib'root_window, $mygc, $m, $x, $y, $nx, $ny);
}

sub drawpent {
    local($color, $x, $y) = @_;

    &drawline($color, $x, $y, ($x +20), ($y -40));
    &drawline($color, $x+20, $y-40, $x+40, $y);
    &drawline($color, $x+40, $y, $x, $y-30);
    &drawline($color, $x, $y-30, $x+40, $y-30);
    &drawline($color, $x+40, $y-30, $x, $y);

}
