-
-
Save ckwang8128/3298514 to your computer and use it in GitHub Desktop.
Google Basketball Doodle Solution (Java)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Robot; | |
| import java.awt.AWTException; | |
| import java.awt.event.KeyEvent; | |
| public class BBall { | |
| public static void main(String[] args) throws AWTException { | |
| Robot rob = new Robot(); | |
| int delay[] = { 300, 220, 840, 1000, 1150, 1500}; | |
| int repeat[]= { 3, 2, 5, 5, 4, 2}; | |
| rob.delay(2000); | |
| rob.mousePress(KeyEvent.BUTTON1_MASK); | |
| rob.delay(100); | |
| rob.mouseRelease(KeyEvent.BUTTON1_MASK); | |
| rob.delay(500); | |
| for(int i=0; i<delay.length; i++) { | |
| for(int j=0; j<repeat[i]; j++) { | |
| rob.keyPress(KeyEvent.VK_SPACE); | |
| rob.delay(delay[i]); | |
| rob.keyRelease(KeyEvent.VK_SPACE); | |
| rob.delay(440); //450 | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment