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

Bug fix: Bot move freezes player move #84

Merged
merged 8 commits into from
Nov 23, 2024

Conversation

LucaSain
Copy link
Contributor

Fix for player move freeze by bot move computation

Description

On each game tick, the bot move state will be checked and the player move will be rendered first.

This solution relies on a variable exposed through the board enum and an if clause in the app loop. This solution is not perfect and maybe a thread-event approach would be better. Any feedback would be extremely helpful.

Fixes #83

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@thomas-mauran
Copy link
Owner

Hello @LucaSain thanks for the contribution the code seems good and logical, do you have any steps to reproduce the bug ? I wasn't able to reproduce it on my computer

infernosalex and others added 2 commits November 12, 2024 21:01
* Add reset the game/ go to the menu by pressing a key

* Material difference

---------

Signed-off-by: Thomas Mauran <[email protected]>
Co-authored-by: Thomas Mauran <[email protected]>
@thomas-mauran thomas-mauran added the bug Something isn't working label Nov 13, 2024
@LucaSain
Copy link
Contributor Author

Hi, sorry for late reply.

Hello @LucaSain thanks for the contribution the code seems good and logical, do you have any steps to reproduce the bug ? I wasn't able to reproduce it on my computer

Try with this bot. It's slower and the issue should visible:
https://github.com/LucaSain/chess-daniel

@thomas-mauran
Copy link
Owner

Hi, sorry for late reply.

Hello @LucaSain thanks for the contribution the code seems good and logical, do you have any steps to reproduce the bug ? I wasn't able to reproduce it on my computer

Try with this bot. It's slower and the issue should visible: https://github.com/LucaSain/chess-daniel

Ah yes I do see it now, I tried to play a game and lost but the game didn't end after reading the code maybe this is an edge case, I was able to get the Black Won text after selecting the black queen in this position:
Capture d’écran, le 2024-11-13 à 18 42 14

@thomas-mauran
Copy link
Owner

Hi @LucaSain wanting to know if you will finish this issue or if I shall do it ?

@LucaSain
Copy link
Contributor Author

Hi @LucaSain wanting to know if you will finish this issue or if I shall do it ?

Working on it right now. I'll try to finish it by tomorrow.

@LucaSain
Copy link
Contributor Author

LucaSain commented Nov 23, 2024

This should do, however this still feels like a workaround. Should I create a new method or move the checkmate and draft check from the if clause to the switch_turn method?

@thomas-mauran
Copy link
Owner

This should do, however this still feels like a workaround. Should I create a new method or move the checkmate and draft check from the if clause to the switch_turn method?

This will do the trick for now, I am working on a refactor so this will probably be part of it. Thanks for your contribution ! 🎉

@thomas-mauran thomas-mauran merged commit 433709e into thomas-mauran:main Nov 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bot move freezes player move.
3 participants