Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -171,8 +171,8 @@ async def websocket_endpoint(websocket: WebSocket, personality: str):
|
|
| 171 |
user_playing['rodent'] -= 1
|
| 172 |
|
| 173 |
|
| 174 |
-
@app.websocket("/patricia")
|
| 175 |
-
async def websocket_endpoint(websocket: WebSocket):
|
| 176 |
await websocket.accept()
|
| 177 |
|
| 178 |
user_playing['total'] += 1
|
|
@@ -180,6 +180,10 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
| 180 |
|
| 181 |
stockfish = EngineChess([f"./engines/Patricia/patricia"])
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
async def read_from_socket(websocket: WebSocket):
|
| 184 |
async for data in websocket.iter_text():
|
| 185 |
print(f"Patricia Client: {data}")
|
|
|
|
| 171 |
user_playing['rodent'] -= 1
|
| 172 |
|
| 173 |
|
| 174 |
+
@app.websocket("/patricia-{elo}")
|
| 175 |
+
async def websocket_endpoint(websocket: WebSocket, elo: str):
|
| 176 |
await websocket.accept()
|
| 177 |
|
| 178 |
user_playing['total'] += 1
|
|
|
|
| 180 |
|
| 181 |
stockfish = EngineChess([f"./engines/Patricia/patricia"])
|
| 182 |
|
| 183 |
+
await asyncio.sleep(0.5)
|
| 184 |
+
|
| 185 |
+
stockfish.put(f"setoption name UCI_Elo value {elo}")
|
| 186 |
+
|
| 187 |
async def read_from_socket(websocket: WebSocket):
|
| 188 |
async for data in websocket.iter_text():
|
| 189 |
print(f"Patricia Client: {data}")
|