Skip to content

Instantly share code, notes, and snippets.

@snluu
Created August 8, 2012 17:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save snluu/3296832 to your computer and use it in GitHub Desktop.
Save snluu/3296832 to your computer and use it in GitHub Desktop.
Java code to play google doodle for you
Robot r = new Robot();
System.out.println("Start!");
Thread.sleep(2000); // give yourself some margin to switch window
int[] times = { 1, 5, 4, 4, 1, 3, 2 }; // number of shots for each distance
int[] delays = { 400, 400, 575, 820, 850, 1150, 1350 }; // time holding the ball
int[] delays2 = { 200, 650, 700, 600, 400, 450, 400 }; // time waiting for a new ball
for (int i = 0; i < times.length; i++)
for (int j = 0; j < times[i]; j++) {
r.keyPress(KeyEvent.VK_SPACE);
r.delay(delays[i]);
r.keyRelease(KeyEvent.VK_SPACE);
r.delay(delays2[i]);
}
System.out.println("Finish!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment