python-chess
python-chess copied to clipboard
How to communicate with a remote chess enigne?
hello,
I got a remotely running UCI chess engine (inside a docker container), however I have no idea how to communicate with it using the code snippet provided in the docs. I've read the documentation on asyncio, but I didn't manage to find out how to handle the connection, especially that engine.initalize() and engine.ping() are abstract.
how do I send, for example, 'uci', to the remote process?
import asyncio
import asyncssh
import chess
import chess.engine
import chess.variant
async def main() -> None:
async with asyncssh.connect("bugdothouse_fairy-stockfish", username='root', password='password', known_hosts=None) as conn:
channel, engine = await conn.create_subprocess(chess.engine.UciProtocol, "/stockfish/stockfish")
await engine.initialize()
await engine.ping()
await engine.quit()
asyncio.run(main())
i'll be grateful for any help.