in reply to Re: The Matrix Reloaded: JAPH
in thread The Matrix Reloaded: JAPH
A possibility is redrawing the whole screen at each frame. For instance (only tested on linux):
#!/usr/bin/perl -w # Array containing all lines my @screen = ( ' 'x70 . "\n" ) x 20; # Array of possible (equiprobable) characters my @char = split //, ' *|'; while(1) { print join '', @screen; # Drop last line pop @screen; # Put a new line on top unshift @screen, join ( '', map { $char[ rand(@char) ] } (1..70) ) + . "\n"; # Sleep for 0.1 seconds select(undef, undef, undef, 0.1); }
Update: The value 20 in the @screen initialization should be at least the terminal height minus 1 (due to the last line being empty). If it's less, then the upper portion of each frame is filled by the last lines of the previous one.
Cheers
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: The Matrix Reloaded: JAPH
by crouchingpenguin (Priest) on Sep 03, 2003 at 13:15 UTC | |
Re: Re: Re: The Matrix Reloaded: JAPH
by nimdokk (Vicar) on Sep 02, 2003 at 12:03 UTC |