from CodeWar.Utils import CodeWar playernum = 1 # 玩家人数(创建房间需要) row = 10 # (创建房间需要 最大不超过100) col = 10 # (创建房间需要 最大不超过100) roomtoken = '' # 加入房间需要 chrome = '' # 对于Windows用户可能需要填写Chrome安装路径.../chrome.exe username = '******' password = '******' email = 'test@test' url = '127.0.0.1' port = '52333' if __name__ == '__main__': my = CodeWar(url, port, username, password, email, chrome) # a.register() # 注册 while not my.run( roomtoken=roomtoken, playernum=playernum, row=row, col=col): time.sleep(3) # 游戏主循环 move操作延时不要低于100ms 操作会累积 # 获取初始位置(基地) my.isStart() x, y = my.getBase() # 获取地图大小 row, col = my.getMapSize() print(row, col) direction = 1 MapUnit = my.MapUnit
roomtoken = '' # 账号及服务器设置 (C) chrome = '' # 对于Windows用户可能需要填写Chrome安装路径.../chrome.exe username = '******' password = '******' email = 'test@test' url = '127.0.0.1' port = '52333' if __name__ == '__main__': # 此处不需要修改 my = CodeWar(url=url, port=port, username=username, password=password, email=email, chrome=chrome, roomtoken=roomtoken, playernum=playernum, row=row, col=col, barback=barback, portal=portal, barrier=barrier) # a.register() # 注册 while not my.run(): time.sleep(3) # 打印基本信息 my.info() # 游戏主循环 move操作延时不要低于100ms 操作会累积 # 获取初始位置(基地) my.isStart() x, y = my.getBase() # 获取地图大小
chrome = '' # 对于Windows用户可能需要填写Chrome安装路径.../chrome.exe username = '******' password = '******' email = 'test' url = '127.0.0.1' port = '52333' if __name__ == '__main__': # 以下不需要修改 my = CodeWar(url=url, port=port, username=username, password=password, email=email, chrome=chrome, roomtoken=roomtoken, playernum=playernum, row=row, col=col, barback=barback, portal=portal, barrier=barrier) # 以上不需要修改 # a.register() # 注册 while not my.run(): time.sleep(3) # 获取初始位置(基地) a.isStart() x, y = a.getBase()
from CodeWar.Utils import CodeWar playernum = 1 # 玩家人数(创建房间需要) row = 30 # (创建房间需要 最大不超过100) col = 30 # (创建房间需要 最大不超过100) roomtoken = '1c1ad9e26182f690938f670332e5ccd0' # 加入房间需要 chrome = '' # 对于Windows用户可能需要填写Chrome安装路径.../chrome.exe username = '******' password = '******' email = 'test' url = '127.0.0.1' port = '52333' if __name__ == '__main__': a = CodeWar(url, port, username, password, email, chrome) # a.register() # 注册 a.run(roomtoken=roomtoken, playernum=1, row=30, col=30) # 获取初始位置(基地) a.isStart() x, y = a.getBase() # 获取地图大小 row, col = a.getMapSize() while True: # 游戏已结束 if not a.isStart(): a.getScoreBoard() a.leave() break
import time import random from CodeWar.Utils import CodeWar # 账号及服务器设置 (C) chrome = '' # 对于Windows用户可能需要填写Chrome安装路径.../chrome.exe username = '******' password = '******' email = 'test' url = '127.0.0.1' port = '52333' if __name__ == '__main__': # 此处不需要修改 my = CodeWar(url=url, port=port, username=username, password=password, email=email, chrome=chrome) my.register()