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

Refactor and add num_nodes and verbose options to get_top_moves() #16

Merged
merged 39 commits into from
Apr 20, 2023
Merged

Refactor and add num_nodes and verbose options to get_top_moves() #16

merged 39 commits into from
Apr 20, 2023

Conversation

knutole
Copy link

@knutole knutole commented Apr 7, 2023

This PR combines and replaces #14 and #15 , with major refactor of get_top_moves() function. (It was much easier to combine the PR's, for obvious reasons.) I have left in quite a few comments in the refactor, to make it easier to follow. I will remove most of them once you've had a chance to look it over.

Todo: Add turn_perspective option for rest of codebase, see #18

knutole and others added 5 commits September 29, 2022 15:42
lint with black

add dict type

more elaborate typing

type

type this

ignore type

fixed

Separete moves, info in Tuple if include_info=True

lint with black

add test

revert; add test

fix test

cleanup
Add suggested cleanup

Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
- Add support for 'num_nodes', see #14
- Add suppoert for 'verbose', see #15
- Refactor get_top_moves, remove redundant code
- Add tests for new arguments
- Rename 'N/s' to 'NodesPerSecond'
- Add turn_perspective global option
- Add get/set for self._num_nodes
- Add get/set for self._turn_perspective
- Todo: Refactor turn_perspective option for rest of codebase
@knutole knutole changed the title Improve get top moves Improve get_top_moves(): Add "num_nodes" and "verbose" options. Refactor. Apr 7, 2023
@github-actions
Copy link

github-actions bot commented Apr 7, 2023

Coverage report

The coverage rate went from 93.35% to 94.78% ⬆️
The branch rate is 88%.

96.72% of new lines are covered.

Diff Coverage details (click to unfold)

stockfish/models.py

96.72% of new lines are covered (94.78% of the complete file).
Missing lines: 660, 664

@knutole knutole changed the title Improve get_top_moves(): Add "num_nodes" and "verbose" options. Refactor. Refactor and add "num_nodes" and "verbose" options to .get_top_moves() Apr 8, 2023
@kieferro
Copy link
Member

kieferro commented Apr 8, 2023

Wow, that's quite a PR. First of all, a big thank you for the work and the interest that you put in this project!
I am currently not able to test and review your code, but it looks like you're still at work anyway. So just ping us or request if you need a review.

@knutole
Copy link
Author

knutole commented Apr 10, 2023

It's not possible for me to request review on this PR, by the way, not sure if there's a Github setting for that. @kieferro @johndoknjas

@knutole knutole changed the title Refactor and add "num_nodes" and "verbose" options to .get_top_moves() Refactor and add num_nodes and verbose options to get_top_moves() Apr 10, 2023
Copy link
Member

@kieferro kieferro left a comment

Choose a reason for hiding this comment

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

Okay, I am back and I looked at the changes. It looks very good overall!
We should, as you also wrote in your comment, implement the use of turn_perspective more consistently, but that's probably beyond the scope of this PR. This is definitely a good first step and we'll continue it from there.

stockfish/models.py Outdated Show resolved Hide resolved
stockfish/models.py Show resolved Hide resolved
tests/stockfish/test_models.py Outdated Show resolved Hide resolved
tests/stockfish/test_models.py Outdated Show resolved Hide resolved
stockfish/models.py Outdated Show resolved Hide resolved
stockfish/models.py Outdated Show resolved Hide resolved
stockfish/models.py Outdated Show resolved Hide resolved
@kieferro
Copy link
Member

It's not possible for me to request review on this PR, by the way, not sure if there's a Github setting for that. @kieferro @johndoknjas

Ah okay, I see. But it seems that nothing can be done about that as long as you don't have write-access. But feel free to just use the draft PR feature to indicate when the PR is ready for review.

knutole and others added 6 commits April 16, 2023 02:12
Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
Co-authored-by: kieferro <81773954+kieferro@users.noreply.github.com>
stockfish/models.py Outdated Show resolved Hide resolved
@knutole knutole requested a review from kieferro April 16, 2023 00:38
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
tests/stockfish/test_models.py Outdated Show resolved Hide resolved
Copy link
Member

@kieferro kieferro left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@johndoknjas johndoknjas left a comment

Choose a reason for hiding this comment

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

The changes look good, and the tests pass for me - nice job! Thanks for your contribution.

@johndoknjas johndoknjas merged commit e2f8c4c into py-stockfish:master Apr 20, 2023
@johndoknjas
Copy link

Looks like we're all satisfied with the PR, so I've merged it into master.

@knutole
Copy link
Author

knutole commented Apr 20, 2023

Great, thanks 🙏👍

@kieferro
Copy link
Member

Looks like we're all satisfied with the PR, so I've merged it into master.

Thanks 👍

Congratulations @knutole. Could you close your two PRs in the old repo (zhelyabuzhsky#115, zhelyabuzhsky#116)? This would give us a better overview.

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.

Improving some small things about self.depth
3 participants