projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
74b1589
)
Add verbose optionm to grapher.
author
Eric S. Raymond
<esr@thyrsus.com>
Wed, 20 Apr 2022 00:39:54 +0000
(20:39 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Wed, 20 Apr 2022 00:39:54 +0000
(20:39 -0400)
make_graph.py
patch
|
blob
|
history
diff --git
a/make_graph.py
b/make_graph.py
index b24070d70d91d04e95bc2ced94800b4cd5ba36d1..1da5a7619428921d61bf6695fa7bd230d7039db6 100755
(executable)
--- a/
make_graph.py
+++ b/
make_graph.py
@@
-8,6
+8,7
@@
Make a DOT graph of Colossal Cave.
-d = emit graoh of mazw all different
-m = emit graph of maze all alike
-s = emit graph of surface locations
-d = emit graoh of mazw all different
-m = emit graph of maze all alike
-s = emit graph of surface locations
+-v = include internal sy,no;s in room labels
"""
# Copyright (c) 2017 by Eric S. Raymond
# SPDX-License-Identifier: BSD-2-clause
"""
# Copyright (c) 2017 by Eric S. Raymond
# SPDX-License-Identifier: BSD-2-clause
@@
-38,7
+39,9
@@
def abbreviate(d):
def roomlabel(loc):
"Generate a room label from the description, if possible"
loc_descriptions = location_lookup[loc]['description']
def roomlabel(loc):
"Generate a room label from the description, if possible"
loc_descriptions = location_lookup[loc]['description']
- description = loc[4:]
+ description = ""
+ if debug:
+ description = loc[4:]
longd = loc_descriptions["long"]
short = loc_descriptions["maptag"] or loc_descriptions["short"]
if short is None and longd is not None and len(longd) < 20:
longd = loc_descriptions["long"]
short = loc_descriptions["maptag"] or loc_descriptions["short"]
if short is None and longd is not None and len(longd) < 20:
@@
-58,7
+61,9
@@
def roomlabel(loc):
short = short[:2].upper() + short[2:]
else:
short = short[0].upper() + short[1:]
short = short[:2].upper() + short[2:]
else:
short = short[0].upper() + short[1:]
- description += "\\n" + short
+ if debug:
+ description += "\\n"
+ description += short
if loc in startlocs:
description += "\\n(" + ",".join(startlocs[loc]).lower() + ")"
return description
if loc in startlocs:
description += "\\n(" + ",".join(startlocs[loc]).lower() + ")"
return description
@@
-97,12
+102,13
@@
if __name__ == "__main__":
location_lookup = dict(db["locations"])
try:
location_lookup = dict(db["locations"])
try:
- (options, arguments) = getopt.getopt(sys.argv[1:], "adms")
+ (options, arguments) = getopt.getopt(sys.argv[1:], "adms
v
")
except getopt.GetoptError as e:
print(e)
sys.exit(1)
subset = allalike
except getopt.GetoptError as e:
print(e)
sys.exit(1)
subset = allalike
+ debug = False
for (switch, val) in options:
if switch == '-a':
subset = lambda loc: True
for (switch, val) in options:
if switch == '-a':
subset = lambda loc: True
@@
-112,6
+118,8
@@
if __name__ == "__main__":
subset = allalike
elif switch == '-s':
subset = surface
subset = allalike
elif switch == '-s':
subset = surface
+ elif switch == '-v':
+ debug = True
else:
sys.stderr.write(__doc__)
raise SystemExit(1)
else:
sys.stderr.write(__doc__)
raise SystemExit(1)