Skip to content

Instantly share code, notes, and snippets.

@swapi
Created August 8, 2012 13:47
Show Gist options
  • Save swapi/3295140 to your computer and use it in GitHub Desktop.
Save swapi/3295140 to your computer and use it in GitHub Desktop.
Beat the Google doodle
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class TestRobot {
public static void main(String args[]) throws Exception {
Robot r = new Robot();
int sleep = 500;
int i = 0;
for(;;) {
r.keyPress(KeyEvent.VK_SPACE);
Thread.sleep(sleep);
r.keyRelease(KeyEvent.VK_SPACE);
if(i > 15) sleep = 700;
if(i > 25) sleep = 800;
i++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment