Results 1 to 10 of 10

Thread: HTS Programming 2 / Morse2ABC

  1. #1
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default HTS Programming 2 / Morse2ABC

    Aya, I wasted my time on copying morse code so I decided I would post this script
    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.
    Last edited by mastaraymond; 05-31-2009 at 06:23 PM.
    Verrekte Koekwous

  2. #2
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    lol you have wayyy to much time lol.

    T~M

  3. #3
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    So that's what Raym0nd` was doing in Rome instead of getting us pictures


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  4. #4
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by The Man View Post
    lol you have wayyy to much time lol.

    T~M
    Took me 40 mins max :-(
    Verrekte Koekwous

  5. #5
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

  6. #6
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Make ABC2Morse too? x[]
    Ce ne sont que des gueux


  7. #7
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by EvilChicken! View Post
    xD

    Now show one situation where this could be useful in SCAR.
    HTS Programming challenge 2!! <---

    And nah, not going to make a reverse.. Way to much work.
    Verrekte Koekwous

  8. #8
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mastaraymond View Post
    HTS Programming challenge 2!! <---

    And nah, not going to make a reverse.. Way to much work.
    I lied, I made ABC2Morse <-- I has way to much free time on my hands.
    Verrekte Koekwous

  9. #9
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Post!
    Ce ne sont que des gueux


  10. #10
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    Post!
    Mainpost
    Verrekte Koekwous

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •