Update. /JL

This commit is contained in:
Jan Lerking
2025-03-19 14:12:15 +01:00
parent 2f4483b44a
commit 105690d724

View File

@@ -22,7 +22,10 @@ walls = [
["WALL_SW", "WALL_HORIZONTAL", "WALL_HORIZONTAL", "WALL_HORIZONTAL", "WALL_SE"] ["WALL_SW", "WALL_HORIZONTAL", "WALL_HORIZONTAL", "WALL_HORIZONTAL", "WALL_SE"]
] ]
# room_width, room_height = 20, 15 # 20 tiles wide and 15 tiles high # Playground geometry matrix of rooms can range from 1x1 to 3x3.
geometries = [(1, 1), (2, 1), (3, 1),
(1, 2), (2, 2), (3, 2),
(1, 3), (2, 3), (3, 3)]
class Room: class Room:
def __init__(self, geometry: tuple): def __init__(self, geometry: tuple):
@@ -69,22 +72,26 @@ class Room:
class PlayGround: class PlayGround:
def __init__(self, geometry: tuple): def __init__(self, geometry: tuple):
self.rooms: list = [] self.rooms: list = []
self.create_room(geometry) for r in range(geometry[0]):
row: list = []
for c in range(geometry[1]):
row.append(self.create_room(geometry = (20, 10)))
self.rooms.append(row)
def create_room(self, geometry) -> None: def create_room(self, geometry) -> list:
self.rooms.append(Room(geometry)) return Room(geometry).room
def print_room(self, room) -> None: def print_room(self, room) -> None:
pass pass
if __name__ == "__main__": if __name__ == "__main__":
pg = PlayGround(geometry = (20, 5)) pg = PlayGround(geometry = (1, 3))
line = "" line: str = ""
for ro in pg.rooms: for r in pg.rooms[0]:
for r in ro.room: for c in r:
for c in r: for b in c:
line = line + html.unescape(c) line = line + html.unescape(b)
line = line + "\n" line = line + "\n"
print(line) print(line)