Python-Projects icon indicating copy to clipboard operation
Python-Projects copied to clipboard

Bug: Program crashes when board is full in Tic Tac Toe game

Open snehauppula opened this issue 8 months ago • 6 comments

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

snehauppula avatar Apr 26 '25 10:04 snehauppula

Hi @snehauppula, I would like to check and resolve this issue. Can I take up this issue?

koilakuntlamunnaf avatar Jun 08 '25 16:06 koilakuntlamunnaf

Yeah.I will be more happy if you do so

snehauppula avatar Jun 08 '25 17:06 snehauppula

Hi. @snehauppula is the issue still open? I would like to work on it if it is still available

Neha01010 avatar Jun 10 '25 10:06 Neha01010

Yeah.I will be more happy if you do so

snehauppula avatar Jun 10 '25 10:06 snehauppula

@snehauppula Can I work on this??

Sanjana-Desh avatar Jul 31 '25 14:07 Sanjana-Desh

Hi! I’m interested in working on this issue. Could you please assign it to me? Thanks!

GitRutvij17 avatar Aug 16 '25 18:08 GitRutvij17