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

Resolve 8 issues #89

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Conversation

johndoknjas
Copy link

@johndoknjas johndoknjas commented Aug 23, 2024

Closes #75, closes #77, closes #82, closes #83, closes #87, closes #88, closes #92, and closes #93.

In regards to issue #87, my 25473eb2 commit in this PR implemented it. However, I then noticed that the test_get_best_move_remaining_time_not_first_move function would fail with the version of SF used by the github ci. So in commit 693cbd0 I included "g1f3" as an acceptable move. After looking into it a bit, I found that in this instance SF gave "g1f3" due to no longer calling is_move_correct from the make moves function (which has SF do a depth 1 search for each move it's about to make). In a test PR I did to look into it, compare how a05ec3a fails but dbf0131 doesn't. Similarly, 6c6e391 fails but 695ae89 doesn't (for the linux tests).
Since doing a depth 1 search before making each move certainly isn't required or expected in order to use Stockfish properly, adding "g1f3" to the test case is sound.

On the topic of issue #77:

As explained by the author of Fairy Stockfish here: "In fact, in Stockfish ucinewgame does exactly the same as setoption name Clear Hash".

For users, clearing the hash wouldn't be good to do when making moves, as it'll slow down a subsequent search. Also, clearing the table takes time itself. It only makes sense when starting a new game, but even then I suspect Stockfish's algorithm would clear it as it sees fit.

Removing the optional param of set_fen_position technically breaks backwards compatibility, since it's possible a user could call the function (without sending a second argument) and assume the hash table will implicitly be reset. However, this seems like a very rare case, and it's hard to see what the benefits would be. Since we're working on a new major release too, it feels justified in doing this. An alternative though is changing the name of set_fen_position so that no existing users can continue to call it, although I don't have a good candidate at the moment.

@johndoknjas johndoknjas requested a review from kieferro August 23, 2024 22:21
Copy link

github-actions bot commented Aug 23, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  stockfish
  models.py 842, 1018
Project Total  

This report was generated by python-coverage-comment-action

@johndoknjas johndoknjas changed the title Don't do the ucinewgame command by default Resolve issues 77, 83, and 88 Aug 23, 2024
@johndoknjas johndoknjas changed the title Resolve issues 77, 83, and 88 Resolve issues 75, 77, 83, and 88 Aug 24, 2024
@johndoknjas johndoknjas mentioned this pull request Aug 24, 2024
…f the set position functions. Rather, make a new function that can do this if the user wants.
…able is only a couple GBs, this can take more than half a second.
@johndoknjas johndoknjas changed the title Resolve issues 75, 77, 83, and 88 Resolve issues 75, 77, 83, 88, and 92 Aug 26, 2024
@johndoknjas johndoknjas changed the title Resolve issues 75, 77, 83, 88, and 92 Resolve issues 75, 77, 83, 88, 92, and 93 Aug 27, 2024
@johndoknjas johndoknjas changed the title Resolve issues 75, 77, 83, 88, 92, and 93 Resolve issues 75, 77, 82, 83, 88, 92, and 93 Aug 27, 2024
…moves function was modified to set the fen position after each move (in order to check for the correctness of each move). The issue with this is it will not allow the engine to detect game-state stuff like threefolds, even if the user sends all the moves in the game at once.
@johndoknjas johndoknjas changed the title Resolve issues 75, 77, 82, 83, 88, 92, and 93 Resolve 8 issues Aug 27, 2024
@johndoknjas johndoknjas marked this pull request as draft August 28, 2024 03:18
@johndoknjas johndoknjas marked this pull request as ready for review August 29, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment