Frivolous pursuit - automated game playing program

Paul McGuire ptmcg at austin.rr.com
Thu Sep 15 08:11:21 CEST 2005


My son showed me this Flash game, Orbit (there are *many* links on the
web out there for it, here's one for the Google-challenged:
http://uploads.ungrounded.net/250000/250408_orbit.swf), and it is
*addicting*.

Basically, you control a comet to traverse through the gravitational
fields of randomly placed planets.  Your only inputs are starting x,y
location and starting direction and speed, defined by clicking,
dragging, and releasing the mouse (imagine the click/mouseDown picks
the starting location, the drag pulls a rubberbanded line from that
spot, and the release/mouseUp begin's the comet's journey).

The simulation looks quite pretty, and I can visualize the physics and
math of the numerical simulation.  I've been able to reach Level 18,
that is up to 18 planets.  (Note - this program doesn't "solve" the
3-body or n-body problem, it simply numerically simulates the system
given a set of initial conditions.  There is no random behavior here -
the program retraces the exact same path given the same initial
conditions.)  The behavior is beautifully chaotic - small changes in
the initial conditions can have large changes in the simulation
results.

I'm stuck at Level 18, but I would like to write a Python program to
automate the trial-and-error playing of this game.  Of course, once I
have the technology to drive the game from a Python program, I can then
build in optimization logic (gradient-following, Newton-Raphson, neural
net, etc.), not just randomly click about the screen.

Any suggestions on how I might write a Python program to:
1. automatically click-drag in another window
2. detect the running and completion of the simulation (the panel
flashes when the comet collides with a planet)

-- Paul




More information about the Python-list mailing list