Spaces:
Sleeping
Sleeping
Shail Choksi commited on
Commit ·
d2c4d69
1
Parent(s): c6c03d6
Removed out of context go commands. Fix return type for search
Browse files- config.yml.default +0 -2
- engine_wrapper.py +3 -7
config.yml.default
CHANGED
|
@@ -16,10 +16,8 @@ engine: # engine settings
|
|
| 16 |
Threads: 2 # max CPU threads the engine can use
|
| 17 |
Hash: 256 # max memory (in megabytes) the engine can allocate
|
| 18 |
# go_commands:
|
| 19 |
-
# searchmoves: "c2c4" # (Optional) Restrict search to moves in this list.
|
| 20 |
# nodes: 1 # (Optional) Search so many nodes only.
|
| 21 |
# depth: 5 # (Optional) Search depth ply only.
|
| 22 |
-
# mate: 5 # (Optional) Search for a mate in mate moves.
|
| 23 |
# movetime: 1000 # (Optional) Integer. Search exactly movetime milliseconds.
|
| 24 |
|
| 25 |
xboard_options: # arbitrary xboard options passed to the engine
|
|
|
|
| 16 |
Threads: 2 # max CPU threads the engine can use
|
| 17 |
Hash: 256 # max memory (in megabytes) the engine can allocate
|
| 18 |
# go_commands:
|
|
|
|
| 19 |
# nodes: 1 # (Optional) Search so many nodes only.
|
| 20 |
# depth: 5 # (Optional) Search depth ply only.
|
|
|
|
| 21 |
# movetime: 1000 # (Optional) Integer. Search exactly movetime milliseconds.
|
| 22 |
|
| 23 |
xboard_options: # arbitrary xboard options passed to the engine
|
engine_wrapper.py
CHANGED
|
@@ -77,7 +77,7 @@ class UCIEngine(EngineWrapper):
|
|
| 77 |
|
| 78 |
def __init__(self, board, commands, options, silence_stderr=False):
|
| 79 |
commands = commands[0] if len(commands) == 1 else commands
|
| 80 |
-
self.go_commands = options.get("go_commands"
|
| 81 |
|
| 82 |
self.engine = chess.uci.popen_engine(commands, stderr = subprocess.DEVNULL if silence_stderr else None)
|
| 83 |
self.engine.uci()
|
|
@@ -104,20 +104,16 @@ class UCIEngine(EngineWrapper):
|
|
| 104 |
def search(self, board, wtime, btime, winc, binc):
|
| 105 |
self.engine.position(board)
|
| 106 |
cmds = self.go_commands
|
| 107 |
-
best_move,
|
| 108 |
wtime=wtime,
|
| 109 |
btime=btime,
|
| 110 |
winc=winc,
|
| 111 |
binc=binc,
|
| 112 |
-
searchmoves=cmds.get("searchmoves"),
|
| 113 |
-
ponder=cmds.get("ponder"),
|
| 114 |
-
movestogo=cmds.get("movestogo"),
|
| 115 |
depth=cmds.get("depth"),
|
| 116 |
nodes=cmds.get("nodes"),
|
| 117 |
-
mate=cmds.get("mate"),
|
| 118 |
movetime=cmds.get("movetime")
|
| 119 |
)
|
| 120 |
-
return best_move
|
| 121 |
|
| 122 |
|
| 123 |
def stop(self):
|
|
|
|
| 77 |
|
| 78 |
def __init__(self, board, commands, options, silence_stderr=False):
|
| 79 |
commands = commands[0] if len(commands) == 1 else commands
|
| 80 |
+
self.go_commands = options.get("go_commands", {})
|
| 81 |
|
| 82 |
self.engine = chess.uci.popen_engine(commands, stderr = subprocess.DEVNULL if silence_stderr else None)
|
| 83 |
self.engine.uci()
|
|
|
|
| 104 |
def search(self, board, wtime, btime, winc, binc):
|
| 105 |
self.engine.position(board)
|
| 106 |
cmds = self.go_commands
|
| 107 |
+
best_move, _ = self.engine.go(
|
| 108 |
wtime=wtime,
|
| 109 |
btime=btime,
|
| 110 |
winc=winc,
|
| 111 |
binc=binc,
|
|
|
|
|
|
|
|
|
|
| 112 |
depth=cmds.get("depth"),
|
| 113 |
nodes=cmds.get("nodes"),
|
|
|
|
| 114 |
movetime=cmds.get("movetime")
|
| 115 |
)
|
| 116 |
+
return best_move
|
| 117 |
|
| 118 |
|
| 119 |
def stop(self):
|