Results 1 to 12 of 12

Thread: [Unofficial] Scripting League

  1. #1
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default [Unofficial] Scripting League

    Taking notes from: http://villavu.com/forum/showthread.php?t=50949 I think it would be great to start something like this up again. And to even steal most of the setup...
    Quote Originally Posted by mixster View Post
    The emphasis on the problems is not to give hard tasks, but tasks that have plenty of room for improving their speed. As all skilled scripters will know, S[imba]'s main flaw is in its slow pace, so being able to take a slow function and speeding it up a lot is a vital ability for kick ass scripts.

    Points will be awarded for the first submissions and for the fastest scripts. As I am unsure of how many people will enter, I can't give exact numbers, but probably the points will be distributed for the first half of entries and for the fastest third of entries, with the fastest script getting a bit more points than the first entry.

    Everyone is open to submit a script to solve the problem and you are allowed 2 submissions, with the first being completely ignored if you send in a second. 3rd submissions onwards will not be counted, so don't be too rash in deciding to submit. If a script doesn't work, then it can't get any points, but S[imba] version based changes will be corrected as needed.

    All entries are to be PM'd to me. Unless stated, you are fine with me publishing your script for each other to learn from. If you disagree, please say so in the PM, however you must then consent to me being able to send it to an independent judge in case anyone thinks I'm being biased or if I am unable to judge for whatever reason.

    Plugins are not allowed at all. However, you may rely on external sauces as long as they accessible from within S[imba] - this is as much about ingenuity as it is about scripting ability. Likewise, all scripts must be S[imba] scripts and be in the form of a function.

    It will hopefully run a while. Any questions, ask else try to leave the topic spam free - no need to tell me you are planning to participate as I'll get the idea when you send in a submission
    As for a prize... Get at least 5 participants a week and I will personally start funding these weekly with 10m to a winner and an additional 15m for best score of the month. Also, I am more than happy (and fully willing) to bring in other competent scripters as judges if they so wish and they do not compete in the given weeks they judge (or at least they can't win any prize that week).

    As for a first task: you will create a function as such:
    Simba Code:
    function Typo(str: String; acc: extended): string;
    This function will return str with each individual character having a chance at a typo (acc refers to the chance 1=100% of no typo). A typo can either be an additional nearby character being hit instead of OR in addition to. IE: a nearby character to g would be one of "f,t,y,h,b,v". This will include any non-shifted character on a typical qwerty keyboard:
    Therefore, a possible response to Typo('Hello, what is your wc level?', 0.9) could be 'Hello, wehat is your wc lebel?'. There could be more typos or less, 0.9 simply means there is a 10% chance of any individual character having said typo, and not that each tenth character will.

    Good luck and I hope many participate!

    "To script or not to script, that is the question. Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles."

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Thanks turp (string to tsa) and jani (tsa pos) for the 2 functions...

    Simba Code:
    function TSAPosition(TSA: TStringArray; text: string): Integer;
    var
      h: Integer;
    begin
      h := High(TSA);
      for Result := 0 to h do
         if (text = TSA[Result]) then
          Exit;
      Result := -1;
    end;
    function Typo(str: String; odds: Integer): string;
    var
      Keys:T2DStringArray;
      str2, keylist:TStringArray;
      tempr:string;
      posi, i:Integer;
    begin
      KeyList := ['q','w','e','r','t','y','u','i','o','p','[',']','a','s','d','f','g','h','j','k','l',';','z','x','c','v','b','n','m',',','.','/','?','!','1','2','3','4','5','6','7','8','9','0'];
      SetLength(keys, 44);
      Keys[0] := ['1','2','w','s','a']; //q
      Keys[1] := ['2','3','e','d','s','a']; //w
      Keys[2] := ['3','4','r','f','d','s','w']; //e
      Keys[3] := ['e','4','5','t','f','d']; //r
      Keys[4] := ['r','4','5','6','y','g','f']; //t
      Keys[5] := ['t','5','6','7','u','h','g']; //y
      Keys[6] := ['y','6','7','8','i','j','h']; //u
      Keys[7] := ['u','7','8','9','o','k','j']; //i
      Keys[8] := ['i','8','9','0','p','l','k']; //o
      Keys[9] := ['o','9','0','-','[',';','l']; //p
      Keys[10] := ['p','0','-','=',']']; // [
      Keys[11] := ['[','-','=','\']; // ]
      Keys[12] := ['q','w','s','x','z','s','w']; //a
      Keys[13] := ['a','q','w','e','d','x','z']; //s
      Keys[14] := ['s','w','e','r','f','c','x']; //d
      Keys[15] := ['d','e','r','t','g','v','c']; //f
      Keys[16] := ['f','r','t','y','h','b','v']; //g
      Keys[17] := ['g','t','y','u','j','n','b']; //h
      Keys[18] := ['h','y','u','i','k','m','n']; //j
      Keys[19] := ['j','u','i','o','l',',','m']; //k
      Keys[20] := ['k','i','o','p',';','.',',']; //l
      Keys[21] := ['l','o','p','[','/','.',',']//;
      Keys[22] := ['a','s','d','x','c']; //z
      Keys[23] := ['z','a','s','d','c']; //x
      Keys[24] := ['x','s','d','f','v']; //c
      Keys[25] := ['c','d','f','g','b']; //v
      Keys[26] := ['v','f','g','h','n']; //b
      Keys[27] := ['b','g','h','j','m']; //n
      Keys[28] := ['n','h','j','k',',']; //
      Keys[29] := ['m','j','k','l','.']; //,
      Keys[30] := [',','k','l',';','/']; //.
      Keys[31] := ['.','l',';']; // /
      Keys[32] := ['.','l',';']; // ?
      Keys[33] := ['q','w','2']; // !
      Keys[34] := ['q','w','2']; // 1
      Keys[35] := ['1','q','w','3']; // 2
      Keys[36] := ['2','w','e','4']; // 3
      Keys[37] := ['3','e','r','5']; // 4
      Keys[38] := ['4','r','t','6'] //5
      Keys[39] := ['5','t','y','7'] //6
      Keys[40] := ['6','y','u','8'] //7
      Keys[41] := ['7','u','i','9'] //8
      Keys[42] := ['8','i','o','0'] //9
      Keys[43] := ['9','o','p','-'] //0
      SetLength(Str2, Length(Str));
      For i := 1 to Length(Str) do
        str2[i-1] := Str[i];
      for i := 0 to high(str2) do
      begin
        posi := TSAPosition(KeyList, str2[i])
        case random(80) of
          0..1: tempr := tempr + Keys[posi][Random(high(Keys[posi]))];
          2..100: tempr := tempr + str2[i];
        end;
      end;
      result := tempr;
    end;
    begin
      Writeln(typo('this function has pissed me off for the last time', 1));
    end.

    any1 is free to use this for this competition just fix the occasional range check errors...

    5 output results:

    Code:
    this function has piwsed me off for the last time
    this function has piseed me off for the last time
    this functiln haw pissed me off for the last time
    this functiog has pissed ke off fpr the last time
    this function has pissed me off for the last time
    this function has pissed me off for the last tine

  3. #3
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Since RJJ has done it, can I submit one that does it in fewer lines?

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Sin View Post
    Since RJJ has done it, can I submit one that does it in fewer lines?
    Im not submitting since TSA pos and turps thing ins't mine

    Also the range checks were just getting me angry and I don't feel like fixing them :s

  5. #5
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Should have ordered it as "ETAOINSHRDLUCMFWYPVBGKJQXZ" Rjj. = faster.

  6. #6
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    Should have ordered it as "ETAOINSHRDLUCMFWYPVBGKJQXZ" Rjj. = faster.
    meh takes 15 ms to do

  7. #7
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    Quote Originally Posted by Sin View Post
    Since RJJ has done it, can I submit one that does it in fewer lines?
    Technically he's not submitting it and I'm asking for private submissions for the sanctity of lack of cheating anyway. And besides, passing a 1 to it should be 100% accuracy = no typos, so even his example doesn't work.

  8. #8
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Inb4 an auto-responder is born.

    Did I use "inb4" correctly? Never used that before. :P

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  9. #9
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Inb4 an auto-responder is born.

    Did I use "inb4" correctly? Never used that before. :P
    (inb4 was used correctly, but the whole sentence is supposed to be all one word for some reason)
    What do you mean typos would be great in an auto-responder? That wasn't my idea at all :3

    Don't worry.. There are some ideas for future weeks as well that have applicable use. Much more difficult and more applicable use...

  10. #10
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    This is a fun project indeed.

    For the fun of this project I created a nifty way to typo pretty darn humanly. Could still use some optimization though but it runs in about 700ms (well actually the setup takes 700 ms - the rest is pretty fast)!

    I encourage others to look into this, as it can help expand your knowledge and/or refine your in-place skills.

    Cheers,
    Le Jingle

    P.S. Probably won't submit as I suppose I'm not intended to, but I'm here later down the road if needed for other purposes! :]

  11. #11
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    This is a fun project indeed.

    For the fun of this project I created a nifty way to typo pretty darn humanly. Could still use some optimization though but it runs in about 700ms (well actually the setup takes 700 ms - the rest is pretty fast)!

    I encourage others to look into this, as it can help expand your knowledge and/or refine your in-place skills.

    Cheers,
    Le Jingle

    P.S. Probably won't submit as I suppose I'm not intended to, but I'm here later down the road if needed for other purposes! :]
    I'm a little curious about the technique you would have chosen to go. I know what I would do at least

    Also, I could possibly use some other future ideas as it was pointed out to me by another that my ideas may be a little too hard for the average member, if anything you have comes to mind (via pm so no ideas are handed out publicly )

  12. #12
    Join Date
    May 2012
    Location
    Wisconsin, USA
    Posts
    105
    Mentioned
    1 Post(s)
    Quoted
    47 Post(s)

    Default

    I'd recommend that if this is going to be a regular thing, it should have it's own little sub-forum.

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
  •