feat: get data for disconnects, abstracted tournaments

This commit is contained in:
2025-12-08 22:52:10 -05:00
Unverified
parent f1cfe7e344
commit 8444bb70f4
5 changed files with 267 additions and 179 deletions

View File

@@ -24,12 +24,15 @@ async def gameloop(socket):
if (message[1] == "WINS") | (message[1] == "LOSS") | (message[1] == "DRAW") | (message[1] == "TERMINATED"):
print(message[0] + ":" + message[1])
player.reset()
await socket.send("READY")
case "OPPONENT":
# Opponent has gone; calculate next move
col = player.calculate_move(message[1])
await socket.send(f"PLAY:{col}") # Send your move to the sever
case "TOURNAMENT":
if message[1] == "END":
await socket.send("READY")
case "ERROR":
print(f"{message[0]}: {':'.join(message[1:])}")