You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Connect Four: IndexError due to absence of input validation #551
Describe the bug
The game crashes with an IndexError when a player inputs a column number that is greater than the board's width (e.g., Column 8, 9, or 10 on a 0-indexed 7-column board). The input is not being sanitized or compared against the maximum column index before the board array is accessed.
To Reproduce
Steps to reproduce the behavior:
Run the Connect 4 script.
When prompted "P1's turn. Enter which column you would like to drop your piece into:", enter 8 or higher.
See error: IndexError: list index out of range.
Expected behavior
The application should validate the input. If the input is < 0 or > 7, it should display an error message like "Invalid Column! Please choose a number between "0 and 6" and prompt the user for a new input.
Desktop (please complete the following information):
Activity
github-actions commentedon Feb 24, 2026
Thank you for raising this issue! Our team will review it soon.
For more queries or discussions or approval of requests, please join the Discord server for further discussion: Discord Link
Solved Issue wasmerio#551 regarding input validation in Connect Four