Central-greening neighbourhood
Published in
2 min readSep 9, 2018
Original image:
Rules:
4*4 square blocks, each of which has buildings and greening.
The size of square building equals to 1/9 area of block.
The surrounding 12 blocks have building along each side and green space in the center.
The central 4 blocks have one building in the center with surrounding greenland
Processing canvas:
code:
def setup():
size(800,800)
background(250,250,100)
global road, blocksPerNeighborhood, blocksPerRow, blockLength, houseSetbacks, houseSize, houseQuantity
road = 25
blocksPerNeighborhood = 16
blocksPerRow = int(sqrt(blocksPerNeighborhood))
blockLength = int((width/blocksPerRow)-road)
houseSetbacks = 9
houseQuantity = 9
houseSize = int(blockLength/3) - houseSetbacks
def draw():
background(255)
#make blocks
for b in range(blocksPerNeighborhood):
fill(0, 150, 50)
stroke(50, 50, 50)
strokeWeight(2)
col = b % blocksPerRow
row = b / blocksPerRow
xCol = col*(blockLength+road)
yCol = row*(blockLength+road)
rect(xCol,yCol,blockLength,blockLength)
if b <> 5 and b <>6 and b <>9 and b <>10:
#make houses in surrounding blocks
fill(250,0,0)
stroke(0,0,0)
h = -1
while h < houseQuantity-1:
h = h+1
if h <> 4:
colhouse = h % 3
rowhouse = h / 3
rect(xCol+colhouse*(houseSize+houseSetbacks),yCol+rowhouse*(houseSize+houseSetbacks),houseSize,houseSize)
print(houseSize)
for b in (5,6,9,10):
#make houses in central blocks
fill(250,0,0)
stroke(0,0,0)
h = 4
colhouse = h % 3
rowhouse = h / 3
rect(xCol+colhouse*(houseSize+houseSetbacks),yCol+rowhouse*(houseSize+houseSetbacks),houseSize,houseSize)
print(houseSize)