Removed reading of incoming events bc why not
This commit is contained in:
parent
ebe6fab9c6
commit
72b8c6274b
13
async-bot.py
13
async-bot.py
|
@ -37,7 +37,6 @@ class AsyncBotManager:
|
|||
if a:
|
||||
self.difference[x + ox + (y + oy) * 1000] = l > 0
|
||||
|
||||
|
||||
async def listener(self):
|
||||
async with ClientSession() as http:
|
||||
async with http.get(f"{self.base}/api/initial-state") as req:
|
||||
|
@ -75,16 +74,10 @@ class AsyncBotManager:
|
|||
async with AsyncSimpleClient(http_session=http) as sio:
|
||||
await sio.connect(f"{self.base}/socket.io")
|
||||
while not self._shutdown:
|
||||
try:
|
||||
event, data = await sio.receive(0.1)
|
||||
if event not in ("full_state", "batched_bit_toggles"):
|
||||
print(bot_index, "!!!", event, data)
|
||||
except Exception:
|
||||
pass
|
||||
index, target = choice(list(self.difference.items()))
|
||||
index, expected = choice(list(self.difference.items()))
|
||||
y, x = divmod(index, 1000)
|
||||
curr = self.canvas.getpixel((x, y)) > 0 # type: ignore
|
||||
if curr != target:
|
||||
current = self.canvas.getpixel((x, y)) > 0 # type: ignore
|
||||
if current != expected:
|
||||
print(bot_index, "swap", x, y)
|
||||
await sio.emit("toggle_bit", {
|
||||
"index": index
|
||||
|
|
Loading…
Reference in New Issue