public
anonymous / playcanoe.py
Created

Slalom canoe

  • Download Gist
playcanoe.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import time
import win32api, win32con
 
VK_CODE = {'left_arrow':0x25,
'spacebar':0x20,
'right_arrow':0x27}
 
def press(x):
win32api.keybd_event(VK_CODE[x], 0,0,0)
win32api.keybd_event(VK_CODE[x],0 ,win32con.KEYEVENTF_KEYUP ,0)
 
 
def go(t):
s = time.time()
while time.time() - s < t:
press("left_arrow")
press("right_arrow")
 
def play():
time.sleep(2)
go(15)
 
 
play()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.