Re: Morse
- Posted by petelomax Sep 08, 2014
- 1530 views
ghaberek said...
Wikipedia has a pretty comprehensive list of Letters, numbers, punctuation, prosigns and non-English variants for Morse code, which is what I used as a reference.
I thought it might be "fun" to encode that tree picture thing, see what it turned out like.
sequence morse = repeat(0,255) morse[' '] = " " procedure ext(string root, object data) object dot, dash if sequence(data) then {data,dot,dash} = data ext(root,data) ext(root&'.',dot) ext(root&'-',dash) elsif data!=0 then morse[data] = root -- printf(1,"morse['%c']:=%s\n",{data,root}) end if end procedure ext("",{0,{'E',{'I',{'S',{'H','5','4'}, {'V',{0,{0,0,'$'},0},'3'}}, {'U','F',{0,{0,'?','_'},'2'}}}, {'A',{'R',{'L','&',{0,'"',0}}, {0,{'+',0,'.'},0}}, {'W',{'P',0,{0,'@',0}}, {'J',0,{'1','\'',0}}}}}, {'T',{'N',{'D',{'B',{'6',0,'-'},'='}, {'X','/',0}}, {'K',{'C',0,{0,';','!'}}, {'Y',{'(',0,')'},0}}}, {'M',{'G',{'Z','7',{0,0,','}}, 'Q'}, {'O',{0,{'8',':',0},0}, {0,'9','0'}}}}})
Amazingly it works. (Obviously I use Phix so you might need to change that {data,dot,dash} = data to dash = data[3] dot = data[2] data = data[1], not tested on OpenEu.)
I think the word you're looking for is "ugly".
Pete