JonathanJTang / snake-Python

A simple game programmed using Python
0 stars 1 forks source link

2D list "grid": should it be global or not? #6

Closed JonathanJTang closed 6 years ago

JonathanJTang commented 6 years ago

Should the array "grid," used in the program to turn coordinates on the virtual grid into coordinates for turtle displaying, be a global variable or a dedicated function?

josephhtang commented 6 years ago

I think both. A function to create the virtual grid (and possibly draw it as well) and the global variable to make it easier to know the turtle coordinates by simply knowing the grid coordinates, since the grid coordinates basically convert a certain square on the grid (e.g. row 1 col 5) into the turtle coordinates that are actually useful for turtle-drawing (e.g. x=50, y=250).

JonathanJTang commented 6 years ago

Got it