Skip to content

Commit

Permalink
infoコマンドの内容を取得するためのリスナークラス追加
Browse files Browse the repository at this point in the history
  • Loading branch information
TadaoYamaoka committed Jul 11, 2023
1 parent 8754323 commit 157d7f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cshogi/usi/Engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, mate_score=100000, listner=None):
self.__bestmove = None

@staticmethod
def __split_info(m: re.Match[str]) -> dict:
def _split_info(m: re.Match[str]) -> dict:
items = (m[1] + m[4]).split(' ')
info_dict = {}
for name, value in zip(items[::2], items[1::2]):
Expand Down Expand Up @@ -67,7 +67,7 @@ def mate_score(self) -> int:

@property
def info(self) -> dict:
return InfoListener.__split_info(self.__info[self.bestmove])
return InfoListener._split_info(self.__info[self.bestmove])

@property
def score(self) -> int:
Expand Down Expand Up @@ -120,7 +120,7 @@ def listen(self) -> 'MultiPVListener':

@property
def info(self) -> list:
return [InfoListener.__split_info(InfoListener.re_info.match(line)) for _, line in sorted(self.__multipv.items())]
return [InfoListener._split_info(InfoListener.re_info.match(line)) for _, line in sorted(self.__multipv.items())]


class Engine:
Expand Down

0 comments on commit 157d7f1

Please sign in to comment.