Results 1 to 5 of 5

Thread: Curveball challenge!

  1. #1
    Join Date
    Oct 2006
    Location
    West Coast
    Posts
    67
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Curveball challenge!

    Most of you have probably at some point played the curveball game. It's been around for a few years so it's nothing new.

    http://www.freegames.ws/games/free_o...ame/3dpong.swf

    There are apparently 10 levels to the game, each with increasing difficulty, and you only get so many lives. The challenge is simple, create a SIMBA script which can play the game, and hopefully, beat it.

    You can download the .swf file and convert it to an .exe (use google) so you can run it from your desktop, which you can then resize. The game window must be 1000x750 while the script is running.

    Although simple at first, the speed of the ball in the last few levels can make tracking it on time incredibly difficult.

    Here is the script i created. It tracks the ball simply by searching for a color, and monitors the speed of the ball (distance changed between scans) to predict it's movement and keep the mouse slightly ahead. However, it doesn't seem to be too successful, and is still stuck at lv 9.

    WARNING: Once the script starts it doesn't stop, and takes complete control of your mouse. An easy way to stop it is to just alt-f4 out of the game window and the script should stop, or hit "F2" if you can. Due to the exponential movement of the mouse as the speed increases, things can get wild.
    Code:
    program Untitled;
    {$I SRL/SRL.scar}
    
    var
      X, Y, oX, oY, dist, m, b : Integer;
    
    procedure MouseToColor;
    begin
      if (X <> oX) and (oX <> 0) then
      begin
        m := (Y-oY)/(X-oX);
        b := Y - (m*X);
        dist := Distance(X,Y,oX,oY);
        dist := round(pow(dist,12/10));              //modify mouse position based on speed
        if oX - X < 0 then
        begin
            oX := X;
            oY := Y;
            X := X + (dist/round((Sqrt(1 + Sqr(m)))));
        end
        else
        begin
            oX := X;
            oY := Y;
            X := X - (dist/round((Sqrt(1 + Sqr(m)))));
        end;
        Y := (m*X) + b;
      end;
      MoveMouse(X,Y);
      ClickMouse(X,Y,1);
    end;
    
    procedure TryFindColor;
    begin
      if FindColor(X,Y,16777215,76,113,923,678)then   //rectangle around play area
        MouseToColor;
    end;
    
    begin
      SetupSRL;
      oX:= 1;
      oY:= 1;
      repeat
        TryFindColor;
      until(False);
    end.
    Good luck! I'm interested in what people come up with.

    EDIT: Huge script error. Fixed now.
    Last edited by matviy; 11-14-2011 at 05:22 AM.

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    IIRC, there are a lot more than 10 levels. I made a script for this and it was only like 4 lines (a loop).
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  3. #3
    Join Date
    Oct 2006
    Location
    West Coast
    Posts
    67
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    IIRC, there are a lot more than 10 levels. I made a script for this and it was only like 4 lines (a loop).
    Code:
    program Untitled;
    {$I SRL/SRL.scar}
    var
      X, Y : Integer;
    begin
      SetupSRL;
      repeat
      if FindColor(X,Y,16777215,76,113,923,678)then
          MoveMouse(X,Y);
      until(False);
    end.
    This will work. From my experience it will get you to about level 8 but will have a hard time keeping up from there. It may depend on the speed of your machine, but a good script should be efficient even on slower machines.
    Last edited by matviy; 11-14-2011 at 03:17 AM.

  4. #4
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Protip: Use "until(IsKeyDown(VK_DOWN));" so you can turn it off easily
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  5. #5
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Camo Developer View Post
    Protip: Use "until(IsKeyDown(VK_DOWN));" so you can turn it off easily
    I made a script ( < 30 lines ) and I don't think it made it past level 8.

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
  •