Update. /JL
This commit is contained in:
@@ -22,7 +22,10 @@ walls = [
|
||||
["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:
|
||||
def __init__(self, geometry: tuple):
|
||||
@@ -69,22 +72,26 @@ class Room:
|
||||
class PlayGround:
|
||||
def __init__(self, geometry: tuple):
|
||||
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:
|
||||
self.rooms.append(Room(geometry))
|
||||
def create_room(self, geometry) -> list:
|
||||
return Room(geometry).room
|
||||
|
||||
def print_room(self, room) -> None:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
pg = PlayGround(geometry = (20, 5))
|
||||
pg = PlayGround(geometry = (1, 3))
|
||||
|
||||
line = ""
|
||||
for ro in pg.rooms:
|
||||
for r in ro.room:
|
||||
for c in r:
|
||||
line = line + html.unescape(c)
|
||||
line: str = ""
|
||||
for r in pg.rooms[0]:
|
||||
for c in r:
|
||||
for b in c:
|
||||
line = line + html.unescape(b)
|
||||
line = line + "\n"
|
||||
print(line)
|
Reference in New Issue
Block a user