That's really cool. Could you, or anyone, dissect it for those of us with high golf handicaps?
| [reply] |
Sure thing. I'll walk through the Deparse output here:
use Term::ReadKey;
@_ = GetTerminalSize();
$_[2] = $_[0] / 40;
foreach $_ ('3e7e227e3e', '6303630363', '7f3e3e7e3f', '6360630363', '2
+23f227e22') {
local $_ = unpack('b*', pack('H*', $_));
s/0/ /g;
s/1/#/g;
foreach $b (1 .. $_[2]) {
foreach $_ (split(//, $_, 0)) {
foreach $c (1 .. $_[2]) {
print $_;
push @_, $_;
}
}
print "\n";
push @_, "\n";
}
}
@_ = reverse(@_);
print @_[0 .. $#_ - 4];
What it's basically doing is taking those hex strings and turning them into strings of binary numbers, from there it's replacing all '0's with spaces, and all '1's with '#'s. It then rescales each charachter by a factor of $_2 to make it fit (as best it can) the width of the terminal. The entire time it's scaling and outputting each block it's also pushing the data onto @_, which it then reverses and prints at the end.
I don't use any variables beyond $_ and @_ by storing values in certain indices in @_.
I hope that clears it up, gkelly | [reply] [d/l] |