Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

[bored] senseless amination

by photon (Novice)
on Mar 18, 2003 at 11:00 UTC ( [id://243937]=sourcecode: print w/replies, xml ) Need Help??
Category: Fun Stuff
Author/Contact Info photon
Description: this is just a senseless ascii animation :)
#!/usr/bin/perl

$xmax   = 75;
$ymax   = 20;
$delay  = 0.2;
$white  = "\e[37m";
$bold   = "\e[1m";
$red    = "\e[31m";
$green  = "\e[32m";
$cls    = "\e[H\e[2J";
$home   = "\e[H";
$off    = "\e[?25l";
$on     = "\e[?25h";
$text   = " C3H." x 4 . "." x 15 . ":)" . "." x 26 . "photon";
$foobar = "[$red B O R I N G $green]";

print $cls. $bold;
$SIG{INT} = \&quit;
init_phreak();

while ( !$bored ) {
    print $off. $home;
    for ( $xx = 0 ; $xx < $xmax ; $xx++ ) {
        $BLOAT[$xx][ int( $xx ^ int($foo) ) ] = substr( $text, $xx, 1 
+) || " ";
    }
    if ( $mode == 1 ) { $foo-- }
    else { $foo++ }
    if ( $foo > $xmax ) { $mode = 1 }
    elsif ( $foo < 1 ) { $mode = 0 }
    for ( $ii = 0 ; $ii < length($foobar) ; $ii++ ) {
        $a += 0.001;
        if ( $a > 360 ) { $a = 0 }
        $xbla = int( sin($a) * 10 ) + int( $xmax / 4 );
        $ybla = int( cos($a) * 6 ) + int( $ymax / 2 ) - 1;
        $BLOAT[ $xbla + $ii ][$ybla] = substr( $foobar, $ii, 1 );
    }
    $vieh_id++;
    if ( $vieh_id > 2 ) { $vieh_id = 1 }
    set_phreak( $x_vieh++, $ymax - 7, "vieh_" . $vieh_id );
    if ( $x_vieh > $xmax + 6 ) { $x_vieh = -6 }
    draw();
    select undef, undef, undef, $delay;
}

sub draw {
    for ( my $y = 0 ; $y < $ymax ; $y++ ) {
        $bloat = "";
        if ( int( rand() * 5 ) == 1 ) { print $white}
        else { print $green}
        for ( my $x = 0 ; $x < $xmax ; $x++ ) {
            $bloat .= $BLOAT[$x][$y] || " ";
            $BLOAT[$x][$y] = " ";
        }
        print "$bloat\n";
    }
}

sub set_phreak {
    my $xx, $yy;
    @t_vieh   = @{ $_[2] };
    $foo_name = "phreak_" . $mode;
    $count    = scalar(@t_vieh);
    for ( $yy = 0 ; $yy < $count ; $yy++ ) {
        for ( $xx = 0 ; $xx < length( $t_vieh[$yy] ) ; $xx++ ) {
            $BLOAT[ $_[0] + $xx ][ $_[1] + $yy ] =
              substr( $t_vieh[$yy], $xx, 1 );
        }
    }
}

sub init_phreak {
    @vieh_1 =
      ( "", "  \\\\\\  .o( *yawn* )", "  C()()  ", "   \\_^", "   |", 
+"   /\\",
        "  /  __", "  \\    " );
    @vieh_2 =
      ( "  ///", " C()()  .o( *yawn* )", "  \\_^", "   |", "   /\\", "
+   _|",
        "       \\" );
}

sub quit {
  print "\e[0m$cls\n";
  sleep 1;
  print "\n\t\t greetinx to all the geeks out there :) !\n$on\n";
  exit;
}
Replies are listed 'Best First'.
Re: [bored] senseless amination
by Coruscate (Sexton) on Mar 18, 2003 at 20:15 UTC

    Is the 'reset' command available within a win32 environment? If not, you could replace sub quit with this:

    sub quit {. print "\e[0m$cls\n"; sleep 1; print "\n\t\t greetinx to all the geeks out there :) !\n$on\n"; exit; }


    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

Re: [bored] senseless amination
by photon (Novice) on Mar 18, 2003 at 18:18 UTC
    *done* :)
Re: [bored] senseless amination
by photon (Novice) on Mar 18, 2003 at 23:11 UTC
    ok, just did that, should be compatible now :)
Re: [bored] senseless amination
by sulfericacid (Deacon) on Mar 18, 2003 at 14:50 UTC
    I know peopel complain about the structure of my codes but this just looks gross, it's difficult to read what's actually going on when everything is snugged tightly on the same line. Is there any other way you can align these?

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://243937]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found