More & better forced connection detection
This commit is contained in:
@@ -1024,6 +1024,30 @@ class Direction(Enum):
|
||||
Up = 4
|
||||
Down = 5
|
||||
|
||||
@unique
|
||||
class Hook(Enum):
|
||||
North = 0
|
||||
West = 1
|
||||
South = 2
|
||||
East = 3
|
||||
Stairs = 4
|
||||
|
||||
|
||||
hook_dir_map = {
|
||||
Direction.North: Hook.North,
|
||||
Direction.South: Hook.South,
|
||||
Direction.West: Hook.West,
|
||||
Direction.East: Hook.East,
|
||||
}
|
||||
|
||||
|
||||
def hook_from_door(door):
|
||||
if door.type == DoorType.SpiralStairs:
|
||||
return Hook.Stairs
|
||||
if door.type == DoorType.Normal:
|
||||
return hook_dir_map[door.direction]
|
||||
return None
|
||||
|
||||
|
||||
class Polarity:
|
||||
def __init__(self):
|
||||
@@ -1282,6 +1306,13 @@ class Sector(object):
|
||||
magnitude[idx] = magnitude[idx] + 1
|
||||
return magnitude
|
||||
|
||||
def hook_magnitude(self):
|
||||
magnitude = [0] * len(Hook)
|
||||
for door in self.outstanding_doors:
|
||||
idx = hook_from_door(door).value
|
||||
magnitude[idx] = magnitude[idx] + 1
|
||||
return magnitude
|
||||
|
||||
def outflow(self):
|
||||
outflow = 0
|
||||
for door in self.outstanding_doors:
|
||||
|
||||
Reference in New Issue
Block a user