Friday, July 31, 2015

LED es mi nuevo Hello World - Tiempo de Zonnon

Sabían que esto se venía...no? -;)

Aquí...tuve que tomar otro formato porque Zonnon no tiene un comando split como parte de su sintáxis...y también porque no estoy seguro de como crear un array de arrays y porque no pude hacer que mi procedimiento retorno un array para luego asignarlo a otro array -:(

Aún así...estoy bastante feliz con el resultado -:D

LED_Numbers.znn
module LED_Numbers;

var num, text, concat:string;
var leds:array 10 of string;
var led:array 3 of string;
var i, j, z, len, lenled:integer; 

begin
 leds[0]:=" _  ,| | ,|_| ,";
 leds[1]:="  ,| ,| ,";
 leds[2]:=" _  , _| ,|_  ,";
 leds[3]:="_  ,_| ,_| ,";
 leds[4]:="    ,|_| ,  | ,";
 leds[5]:=" _  ,|_  , _| ,";
 leds[6]:=" _  ,|_  ,|_| ,";
 leds[7]:="_   , |  , |  ,";
 leds[8]:=" _  ,|_| ,|_| ,";
 leds[9]:=" _  ,|_| , _| ,";
 write("Enter a number: ");readln(num);
 len:=num.Length;
 for j:=0 to len - 1 do
  i:=0;
  text:=leds[integer(num[j])-48];
  lenled:=text.Length;
  for z:= 0 to lenled - 1 do
   if text[z] # "," then
    concat:= concat + string(text[z]);
   else
    led[i]:=led[i] + concat;
    concat:="";
    i:= i + 1;
   end;
  end;
 end; 
 writeln(led[0]);
 writeln(led[1]);
 writeln(led[2]);
end LED_Numbers.

En fín...aquí hay algunas imagnes -;)



Saludos,

Blag.
Development Culture.

No comments: