Guest User

Google Doodle Cheat: Basketball

a guest
Aug 8th, 2012
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import time
  4. import pyatspi
  5.  
  6. VK_CODE = { "spacebar" : 65 }
  7.  
  8. def press(x,t):
  9.     pyatspi.Registry.generateKeyboardEvent( VK_CODE[ x ], None, pyatspi.KEY_PRESS )
  10.     time.sleep( t )
  11.     pyatspi.Registry.generateKeyboardEvent( VK_CODE[ x ], None, pyatspi.KEY_RELEASE )
  12.  
  13. def play():
  14.         time.sleep( 1 )
  15.         s = time.time()
  16.  
  17.         while time.time() - s < 25:
  18.             if time.time() - s <= 4.7:
  19.                 press( "spacebar", .27 )    # free throw
  20.             elif time.time() - s <= 11:
  21.                 press( "spacebar", .48 )    # top of key
  22.             elif time.time() - s <= 16.7:
  23.                 press( "spacebar", .75 )    # 3 pointer
  24.             elif time.time() - s <= 18:
  25.                 press( "spacebar", 1 )      # moving 3 pointer
  26.             elif time.time() - s <= 22:
  27.                 press( "spacebar", 1.6 )    # long 3 pointer
  28.             else:
  29.                 press( "spacebar", 1.75 )   # swish
  30.  
  31. play()
Add Comment
Please, Sign In to add comment