Skip to content

fix: replace busy-wait loop with ontimer-driven ticks in Snake game - #939

Merged
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
kumudasrip:fix/snake-game
Jun 1, 2026
Merged

fix: replace busy-wait loop with ontimer-driven ticks in Snake game#939
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
kumudasrip:fix/snake-game

Conversation

@kumudasrip

Copy link
Copy Markdown
Contributor

📝 Description

This PR fixes the pause busy-wait issue in the Snake game. The game loop now uses event-driven ticks (screen.ontimer()) instead of a busy-wait loop, eliminating high CPU usage when paused.

🔗 Linked Issue

Closes #828


📋 Contribution Checklist

  • My code strictly adheres to the project guidelines (Standard library only, procedural code, clean spacing).
  • I have verified that my files are placed in the correct directory.
  • I have tested my changes thoroughly on my local machine.
  • I have included interactive emojis and clean console/UI outputs.
  • GSSoC 2026: I have been formally assigned to this issue and noted it above.

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@kumudasrip is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@kumudasrip

Copy link
Copy Markdown
Contributor Author

Hi @steam-bell-92 , I have fixed the busy wait loop with ontimer driven ticks in the snake game and since all the checks have been passed, could you please review the PR whenever possible? Thank you!

@steam-bell-92 steam-bell-92 added type:bug Something isn't working level:beginner gssoc:approved GSSoC 2026 approving tag mentor:steam-bell-92 labels Jun 1, 2026
@steam-bell-92
steam-bell-92 merged commit a7c7813 into steam-bell-92:main Jun 1, 2026
9 of 10 checks passed
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.

We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone.

If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request.

Thanks again for your support! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC 2026 approving tag level:beginner type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Pause busy-waits in Snake-Game/main.py causing high CPU and UI freeze

2 participants