Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/Perl/anim/fonction_num.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 @chars_t = ( #emplacements des chars ... (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
	
 		["2","1 3","1 3","0-4","0 4"], 				#A = 10
		["0-3","0 4","0-3","0 4","0-3"], 			#B = 11
		["1-3","0 4","0","0 4","1-3"], 				#C = 12
		["0-2","0 3","0 4","0 3","0-2"], 			#D = 13
		["0-4","0","0-2","0","0-4"], 				#E = 14
		["0-4","0","0-2","0","0"], 					#F = 15
		["1-3","0","0 2-4","0 4","1-3"], 			#G = 16
		["0 4","0 4","0-4","0 4","0 4"], 			#H = 17
		["0-4","2","2","2","0-4"], 					#I = 18
		["0-4","2","3","0 4","1-3"], 				#J = 19
		["0 4","0 3","0-2","0 3","0 4"], 			#K = 20
		["0","0","0","0","0-4"], 						#L = 21
		["0 4","0-1 3-4","0 2 4","0 4","0 4"], 	#M = 22
		["0 3-4","1 4","0 2 4","0 3-4","0 4"], 	#N = 23
		["1-3","0 4","0 4","0 4","1-3"], 				#0 = 24
		["0-3","0 4","0-3","0","0"], 				#P = 25
		["2","1 3","0 4","0 3","1-2 4"], 			#Q = 26
		["0-3","0 4","0-3","0 3","0 4"], 			#R = 27
		["1-4","0","1-3","4","0-3"], 				#S = 28
		["0-4","2","2","2","2"], 						#T = 29
		["0 4","0 4","0 4","0 4","1-3"], 			#U = 30
		["0 4","0 4","1 3","1 3","2"], 				#V = 31
		["0 4","0 4","0 2 4","0 2 4","1-3"], 	#W = 32
		["0 4","1 3","2","1 3","0 4"], 				#X = 33
		["0 4","1 3","2","1","0"], 					#Y = 34
		["0-2 4","3","2","1","0 2-4"] 				#Z = 35
		
		);	   
 
 
#Fonction Genum    #############################################################
# Entree: Numero a charger.                                    																									  #
# Sortie: Array (line) (colonne) contenant le caractere a ecrire.																					  #
# 																																												  #
																																													  #
sub genchar($)
{
undef @temp;
$_ = shift;
	$line = 0;
	
	#chaque numero
		  foreach(@{$chars_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 genfullchar
{
	my @numero;
	for (0 .. 35) { @{$numero[$_]} = genchar($_) or die("ERROR loading genum(1)\n");}
	return @numero;
}

return 1;