Skip to content

Bug/dots boxes#759

Merged
steam-bell-92 merged 5 commits into
steam-bell-92:mainfrom
yuvraj-k-singh:bug/dots-boxes
May 25, 2026
Merged

Bug/dots boxes#759
steam-bell-92 merged 5 commits into
steam-bell-92:mainfrom
yuvraj-k-singh:bug/dots-boxes

Conversation

@yuvraj-k-singh
Copy link
Copy Markdown
Contributor

📝 Description

Resolved a critical game-crashing bug caused by an IndexError during row/column selection in the Dots & Boxes AI game.

Root Cause:
While numbers that were too large threw an exception, Python natively handles negative integer indexes (e.g., -1). When a user input negative values, it altered lines on the opposite side of the grid instead of crashing immediately. Furthermore, relying entirely on a trailing try/except block allowed unchecked bounds parameters to bypass early loop sanitization.

Fix Details:

  • Upgraded user input parsing to explicitly screen out negative string integers containing the - character.
  • Replaced the loose try/except IndexError structure with strict, deterministic boundary validation tailored precisely to the game's asymmetric horizontal ($(size + 1) \times size$) and vertical ($size \times (size + 1)$) line matrices.
  • Handled out-of-range selections smoothly by logging console alerts and retaining current turn conditions without altering board states or causing a crash.

🔗 Linked Issue

Closes #629


📋 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
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

@yuvraj-k-singh 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 merged commit ceff566 into steam-bell-92:main May 25, 2026
6 of 10 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! 🙌

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Game crashes with index out of range error for invalid row/column input in Dots & Boxes AI game

2 participants