Published in
3 min readSep 18, 2018
Grid Homework
spacing = 10
squaresize = 60def setup():
size(1000, 2000)
for row in xrange(0, 10):
for column in xrange(0, 10):
fill ( 255)
# rect(x + column * (squareSize + spacing), y + row * (squareSize + spacing), squareSize,squareSize)
if column >3 and row <6:
fill (0)
rect(column * ( spacing + squaresize)-5, row * ( squaresize + spacing )-5 , squaresize+10, squaresize+10 )
fill (255)
rect(column * ( spacing + squaresize), row * ( squaresize + spacing ) , squaresize, squaresize )
elif column <10 and row <6:
stroke (0)
rect(column * ( spacing + squaresize), row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize * 3/4, row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
#
rect(column * ( spacing + squaresize), row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize * 3/4, row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
#
rect(column * ( spacing + squaresize), row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize*3/4, row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
#
rect(column * ( spacing + squaresize), row * ( squaresize + spacing )+squaresize*3/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing )+squaresize*3/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing )+squaresize*3/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize*3/4, row * ( squaresize + spacing )+squaresize *3/4 , squaresize/4, squaresize/4 )
elif column <10 and row >5:
rect(column * ( spacing + squaresize), row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize * 3/4, row * ( squaresize + spacing ) , squaresize/4, squaresize/4 )
#
rect(column * ( spacing + squaresize), row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize * 3/4, row * ( squaresize + spacing )+ squaresize/4 , squaresize/4, squaresize/4 )
#
rect(column * ( spacing + squaresize), row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize*3/4, row * ( squaresize + spacing )+squaresize/2 , squaresize/4, squaresize/4 )
#
rect(column * ( spacing + squaresize), row * ( squaresize + spacing )+squaresize*3/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/4, row * ( squaresize + spacing )+squaresize*3/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize/2, row * ( squaresize + spacing )+squaresize*3/4 , squaresize/4, squaresize/4 )
rect(column * ( spacing + squaresize)+squaresize*3/4, row * ( squaresize + spacing )+squaresize *3/4 , squaresize/4, squaresize/4 )rect(column * ( spacing + squaresize)+15 , row * ( squaresize + spacing )+15, squaresize/2, squaresize/2)
fill (0)
rect(column * ( spacing + squaresize)+22.5 , row * ( squaresize + spacing )+22.5, squaresize/4, squaresize/4)