Crossed Dungeon generation work

-Rewrite of step 3b for accuracy - verified acceptable speed
--Can now detect an impossible balance situation and restart
-Eliminated false negatives in step 4 (still need to rework false positives)
-Minor key logic improvement
This commit is contained in:
aerinon
2020-08-04 15:24:24 -06:00
parent 24177fa8b8
commit df52ca2730
6 changed files with 550 additions and 228 deletions

View File

@@ -1058,6 +1058,16 @@ class Polarity:
return False
return True
def __hash__(self):
h = 17
spot = self.vector[0]
h *= 31 + (spot if spot >= 0 else spot + 100)
spot = self.vector[1]
h *= 43 + (spot if spot >= 0 else spot + 100)
spot = self.vector[2]
h *= 73 + (spot if spot >= 0 else spot + 100)
return h
def is_neutral(self):
for i in range(len(self.vector)):
if self.vector[i] != 0:
@@ -1116,6 +1126,7 @@ class PolSlot(Enum):
EastWest = 1
Stairs = 2
class CrystalBarrier(FastEnum):
Null = 0 # no special requirement
Blue = 1 # blue must be down and explore state set to Blue