Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infoのscoreサブコマンドやinfoコマンド自体の入力が無いときに、InfoListenerがKeyErrorを吐かないようにした #52

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

hmatsuya
Copy link
Contributor

短い思考時間の場合、思考エンジンがinfoコマンドのscoreサブコマンドや、infoコマンド自体を出力しない場合があります。そのような場合に、InfoListenerやMultiPVListenerのscoreやinfoメソッドがKeyErrorを吐いて止まってしまわないように、infoのパース方法を変更したり、出力の存在をチェックをしたりするように変更しました。

… commands are missing

Refactored the regular expression and parsing logic in the InfoListener class to improve readability and maintainability. The updated regex now focuses on the 'pv' (Principal Variation) information directly, simplifying the extraction of other details as needed. This change also includes a more robust error handling for parsing integer values and handles cases where the best move is not present in the info dictionary, returning None instead of raising an exception. Additionally, the score calculation has been adjusted to correctly interpret the 'mate' keyword and return the appropriate mate score.
info_dict['string'] = m[1][7:]
break
elif name == 'score':
name = items.pop(0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nameを上書きして大丈夫でしょうか?

@hmatsuya
Copy link
Contributor Author

hmatsuya commented Jun 12, 2024 via email

@TadaoYamaoka TadaoYamaoka merged commit 4cf7e85 into TadaoYamaoka:master Jun 14, 2024
TadaoYamaoka added a commit that referenced this pull request Jul 11, 2024
- [Engine] InfoListenerのバグ修正 #52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants