SCAR Code:
program loveu;
function ABC2Morse(abc : string) : string;
var
MorseArr : TStringArray;
ABCString : String;
I : integer;
begin;
ABCString := 'abcdefghijklmnopqrstuvwxyz0123456789 ';
abc := lowercase(abc);
MorseArr := ['.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.',
'...','-','..-','...-','.--','-..-','-.--','--..','-----','.----','..---','...--','....-','.....','-....','--...','---..','----.','/'];
For i := 1 to length(AbC) do
if pos(abc[i],ABCString) > 0 then
result := result + MorseArr[Pos(Abc[i],ABCString)-1] + ' '
else
Writeln('WTF IS ' + ABC[i] + ' IN MORSE CODE!!?');
SetLength(result,length(result)-1);
end;
function Morse2ABC(morse : string) : string;
var
x : TStringList;
i : integer;
begin;
x := TStringList.create;
x.DelimitedText := Replace(morse,'/','/ ');
x.Delimiter := ' ';
for i := 0 to x.count - 1 do
case x.strings[i] of
'/' : result := result + ' ';
'.-' : result := result + 'a';
'-...' : result := result + 'b';
'-.-.' : result := result + 'c';
'-..' : result := result + 'd';
'.' : result := result + 'e';
'..-.' : result := result + 'f';
'--.' : result := result + 'g';
'....' : result := result + 'h';
'..' : result := result + 'i';
'.---' : result := result + 'j';
'-.-' : result := result + 'k';
'.-..' : result := result + 'l';
'--' : result := result + 'm';
'-.' : result := result + 'n';
'---' : result := result + 'o';
'.--.' : result := result + 'p';
'--.-' : result := result + 'q';
'.-.' : result := result + 'r';
'...' : result := result + 's';
'-' : result := result + 't';
'..-' : result := result + 'u';
'...-' : result := result + 'v';
'.--' : result := result + 'w';
'-..-' : result := result + 'x';
'-.--' : result := result + 'y';
'--..' : result := result + 'z';
'-----' : result := result + '0';
'.----' : result := result + '1';
'..---' : result := result + '2';
'...--' : result := result + '3';
'....-' : result := result + '4';
'.....' : result := result + '5';
'-....' : result := result + '6';
'--...' : result := result + '7';
'---..' : result := result + '8';
'----.' : result := result + '9';
else
Writeln('ERRORD @ ' + x.strings[i]);
end;
end;
var
x,y,realx,cornerx,cornery: integer;
LastX : integer;
Str : String;
Morse : string;
begin
Writeln('Morsing -> Raymond is tha uber 1091290');
Morse := ABC2Morse('Raymond is tha uber 1091290');
Writeln('Morsed: ' + Morse);
Writeln('Reversed: ' + Uppercase(morse2abc(morse)));
Lastx := 0;
realx := -1;
if not FindColor(cornerx,cornery,0,0,300,500,500) then
writeln('Didn''t find the box');
Writeln('(' + inttostr(cornerx) + ',' + inttostr(cornery) + ')');
for y := cornery to cornery + 29 do
begin;
for x := cornerx to cornerx + 99 do
begin;
inc(realx);
if GetColor(x,y) = clwhite then
begin;
Str := Str + chr(realx-lastx);
Lastx := realx;
end;
end;
end;
Writeln(str);
Writeln(uppercase(Morse2ABC(str)));
end.