Bug: Program crashes when board is full in Tic Tac Toe game
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start at the Tic Tac Toe game’s compMove() and insertLetter() functions, then trace the computer-turn path when the board has no open positions. Handle the full-board case as a tie before indexing the board, and verify that a completed board prints a tie instead of raising the reported TypeError.
Written by the indexing model from the issue text.
Description
After the board is filled in the Tic Tac Toe game, the program crashes with an error:
TypeError: list indices must be integers or slices, not NoneType
Cause:
The compMove() function returns None when no moves are left, but the program tries to insert at board[None].
Suggested Solution:
Before calling insertLetter("O", move), check if move is None and handle it as a tie.
Example:
if move == 0 or move is None:
print("Tie game")
else:
insertLetter("O", move)
print(f"Computer placed O on position {move}")
printBoard(board)
Additional Suggestion:
In compMove(), add a check:
if len(possibleMoves) == 0:
return None
Happy to work on fixing this if you would like! 🚀
- Dominant language
- Python
- Stars
- 583
- Forks
- 441
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shahrayar123/Python-Projects
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Shahrayar123/Python-Projects#112 · 8 comments ·
-
Agentic AI enhancement good first issue
Shahrayar123/Python-Projects#332 · 2 comments · 1 assignee ·
-
documentation good first issue help wanted
Difficulty 3/5 1-2 days Newbie friendliness 70/100
Shahrayar123/Python-Projects#331 · 2 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 48/100
Shahrayar123/Python-Projects#320 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
Shahrayar123/Python-Projects#319 ·
All issues in Shahrayar123/Python-Projects
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100