Skip to content

Commit

Permalink
Make _is_ready back into its own function.
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas committed Aug 27, 2024
1 parent 4123b43 commit 4f53176
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions stockfish/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ def _put(self, command: str) -> None:
raise BrokenPipeError()
if self._stockfish.poll() is None and not self._has_quit_command_been_sent:
if command != "isready":
self._put("isready")
while self._read_line() != "readyok":
pass
self._is_ready()
if self._debug_view:
print(f">>> {command}\n")
self._stockfish.stdin.write(f"{command}\n")
Expand Down Expand Up @@ -275,6 +273,11 @@ def _validate_param_val(self, name: str, value: Any) -> None:
if maximum is not None and type(value) is int and value > maximum:
raise ValueError(f"{value} is over {name}'s maximum value of {maximum}")

def _is_ready(self) -> None:
self._put("isready")
while self._read_line() != "readyok":
pass

def _go(self) -> None:
self._put(f"go depth {self._depth}")

Expand Down

0 comments on commit 4f53176

Please sign in to comment.