Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- width = 20
- height = 20
- city = [[0 for col in range(width)] for row in range(height)]
- points = []
- #generowanie drogi
- roadMin = 3
- roadMax = 10
- road = random.randint(roadMin, roadMax);
- roadAxis = random.choice(['horizontal', 'veritcal'])
- if roadAxis == 'horizontal':
- startX = random.randint(0, width-1-road)
- startY = random.randint(0, height-1)
- city[startX:(startX+road)][startY] = [r + 1 for r in city[startX:(startX+road)][startY]]
- for x in range(startX, (startX+road)+1):
- points.append({'x':x, 'y':startY})
- if roadAxis == 'veritcal':
- startX = random.randint(0, width-1)
- startY = random.randint(0, height-1-road)
- city[startX][startY:(startY+road)] = [r + 1 for r in city[startX][startY:(startY+road)]]
- for y in range(startY, (startY+road)+1):
- points.append({'x':startX, 'y':y})
- for c in city:
- print(c)
- for c in points:
- print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement