SHARE
TWEET

Untitled

a guest Aug 8th, 2012 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.mw.google.doodle;
  2.  
  3. import java.awt.AWTException;
  4. import java.awt.Robot;
  5. import java.awt.event.KeyEvent;
  6.  
  7. public class BasketBall2012 {
  8.   public static void main(String args[]) throws AWTException {
  9.     int duration = 0;
  10.     Robot r = new Robot();
  11.     r.delay(5000);
  12.     long startTime = System.currentTimeMillis();
  13.     while (duration < 25) {
  14.       r.keyPress(KeyEvent.VK_SPACE);
  15.       if ((duration = (int) (System.currentTimeMillis() - startTime) / 1000) <= 5) {
  16.         r.delay(400);
  17.       } else if (duration > 5 && duration < 10) {
  18.         r.delay(500);
  19.       } else if (duration >= 10 && duration < 17) {
  20.         r.delay(750);
  21.       } else if (duration >= 17) {
  22.         r.delay(850);
  23.       }
  24.       r.keyRelease(KeyEvent.VK_SPACE);
  25.     }
  26.   }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top