From 6dd37a6ec31285d8becb265f47bc49fda08276f5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 6 Apr 2022 18:59:14 -0400 Subject: [PATCH] Namespace splittiing to prune the maze graph. No eeffect on gameplay. --- TODO | 4 +++- adventure.yaml | 44 ++++++++++++++++++++++---------------------- init.c | 4 ++-- make_graph.py | 8 ++++++-- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/TODO b/TODO index 4290528..d98209a 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,7 @@ remain to be cleaned up: * The program is still pretty much typeless. Some attempt has been made to introduce semantic types, but the job is barely started. -* More possible vase tests: FILL VASE while it's on the ground next to you; +* More possible vase tests: DROP VASE in the Soft Room; DROP VASE in the well house and confirm that you do/don't get points for it; die while carrying the vase and confirm that it doesn't break. @@ -15,3 +15,5 @@ We are aware that the lamp currently used as the project logo is a hurricane lamp, not a proper miner's lamp. Submissions of potential replacement images would be welcome. +It would be fun to write a script that processes the dungeon YAML +into a DOT graph. diff --git a/adventure.yaml b/adventure.yaml index a1925a8..7b40eaf 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -942,9 +942,9 @@ locations: !!omap hints: [*maze] travel: [ {verbs: [EAST], action: [goto, LOC_ALIKE2]}, - {verbs: [DOWN], action: [goto, LOC_DEADEND3]}, + {verbs: [DOWN], action: [goto, LOC_MAZEEND3]}, {verbs: [SOUTH], action: [goto, LOC_ALIKE6]}, - {verbs: [NORTH], action: [goto, LOC_DEADEND9]}, + {verbs: [NORTH], action: [goto, LOC_MAZEEND9]}, ] - LOC_ALIKE4: description: @@ -955,11 +955,11 @@ locations: !!omap travel: [ {verbs: [WEST], action: [goto, LOC_ALIKE1]}, {verbs: [NORTH], action: [goto, LOC_ALIKE2]}, - {verbs: [EAST], action: [goto, LOC_DEADEND1]}, - {verbs: [SOUTH], action: [goto, LOC_DEADEND2]}, + {verbs: [EAST], action: [goto, LOC_MAZEEND1]}, + {verbs: [SOUTH], action: [goto, LOC_MAZEEND2]}, {verbs: [UPWAR, DOWN], action: [goto, LOC_ALIKE14]}, ] -- LOC_DEADEND1: +- LOC_MAZEEND1: description: long: 'Dead end' short: !!null @@ -968,7 +968,7 @@ locations: !!omap travel: [ {verbs: [WEST, OUT], action: [goto, LOC_ALIKE4]}, ] -- LOC_DEADEND2: +- LOC_MAZEEND2: description: long: 'Dead end' short: !!null @@ -977,7 +977,7 @@ locations: !!omap travel: [ {verbs: [EAST, OUT], action: [goto, LOC_ALIKE4]}, ] -- LOC_DEADEND3: +- LOC_MAZEEND3: description: long: 'Dead end' short: !!null @@ -1032,7 +1032,7 @@ locations: !!omap {verbs: [SOUTH], action: [goto, LOC_ALIKE8]}, {verbs: [UPWAR], action: [goto, LOC_ALIKE9]}, {verbs: [NORTH], action: [goto, LOC_ALIKE10]}, - {verbs: [DOWN], action: [goto, LOC_DEADEND11]}, + {verbs: [DOWN], action: [goto, LOC_MAZEEND11]}, ] - LOC_ALIKE9: description: @@ -1043,9 +1043,9 @@ locations: !!omap travel: [ {verbs: [WEST], action: [goto, LOC_ALIKE7]}, {verbs: [NORTH], action: [goto, LOC_ALIKE8]}, - {verbs: [SOUTH], action: [goto, LOC_DEADEND4]}, + {verbs: [SOUTH], action: [goto, LOC_MAZEEND4]}, ] -- LOC_DEADEND4: +- LOC_MAZEEND4: description: long: 'Dead end' short: !!null @@ -1063,10 +1063,10 @@ locations: !!omap travel: [ {verbs: [WEST], action: [goto, LOC_ALIKE8]}, {verbs: [NORTH], action: [goto, LOC_ALIKE10]}, - {verbs: [DOWN], action: [goto, LOC_DEADEND5]}, + {verbs: [DOWN], action: [goto, LOC_MAZEEND5]}, {verbs: [EAST], action: [goto, LOC_PITBRINK]}, ] -- LOC_DEADEND5: +- LOC_MAZEEND5: description: long: 'Dead end' short: !!null @@ -1086,11 +1086,11 @@ locations: !!omap travel: [ {verbs: [DOWN, CLIMB], action: [goto, LOC_BIRD]}, {verbs: [WEST], action: [goto, LOC_ALIKE10]}, - {verbs: [SOUTH], action: [goto, LOC_DEADEND6]}, + {verbs: [SOUTH], action: [goto, LOC_MAZEEND6]}, {verbs: [NORTH], action: [goto, LOC_ALIKE12]}, {verbs: [EAST], action: [goto, LOC_ALIKE13]}, ] -- LOC_DEADEND6: +- LOC_MAZEEND6: description: long: 'Dead end' short: !!null @@ -1362,9 +1362,9 @@ locations: !!omap {verbs: [NORTH], action: [goto, LOC_ALIKE1]}, {verbs: [WEST], action: [goto, LOC_ALIKE11]}, {verbs: [SOUTH], action: [goto, LOC_ALIKE11]}, - {verbs: [EAST], action: [goto, LOC_DEADEND8]}, + {verbs: [EAST], action: [goto, LOC_MAZEEND8]}, ] -- LOC_DEADEND8: +- LOC_MAZEEND8: description: long: 'Dead end' short: !!null @@ -1373,7 +1373,7 @@ locations: !!omap travel: [ {verbs: [WEST, OUT], action: [goto, LOC_ALIKE11]}, ] -- LOC_DEADEND9: +- LOC_MAZEEND9: description: long: 'Dead end' short: !!null @@ -1390,7 +1390,7 @@ locations: !!omap travel: [ {verbs: [SOUTH], action: [goto, LOC_PITBRINK]}, {verbs: [EAST], action: [goto, LOC_ALIKE13]}, - {verbs: [WEST], action: [goto, LOC_DEADEND10]}, + {verbs: [WEST], action: [goto, LOC_MAZEEND10]}, ] - LOC_ALIKE13: description: @@ -1400,9 +1400,9 @@ locations: !!omap travel: [ {verbs: [NORTH], action: [goto, LOC_PITBRINK]}, {verbs: [WEST], action: [goto, LOC_ALIKE12]}, - {verbs: [NW], action: [goto, LOC_DEADEND12]}, + {verbs: [NW], action: [goto, LOC_MAZEEND12]}, ] -- LOC_DEADEND10: +- LOC_MAZEEND10: description: long: 'Dead end' short: !!null @@ -1410,7 +1410,7 @@ locations: !!omap travel: [ {verbs: [EAST, OUT], action: [goto, LOC_ALIKE12]}, ] -- LOC_DEADEND11: +- LOC_MAZEEND11: description: long: 'Dead end' short: !!null @@ -1762,7 +1762,7 @@ locations: !!omap {verbs: [NORTH, ACROS, CROSS], cond: [not, RESER, WATERS_PARTED], action: [speak, BAD_DIRECTION]}, {verbs: [NORTH], action: [goto, LOC_RESBOTTOM]}, ] -- LOC_DEADEND12: +- LOC_MAZEEND12: description: long: 'Dead end' short: !!null diff --git a/init.c b/init.c index a4a77aa..a897936 100644 --- a/init.c +++ b/init.c @@ -31,8 +31,8 @@ struct game_t game = { * chest's eventual location inside the maze. This loc is saved * in chloc for ref. The dead end in the other maze has its * loc stored in chloc2. */ - .dloc[6] = LOC_DEADEND12, - .chloc = LOC_DEADEND12, + .dloc[6] = LOC_MAZEEND12, + .chloc = LOC_MAZEEND12, .chloc2 = LOC_DEADEND13, .abbnum = 5, .clock1 = WARNTIME, diff --git a/make_graph.py b/make_graph.py index 28af8f7..cc92964 100755 --- a/make_graph.py +++ b/make_graph.py @@ -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"] -- 2.31.1