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

resolved the problem with main.py #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

erenyeager101
Copy link

The issue in main.py is due to calling main() recursively inside the replay_game() function, which will cause a stack overflow and incorrect game logic.

To solve this, instead of calling main() again, reset the game variables within the same game loop so that it restarts cleanly.

Changes that i made:
Replay Logic: Added a reset_game() function that resets all the game variables, making the game restart smoothly when the "Replay" button is pressed.
Removed Recursive Call: The replay_game() function now only resets the game state instead of calling main() again, preventing recursive function calls.
Global Variables: Some variables like cells, fill_count, and players are now global so they can be reset properly when replaying the game.

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.

1 participant