DEV Community

Discussion on: A Simple Python Tic-Tac-Toe Game Using Pygame

Collapse
 
hairash profile image
Hairash

Hello! Thanks for code!
I have noticed one moment there:
You have constant ROWS = 3, and it's value can be changed.
And at the same time you create game array:

game_array = [[None, None, None], [None, None, None], [None, None, None]]

that means you have 3x3 field.
I think, it's better to replace this line with:

game_array = [[None] * ROWS for _ in range(ROWS)]

So it will work for every field size.

Collapse
 
ramakm profile image
Ramakrushna Mohapatra

Yeah, For generic purpose its better to use your mentioned line. Thanks.