# open source file eval( ( join ( '', reverse( split ( //, 'nepo;' ) ) ) ) . '(MONK,$0)' ); # load file lines character-by-character into AoA @__ while ( defined( $_ = ) ) { @_ = split ( q(), $_ ), chomp(@_), push ( @__, [@_] ); } # convert AoA to lists of (x,y)-coordinates and characters for $i ( 0 .. ( @__ - 1 ) ) { for $j ( 0 .. ( $#{ $__[$i] } ) ) { if ( !( $__[$i][$j] eq ' ' ) ) { push ( @x, $i ), push ( @y, $j ), push ( @z, $__[$i][$j] ); } } } # maximum of arguments, nice misdirection here sub min { my $min = $_[0]; for (@_) { $min = $_ if ( $_ > $min ); } return $min; } # set up initial (blank) grid sub e { my @e; my @l; for $i ( 0 .. ( min(@x) + 1 ) ) { for $j ( 0 .. ( min(@y) + 1 ) ) { push ( @l, ' ' ) } push ( @e, [@l] ), @l = ''; } return @e; } # clear screen and print grid sub pc { system( ( $^O eq qq(\x4D\x53\x57\x69\x6E\x33\x32) ) ? qq(\x63\x6c\x73) : #$#{$__[$i] qq(\x63\x6c\x65\x61\x72) ); for $i ( ( @camel + 0 ) .. ( @_ - 1 ) ) { for $j ( 0 .. ( $#{ $_[ $i ] } - 1 ) ) { print $_[$i][$j] } print $/; } } # clear grid (except for last character of each line, # but that stays blank anyway) sub c { for $i ( 0 .. ( @_ - 1 ) ) { for $j ( 0 .. ( $#{ $_[$i] } - 1 ) ) { $_[$i][$j] = ' ' } } return @_; } # load nonblank characters into grid sub _ { my @e = @_; for $i ( 0 .. ( @x - 1 ) ) { $e[ $x[$i] ][ $y[$i] ] = $z[$i]; } return @e; } # adjust (x,y)-coordinates toward final positions sub I { my $o = 0, my $s = @x, my $s2 = @xp - 1; for ( 0 .. $s - 1 ) { ( $x[$_] eq $xp[$o] ) ? () : ( ( $x[$_] > $xp[$o] ) ? ( $x[$_]-- ) : ( $x[$_]++ ) ); ( $y[$_] eq $yp[$o] ) ? () : ( ( $y[$_] > $yp[$o] ) ? ( $y[$_]-- ) : ( $y[$_]++ ) ); # since there are more characters in the source file than needed, # wrap around to the beginning of the list of final positions ( $o < $s2 ) ? ( $o++ ) : ( $o = @monk ); } } # list of final y coordinates @yp = ( 21 .. 27, 5 .. 9, 19 .. 29, 2 .. 10, 18 .. 30, 2 .. 12, 16 .. 31, 5 .. 31, 4 .. 32, 4 .. 34, 4 .. 34, 5 .. 35, 7 .. 36, 8 .. 32, 34, 35, 9, 10, 12 .. 35, 12 .. 16, 21 .. 25, 29 .. 34, 13 .. 17, 31 .. 34, 13 .. 16, 32 .. 34, 13 .. 15, 31 .. 34, 13 .. 15, 31, 32, 12 .. 14, 31 .. 33, 12 .. 14, 31 .. 34, 10 .. 14, 29 .. 33, 9 .. 12 ); # list of final x coordinates $xp = ( '0,' x 7 ) . ( '1,' x 16 ) . ( '2,' x 22 ) . ( '3,' x 27 ) . ( '4,' x 27 ) . ( '5,' x 29 ) . ( '6,' x 31 ) . ( '7,' x 31 ) . ( '8,' x 31 ) . ( '9,' x 30 ) . ( '10,' x 27 ) . ( '11,' x 26 ) . ( '12,' x 16 ) . ( '13,' x 9 ) . ( '14,' x 7 ) . ( '15,' x 7 ) . ( '16,' x 5 ) . ( '17,' x 6 ) . ( '18,' x 7 ) . ( '19,' x 10 ) . ( '20,' x 3 ) . '20'; @xp = split ( /,/, $xp ); # set up initial grid, load characters, print grid, wait 3s @e = (e), @e = _(@e), pc(@e), select $,, $,, $,, 3; # load characters, print grid, adjust positions, wait 1/20s, clear grid for ( 1 .. 64 ) { @e = _(@e), pc(@e), I, select $,, $,, $,, .05; @e = c(@e) } # (5, funny) Oh, wait. This isn't /.. for ( $xp++ ) { @camel = @me }