$HOME/Sandpit/chisel/python/pen2map.py
# # calcFloorLevel - starting at the room with the spawn point # def calcFloorLevel (): global minFloor, maxFloor s = getSpawnRoom () rooms[s].floorLevel = 0 lowerFloors (s) for r in rooms.keys (): if rooms[r].floorLevel is None: rooms[r].floorLevel = 0 minFloor = min (minFloor, rooms[r].floorLevel) maxFloor = max (minFloor, rooms[r].floorLevel)
# # lowerFloors - starting at room, s, lower all neighbouring floors # def lowerFloors (s): visited = [s] queue = getNeighbours (rooms[s]) level = -(floorStep * noSteps) while queue != []: nextLevel = [] # lower each neighbouring room floor for c in queue: r = rooms[c] if r.floorLevel == None: r.floorLevel = level nextLevel += getNeighbours (r) # now move onto their neighbours queue = nextLevel level -= (floorStep * noSteps)
This document was produced using groff-1.22.