Old stuff/Perl/anim/num_02.pl
(Deskargatu)
#!/usr/bin/perl -w
use strict;
my ($char,$line,$debut,$fin);
my $max = 6; #Nombre max de caracteres pour chaque numero
my @temp;
my @nums = ( #emplacements des diezes... (de 0 a 4)
["1-3","0 4","0 4","0 4","1-3"] ,#0
["1-2","0 2","2","2","0-4"], #1
["1-2","0 3","3","1","0-4"], #2
["1-3","0 4","2-3","0 4","1-3"], #3
["3","2-3","1 3","0-4","3"], #4
["0-4","0","1-3","4","0-3"], #5
["1-4","0","0 2-3","0 4","0-3"], #6
["0-3","4","3","2","1"], #7
["1-3","0 4","2","0 4","1-3"], #8
["1-3","0 4","1-4","4","0-3"] #9
);
$|++;
sub genum($)
{
$_ = shift;
undef @temp;
$line = 0;
#chaque numero
foreach(@{$nums[$_]})
{
$char = 0;
foreach (split)
{
while (!/^$char/) { $temp[$line][$char] = " "; $char++; }
if (/-/) { ($debut,$fin) = split("-"); for ($debut .. $fin) {$temp[$line][$char] = "#"; $char++; } next;}
else { $temp[$line][$char] = "#"; $char++; next;}
}
while ($char < $max) { $temp[$line][$char] = " "; $char++; }
$line++;
}
return @temp;
}
$" = "";
print "\n\n\n";
my @numero;
for (0 .. 9) { @{$numero[$_]} = genum($_) or die("ERROR loading genum(1)\n");}
undef @temp;
for (0 .. 4)
{
for $debut(0 .. 9) { push (@{$temp[$_]} , @{$numero[$debut][$_]}); }}
print "@{$_}\n" for @temp;