Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/Perl/anim/fonction.pl

(Deskargatu)
#!/usr/bin/perl -w
use strict;


$" = "";
my ($char,$line,$debut,$fin);
my $max = 7; #Nombre max de caracteres pour chaque numero         
my  @temp;
my @nums_t = ( #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
	   );
	   
$|++;	   
 
 
#Fonction Genum    #############################################################
# Entree: Numero a charger.                                    																									  #
# Sortie: Array (line) (colonne) contenant le caractere a ecrire.																					  #
# 																																												  #
																																													  #
sub genum($)
{
$_ = shift;
undef @temp;
	$line = 0;
	
	#chaque numero
		  foreach(@{$nums_t[$_]})
		   {
			   $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;
}																																												       #
#Fin de fonctio genum############################################################
##########################################################################
#exemple: genum(1) retourne l array contenant les \# correspondants au numero 1...
#

sub genfullnum
{
	my @numero;
	for (0 .. 9) { @{$numero[$_]} = genum($_) or die("ERROR loading genum(1)\n");}
	return @numero;
}
return 1;