Namespace splittiing to prune the maze graph. No eeffect on gameplay.
[open-adventure.git] / make_graph.py
index 28af8f7d23c328cf76cf4f2bbd986ce3d83719ed..cc92964dc157790d1f7bcadfe7c2592bfa8a2a41 100755 (executable)
@@ -9,7 +9,11 @@ import sys, yaml
 
 def allalike(loc):
     "Select out loci related to the Maze All Alike"
-    return (loc == "LOC_MISTWEST") or ("ALIKE" in loc) or ("DEADEND" in loc) or ("STALACTITE" in loc)
+    return (loc == "LOC_MISTWEST") or ("ALIKE" in loc) or ("MAZEEND" in loc) or ("STALACTITE" in loc)
+
+def abbreviate(d):
+    m = {"NORTH":"N", "EAST":"E", "SOUTH":"S", "WEST":"W", "UPWAR":"U", "DOWN":"D"}
+    return m.get(d, d)
 
 if __name__ == "__main__":
     with open("adventure.yaml", "r") as f:
@@ -22,7 +26,7 @@ if __name__ == "__main__":
         travel = attrs["travel"]
         if len(travel) > 0:
             for dest in travel:
-                verbs = dest["verbs"]
+                verbs = [abbreviate(x) for x in dest["verbs"]]
                 if len(verbs) == 0:
                     continue
                 action = dest["action"]