Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import argparse
- import time
- try:
- import pyautogui
- except ImportError:
- import pip
- pip.main(['install', 'pyautogui'])
- import pyautogui
- FIRST = (593, 495)
- SECOND = (728, 504)
- THIRD = (854, 504)
- FOURTH = (981, 495)
- FIFTH = (1101, 499)
- SIXTH = (1245, 484)
- SEVENTH = (1360, 499)
- REPEAT_SPEED_SLIDER = (1300, 664)
- REPEAT_SPEED_SLIDER_END = (1432, 661)
- OK_BUTTON_2 = (1059, 781)
- ROTATE_LEFT = (1499, 529)
- ROTATE_RIGHT = (1483, 579)
- ROTATE_180 = (1482, 632)
- MOVE_DOWN = (659, 632)
- DROP_PIECE = (654, 681)
- ADVANCED = (1469, 753)
- BACK = (951, 332)
- OPTIONS = (750, 599)
- COLORS = {
- 'yellow': 0,
- 'blue': 1,
- 'pink': 2,
- 'bright_blue': 3,
- 'white': 4,
- 'orange': 5,
- 'red': 6,
- 'green': 7
- }
- parser = argparse.ArgumentParser()
- parser.add_argument('color', help='thez color')
- args = parser.parse_args()
- assert args.color in COLORS, "Choose a different color: %r" % '|'.join(COLORS.keys())
- pyautogui.click(OPTIONS)
- time.sleep(0.2)
- pyautogui.click(ROTATE_LEFT)
- pyautogui.typewrite('z')
- time.sleep(0.1)
- pyautogui.click(ROTATE_RIGHT)
- pyautogui.typewrite('x')
- time.sleep(0.1)
- pyautogui.click(ROTATE_180)
- pyautogui.typewrite(['shift'])
- time.sleep(0.1)
- pyautogui.click(DROP_PIECE)
- pyautogui.typewrite(['up'])
- time.sleep(0.1)
- pyautogui.click(MOVE_DOWN)
- pyautogui.typewrite(['down'])
- pyautogui.moveTo(ADVANCED)
- pyautogui.click(ADVANCED)
- POSITIONS = [FIRST, SECOND, THIRD, FOURTH, FIFTH, SIXTH, SEVENTH]
- POSITIONS_COLORS = {
- FIRST: 'yellow',
- SECOND: 'green',
- THIRD: 'pink',
- FOURTH: 'blue',
- FIFTH: 'bright_blue',
- SIXTH: 'white',
- SEVENTH: 'red'
- }
- time.sleep(0.5)
- for position in POSITIONS:
- c = COLORS[args.color] + 8
- diff = c - COLORS[POSITIONS_COLORS[position]]
- if diff != 8:
- for i in xrange(diff):
- pyautogui.click(position)
- pyautogui.moveTo(REPEAT_SPEED_SLIDER)
- pyautogui.dragTo(REPEAT_SPEED_SLIDER_END, duration=1.5)
- pyautogui.click(OK_BUTTON_2)
- pyautogui.moveTo(BACK)
- time.sleep(0.2)
- pyautogui.click()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement