Skip to content

fix: re-prompt on invalid input in Rock-Paper-Scissors instead of exiting - #244

Merged
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
nimkarprachi17:fix/issue-242-rps-invalid-input
May 16, 2026
Merged

fix: re-prompt on invalid input in Rock-Paper-Scissors instead of exiting#244
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
nimkarprachi17:fix/issue-242-rps-invalid-input

Conversation

@nimkarprachi17

Copy link
Copy Markdown
Contributor

Title:
[PR]: fix: re-prompt on invalid input in Rock-Paper-Scissors instead of exiting

Description:
When a user types an invalid choice (anything other than r, p, or s), the game was immediately exiting with "Rerun the game..." instead of re-prompting. This was especially bad UX since even a single typo forced a full restart.

Changes made:

  • Replaced Flag = False with continue so the loop re-prompts on invalid input
  • Removed the redundant elif Flag block since invalid input now never reaches game logic
  • Invalid input no longer falls through to the "Continue playing?" prompt

Related Issue:
Closes #242

How Has This Been Tested:

  • Tested on Windows
  • Multiple test runs completed
  • Edge cases tested

Typed invalid inputs (e.g. 'x', 'rock', '1', uppercase 'R') at the choice prompt.
Game now re-prompts with a friendly message instead of exiting.
Valid inputs (r, p, s) and continue/exit flow work exactly as before.

Environment:
Python Version: 3.x
OS: Windows

@vercel

vercel Bot commented May 16, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@steam-bell-92 steam-bell-92 added type:bug Something isn't working level:beginner gssoc:approved GSSoC 2026 approving tag labels May 16, 2026
@steam-bell-92
steam-bell-92 merged commit a465352 into steam-bell-92:main May 16, 2026
3 of 4 checks passed
@github-actions

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! 🙌

@github-actions

Copy link
Copy Markdown
Contributor

Thanks @nimkarprachi17! I've added you to the contributors list.

@nimkarprachi17
nimkarprachi17 deleted the fix/issue-242-rps-invalid-input branch May 16, 2026 18:17
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]: Invalid input exits Rock-Paper-Scissors game instead of re-prompting

2 participants