Roypinky Neibourhood

Junyu Cao
Data Mining the City
2 min readSep 12, 2018

Rules: 1. define a street grid

2. Add blocks according to the street grid with several houses

3. Define the center of street grid as central park, serving the surrounding neighbourhood

def setup():
size(500, 500)
fill(0)#this is black

global road, blocksPerNeighborhood, blocksPerRow, park, blockLength, houseSetbacks, houseSize, houseQuantity

road = 25
park = 5
blocksPerNeighborhood = 9
blocksPerRow = int(sqrt(blocksPerNeighborhood))
blockLength = int((width/blocksPerRow)-road)
houseSetbacks = 9
houseQuantity = 3
houseSize = (blockLength/houseQuantity) — houseSetbacks -5

def draw():
background(255)
#make blocks
for b in range(blocksPerNeighborhood):
fill(255, 200, 200)
stroke(50, 50, 50)
strokeWeight(3)
col = b % blocksPerRow
row = b / blocksPerRow
xCol = col*(blockLength+road)
yCol = row*(blockLength+road)
rect(xCol,yCol,blockLength,blockLength)

#make houses
fill(0)
noStroke()
h = -0.6
while h < houseQuantity-1:
h += 1
rect(xCol+houseSetbacks+0,yCol + (h*(houseSize+houseSetbacks)),houseSize,houseSize)
print(houseSize)
text(“Roypinky Street”,200,162)
for c in range(park):
fill(0, 180, 50)
stroke(0, 150, 50)
text(“Central Park”, 200, 250)
strokeWeight(0)
col = b % park +30
row = b / park +32
xCol = col*(park)
yCol = row*(park)
rect(xCol,yCol,blockLength,blockLength)

--

--