X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=make_graph.py;h=a7aa78cc0e973d33849f0416134f8746065a8dbb;hb=9af3ab4ecddbd6dd0347a4adc54a98b5153a9fb6;hp=fcf44fb8e850ace038ee7cfb70fb014c7f5b48ae;hpb=1c2346392e396df7846189e23e4b33bc3017a811;p=open-adventure.git diff --git a/make_graph.py b/make_graph.py index fcf44fb..a7aa78c 100755 --- a/make_graph.py +++ b/make_graph.py @@ -12,7 +12,7 @@ Make a DOT graph of Colossal Cave. # Copyright (c) 2017 by Eric S. Raymond # SPDX-License-Identifier: BSD-2-clause -import sys, yaml, getopt +import sys, getopt, yaml def allalike(loc): "Select out loci related to the Maze All Alike" @@ -65,7 +65,7 @@ def roomlabel(loc): # it ships some message (which is the point) then shifts you to a nexr location. # A forwarder has a zero-length array of notion verbs in its travel section. # -# Here is an examoke forwarder kocation: +# Here is an example forwarder declaration: # # - LOC_GRUESOME: # description: @@ -112,7 +112,7 @@ if __name__ == "__main__": subset = surface else: sys.stderr.write(__doc__) - raise SystemExit(1) + raise SystemExit(1) startlocs = {} for obj in db["objects"]: @@ -135,7 +135,7 @@ if __name__ == "__main__": startlocs[location] = [objname] print("digraph G {") - + for (loc, attrs) in db["locations"]: if is_forwarder(loc): continue @@ -145,8 +145,8 @@ if __name__ == "__main__": 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"]: + + for (loc, attrs) in db["locations"]: travel = attrs["travel"] if len(travel) > 0: for dest in travel: @@ -157,7 +157,7 @@ if __name__ == "__main__": if action[0] == "goto": dest = forward(action[1]) if not (subset(loc) or subset(dest)): - continue; + continue arc = "%s -> %s" % (loc[4:], dest[4:]) label=",".join(verbs).lower() if len(label) > 0: