- 安装相应库
- 环境
python 2.7
库:PyUserInput模块
3.玩游戏网址:http://www.4399.com/flash/109504_1.htm
搜狗浏览器小屏玩
4.代码如下
import pymouse,os,sys
import time
import win32api
from pymouse import PyMouse
from pykeyboard import PyKeyboard
m = PyMouse()
k = PyKeyboard()
def move(n, a, buffer, c):
if(n == 1):
time.sleep(0.5)
print(a,"->",c)
if (a== 'a' and c=='b'):
m.move(100,365)
m.click(100,365,1,1)
time.sleep(0.5)
m.move(300, 365)
m.click(300,365,1,1)
elif (a == "a" and c == "c"):
m.move(100, 365)
m.click(100, 365, 1, 1)
time.sleep(0.5)
m.move(500, 365)
m.click(500, 365, 1, 1)
elif (a == "b" and c == "a"):
m.move(300, 365)
m.click(300, 365, 1, 1)
time.sleep(0.5)
m.move(100, 365)
m.click(100, 365, 1, 1)
elif (a == "b" and c == "c"):
m.move(300, 365)
m.click(300, 365, 1, 1)
time.sleep(0.5)
m.move(500, 365)
m.click(500, 365, 1, 1)
elif (a == "c" and c == "a"):
m.move(500, 365)
m.click(500, 365, 1, 1)
time.sleep(0.5)
m.move(100, 365)
m.click(100, 365, 1, 1)
elif (a == "c" and c == "b"):
m.move(500, 365)
m.click(500, 365, 1, 1)
time.sleep(0.5)
m.move(300, 365)
m.click(300, 365, 1, 1)
return
move(n-1, a, c, buffer)
move(1, a, buffer, c)
move(n-1, buffer, a, c)
move(9, "a", "b", "c")
5结果