Create A Game Board
Create A Game Board
Start by building a 2D array filled with 0’s or 1’s. Use for loop to generate the array or list
comprehension.
Draw a board using a for loop running through the array by row and then by column. Increment
and reset x and y variables to track where on the screen you should be. Check what the value
of the array is to determine the fill colour.
Create a mouse pressed function to find out where the user is clicking. Use integer division to
generate the position in terms of the array. Try changing the value in the array based on clicks.
def setup():
size(800,600)
def draw():
def mousePressed():
grid[mouseY/w][mouseX/w] = -1 * grid[mouseY/w][mouseX/w]
# integer division is good here!