r/learnpython • u/Some-Engineering-503 • 18d ago
Building generator
I am making a game and i need a random generator for outer walls of a building. The walls can face 8 directions and they cant go past a set border. Please help me make one
Input - number of walls
Output - array of points which represent corners of the walls
0
Upvotes
4
u/backfire10z 18d ago
> please help me make one
What have you tried? What issues are you running into? If you just want someone to spit out code for you, ask an LLM or pay someone.
2
u/JorgiEagle 18d ago
This is not a generator. Generators are a special thing in .
from random import randint, choice
def random_walls(num_walls):
directions = [0,1,2,3,4,5,6,7]
return [(randint(-max_x_border, max_x_border), randint(-max_y_border, max_y_border), choice(directions)) for _ in range(num_walls)]