- startlocs = {}
- for obj in db["objects"]:
- objname = obj[0]
- location = obj[1].get("locations")
- if "OBJ" not in objname and location != "LOC_NOWHERE" and ("immovable" not in obj[1] or not obj[1]["immovable"]):
- if location in startlocs:
- startlocs[location].append(objname)
- else:
- startlocs[location] = [objname]
-
- print("digraph G {")
-
- for (loc, attrs) in db["locations"]:
- if subset == "surface" and not surface(attrs):
- continue
- if subset == "maze" and not allalike(loc):
- continue;
- node_label = roomlabel(loc)
- if loc in startlocs:
- node_label += "\\n" + ",".join(startlocs[loc]).lower()
- print(' %s [shape=box,label="%s"]' % (loc[4:], node_label))
-
- for (loc, attrs) in db["locations"]:
- if subset == "surface" and not surface(attrs):
- continue
+ # Compute reachability, using forwards.
+ # Dictionary ke6y is (from, to) iff its a valid link,
+ # value is correspoinding motion verbs.
+ links = {}
+ nodes = set()
+ for (loc, attrs) in db["locations"]:
+ nodes.add(loc)