Sin mucho que decir dejo este simple script para hacer ascii art desde una palabra.
El codigo
#!usr/bin/perl
#ASCII Art 0.1
#Coded By Doddy H
use List::Util "max";
use Time::HiRes "usleep";
my %letras = (
a => "
@
@
@ @
@ @
@ @
@ @
@@@@@
@ @
@ @
",
b => "
@@@@
@ @
@ @
@ @
@@@@
@ @
@ @
@ @
@@@@
",
c => "
@@@@
@ @
@
@
@
@
@
@ @
@@@@
",
d => "
@@@@
@ @
@ @
@ @
@ @
@ @
@ @
@ @
@@@@
",
e => "
@@@@@
@
@
@
@@@@
@
@
@
@@@@@
",
f => "
@@@@@
@
@
@
@@@@
@
@
@
@
",
g => "
@@@@
@ @
@
@
@ @@@
@ @
@ @
@ @@
@@@ @
",
h => "
@ @
@ @
@ @
@ @
@@@@@@
@ @
@ @
@ @
@ @
",
i => "
@
@
@
@
@
@
@
@
@
",
j => "
@
@
@
@
@
@
@ @
@ @
@@
",
k => "
@ @
@ @
@ @
@@
@@
@ @
@ @
@ @
@ @
",
l => "
@
@
@
@
@
@
@
@
@@@@@
",
@ @
@ @
@@ @@
@@ @@
@ @ @ @
@ @ @ @
@ @ @
@ @ @
@ @
",
n => "
@ @
@@ @
@@ @
@ @ @
@ @ @
@ @ @
@ @@
@ @@
@ @
",
o => "
@@@@
@ @
@ @
@ @
@ @
@ @
@ @
@ @
@@@@
",
p => "
@@@@@
@ @
@ @
@ @
@@@@@
@
@
@
@
",
@@@@
@ @
@ @
@ @
@ @
@ @
@ @ @
@ @@
@@@@
@
",
r => "
@@@@@
@ @
@ @
@ @
@@@@@
@ @
@ @
@ @
@ @
",
@@@
@ @
@
@
@@@
@
@
@ @
@@@
",
t => "
@@@@@
@
@
@
@
@
@
@
@
",
u => "
@ @
@ @
@ @
@ @
@ @
@ @
@ @
@ @
@@@@
",
v => "
@ @
@ @
@ @
@ @
@ @
@ @
@ @
@
@
",
W => "
@ @
@ @
@ @ @
@ @ @
@ @ @
@ @ @ @
@ @ @ @
@ @
@ @
",
x => "
@ @
@ @
@ @
@ @
@
@ @
@ @
@ @
@ @
",
@ @
@ @
@ @
@ @
@
@
@
@
@
",
z => "
@@@@@@@
@
@
@
@
@
@
@
@@@@@@@
"
);
head();
chomp( my $text = <stdin> );
print "\n\n" . artnow
($text) . "\n";
copyright();
sub artnow {
my $fondo = " ";
my $espacio = 0;
my $lugar;
my @lotengo;
my $tipox = $letras{"a"};
my @lineas = split /\n/, $tipox; $altura = @lineas + 1;
for ( 1 .. $altura ) {
push @lotengo, $fondo x
( ( $anchura + $espacio ) * length $target ); }
for my $letra ( split //, $target ) { my @lineas = split /\n/, $letras{$letra};
for my $i ( 0 .. $altura - 1 ) {
( my $plan = $lineas[$i] ) =~ s/ /$fondo/g;
$plan = $fondo x $anchura if not $plan;
}
$lugar += $anchura + $espacio;
}
}
sub head {
my @logo = (
"#=============================================#", "\n",
"# ASCII Art 0.1 #", "\n",
"#---------------------------------------------#", "\n",
"# Written By Doddy H #", "\n",
"# Email: lepuke[at]hotmail[com] #", "\n",
"# Website: doddyhackman.webcindario.com #", "\n",
"#---------------------------------------------#", "\n",
"# Thanks to : reLlene,MARKO,explorer #", "\n",
"# The End ? #", "\n",
"#=============================================#", "\n"
);
marquesina(@logo);
}
sub marquesina {
#Effect based in the exploits by Jafer Al Zidjali
my @logo = @_;
my $car = "|";
for my $uno (@logo) {
for my $dos ( split //, $uno ) {
$|++;
if ( $car eq "|" ) {
mostrar( "\b" . $dos . $car, "/" );
}
elsif ( $car eq "/" ) {
mostrar( "\b" . $dos . $car, "-" );
}
elsif ( $car eq "-" ) {
mostrar( "\b" . $dos . $car, "\\" );
}
else {
mostrar( "\b" . $dos . $car, "|" );
}
usleep(40_000);
}
}
sub mostrar {
$car = $_[1];
}
}
sub copyright {
marquesina("-- == (C) Doddy Hackman 2012 == --");
<stdin>;
}
#The End ?
Ejemplo de uso
r00t ~ # art.pl
#=============================================#
# ASCII Art 0.1 #
#---------------------------------------------#
# Written By Doddy H #
# Email: lepuke[at]hotmail[com] #
# Website: doddyhackman.webcindario.com #
#---------------------------------------------#
# Thanks to : reLlene,MARKO,explorer #
# The End ? #
#=============================================#
[+] Text : kacked
@ @ @ @@@@ @ @ @@@@@ @@@@
@ @ @ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @ @ @
@@ @ @ @ @@ @ @ @
@@ @ @ @ @@ @@@@ @ @
@ @ @ @ @ @ @ @ @ @
@ @ @@@@@ @ @ @ @ @ @
@ @ @ @ @ @ @ @ @ @ @
@ @ @ @ @@@@ @ @ @@@@@ @@@@
-- == (C) Doddy Hackman 2012 == --