Skip to content

Instantly share code, notes, and snippets.

@addisoneee
Created April 5, 2014 21:09
Show Gist options
  • Save addisoneee/9998141 to your computer and use it in GitHub Desktop.
Save addisoneee/9998141 to your computer and use it in GitHub Desktop.
from autopy import key, bitmap
import time
import random
screenOld = bitmap.capture_screen()
q = 0
while(True):
screenNew = bitmap.capture_screen()
r = random.randint(1,2)
if (screenOld.to_string() == screenNew.to_string()):
q = q+1
if (r == 1):
key.toggle(key.K_UP,True)
#if (r):
# key.toggle(key.K_RIGHT,True)
if (q == 5):
key.toggle(key.K_DOWN,True)
q = 0
if (r == 2):
key.toggle(key.K_LEFT,True)
screenOld = screenNew
time.sleep(.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment