PDA

View Full Version : Curveball challenge!



matviy
11-13-2011, 11:54 PM
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_online_games/pong_game/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.


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.

Sex
11-14-2011, 02:10 AM
IIRC, there are a lot more than 10 levels. I made a script for this and it was only like 4 lines (a loop).

matviy
11-14-2011, 03:12 AM
IIRC, there are a lot more than 10 levels. I made a script for this and it was only like 4 lines (a loop).


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.

Kyle Undefined
11-14-2011, 04:25 AM
Protip: Use "until(IsKeyDown(VK_DOWN));" so you can turn it off easily ;)

Camaro'
11-15-2011, 03:54 AM
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.