Is pydrauhts the DXP server or listener? I guess pydraughts is the DXP initiator?
Pydraughts is the listener and the initiator.
All engines should use a different DXP port number when running on the same machine?
Yes.
Will pydraughts launch the engine or is the engine supposed to be started and configured in DXP mode already?
Pydraughts supports both starting an engine and using an already opened one. An already opened one should be already configures for DXP. If pydaughts starts the engine, the engine must already be in DXP or accept an arguement that tells it to use DXP (e.g. for Scan it calls `scan.exe dxp`).
GWD and Scan can be launched in DXP mode, but suppose the engine has a GUI only and has to be configured in DXP mode through the GUI: will pydraughts just launch the engine and wait until the engine is running in DXP mode?
It will launch the engine and wait a predefined amount of time (called `wait-to-open-time`), in which the engine must be configured to use DXP.
See the code below for an example on how to use scan in dxp (`engine-opened: False` means that the engine isn't already open and that pydraughts should open it, `wait-to-open-time` is the amount of time pydraughts will wait for the engine to launch):
Code: Select all
import draughts
from draughts.engine import DXPEngine
dxp = DXPEngine(['scan.exe', 'dxp'], {'engine-opened': False, 'ip': '127.0.0.1', 'port': 27531, 'wait-to-open-time': 10, 'max-moves': 100, 'initial-time': 30})
game = draughts.Board()
while not game.is_over():
if len(game.move_stack) % 2 == 0:
best_move = dxp.play(game)
else:
best_move = random_move_engine(game)
if best_move.move:
game.push(best_move.move)
else:
break
dxp.quit()
dxp.kill_process()