Namespace splittiing to prune the maze graph. No eeffect on gameplay.

This commit is contained in:
Eric S. Raymond 2022-04-06 18:59:14 -04:00
parent 07f77a8ffd
commit 6dd37a6ec3
4 changed files with 33 additions and 27 deletions

4
TODO
View file

@ -6,7 +6,7 @@ remain to be cleaned up:
* The program is still pretty much typeless. Some attempt has been * The program is still pretty much typeless. Some attempt has been
made to introduce semantic types, but the job is barely started. 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 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 that you do/don't get points for it; die while carrying the vase and
confirm that it doesn't break. 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 hurricane lamp, not a proper miner's lamp. Submissions of potential
replacement images would be welcome. replacement images would be welcome.
It would be fun to write a script that processes the dungeon YAML
into a DOT graph.

View file

@ -942,9 +942,9 @@ locations: !!omap
hints: [*maze] hints: [*maze]
travel: [ travel: [
{verbs: [EAST], action: [goto, LOC_ALIKE2]}, {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: [SOUTH], action: [goto, LOC_ALIKE6]},
{verbs: [NORTH], action: [goto, LOC_DEADEND9]}, {verbs: [NORTH], action: [goto, LOC_MAZEEND9]},
] ]
- LOC_ALIKE4: - LOC_ALIKE4:
description: description:
@ -955,11 +955,11 @@ locations: !!omap
travel: [ travel: [
{verbs: [WEST], action: [goto, LOC_ALIKE1]}, {verbs: [WEST], action: [goto, LOC_ALIKE1]},
{verbs: [NORTH], action: [goto, LOC_ALIKE2]}, {verbs: [NORTH], action: [goto, LOC_ALIKE2]},
{verbs: [EAST], action: [goto, LOC_DEADEND1]}, {verbs: [EAST], action: [goto, LOC_MAZEEND1]},
{verbs: [SOUTH], action: [goto, LOC_DEADEND2]}, {verbs: [SOUTH], action: [goto, LOC_MAZEEND2]},
{verbs: [UPWAR, DOWN], action: [goto, LOC_ALIKE14]}, {verbs: [UPWAR, DOWN], action: [goto, LOC_ALIKE14]},
] ]
- LOC_DEADEND1: - LOC_MAZEEND1:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -968,7 +968,7 @@ locations: !!omap
travel: [ travel: [
{verbs: [WEST, OUT], action: [goto, LOC_ALIKE4]}, {verbs: [WEST, OUT], action: [goto, LOC_ALIKE4]},
] ]
- LOC_DEADEND2: - LOC_MAZEEND2:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -977,7 +977,7 @@ locations: !!omap
travel: [ travel: [
{verbs: [EAST, OUT], action: [goto, LOC_ALIKE4]}, {verbs: [EAST, OUT], action: [goto, LOC_ALIKE4]},
] ]
- LOC_DEADEND3: - LOC_MAZEEND3:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1032,7 +1032,7 @@ locations: !!omap
{verbs: [SOUTH], action: [goto, LOC_ALIKE8]}, {verbs: [SOUTH], action: [goto, LOC_ALIKE8]},
{verbs: [UPWAR], action: [goto, LOC_ALIKE9]}, {verbs: [UPWAR], action: [goto, LOC_ALIKE9]},
{verbs: [NORTH], action: [goto, LOC_ALIKE10]}, {verbs: [NORTH], action: [goto, LOC_ALIKE10]},
{verbs: [DOWN], action: [goto, LOC_DEADEND11]}, {verbs: [DOWN], action: [goto, LOC_MAZEEND11]},
] ]
- LOC_ALIKE9: - LOC_ALIKE9:
description: description:
@ -1043,9 +1043,9 @@ locations: !!omap
travel: [ travel: [
{verbs: [WEST], action: [goto, LOC_ALIKE7]}, {verbs: [WEST], action: [goto, LOC_ALIKE7]},
{verbs: [NORTH], action: [goto, LOC_ALIKE8]}, {verbs: [NORTH], action: [goto, LOC_ALIKE8]},
{verbs: [SOUTH], action: [goto, LOC_DEADEND4]}, {verbs: [SOUTH], action: [goto, LOC_MAZEEND4]},
] ]
- LOC_DEADEND4: - LOC_MAZEEND4:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1063,10 +1063,10 @@ locations: !!omap
travel: [ travel: [
{verbs: [WEST], action: [goto, LOC_ALIKE8]}, {verbs: [WEST], action: [goto, LOC_ALIKE8]},
{verbs: [NORTH], action: [goto, LOC_ALIKE10]}, {verbs: [NORTH], action: [goto, LOC_ALIKE10]},
{verbs: [DOWN], action: [goto, LOC_DEADEND5]}, {verbs: [DOWN], action: [goto, LOC_MAZEEND5]},
{verbs: [EAST], action: [goto, LOC_PITBRINK]}, {verbs: [EAST], action: [goto, LOC_PITBRINK]},
] ]
- LOC_DEADEND5: - LOC_MAZEEND5:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1086,11 +1086,11 @@ locations: !!omap
travel: [ travel: [
{verbs: [DOWN, CLIMB], action: [goto, LOC_BIRD]}, {verbs: [DOWN, CLIMB], action: [goto, LOC_BIRD]},
{verbs: [WEST], action: [goto, LOC_ALIKE10]}, {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: [NORTH], action: [goto, LOC_ALIKE12]},
{verbs: [EAST], action: [goto, LOC_ALIKE13]}, {verbs: [EAST], action: [goto, LOC_ALIKE13]},
] ]
- LOC_DEADEND6: - LOC_MAZEEND6:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1362,9 +1362,9 @@ locations: !!omap
{verbs: [NORTH], action: [goto, LOC_ALIKE1]}, {verbs: [NORTH], action: [goto, LOC_ALIKE1]},
{verbs: [WEST], action: [goto, LOC_ALIKE11]}, {verbs: [WEST], action: [goto, LOC_ALIKE11]},
{verbs: [SOUTH], 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: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1373,7 +1373,7 @@ locations: !!omap
travel: [ travel: [
{verbs: [WEST, OUT], action: [goto, LOC_ALIKE11]}, {verbs: [WEST, OUT], action: [goto, LOC_ALIKE11]},
] ]
- LOC_DEADEND9: - LOC_MAZEEND9:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1390,7 +1390,7 @@ locations: !!omap
travel: [ travel: [
{verbs: [SOUTH], action: [goto, LOC_PITBRINK]}, {verbs: [SOUTH], action: [goto, LOC_PITBRINK]},
{verbs: [EAST], action: [goto, LOC_ALIKE13]}, {verbs: [EAST], action: [goto, LOC_ALIKE13]},
{verbs: [WEST], action: [goto, LOC_DEADEND10]}, {verbs: [WEST], action: [goto, LOC_MAZEEND10]},
] ]
- LOC_ALIKE13: - LOC_ALIKE13:
description: description:
@ -1400,9 +1400,9 @@ locations: !!omap
travel: [ travel: [
{verbs: [NORTH], action: [goto, LOC_PITBRINK]}, {verbs: [NORTH], action: [goto, LOC_PITBRINK]},
{verbs: [WEST], action: [goto, LOC_ALIKE12]}, {verbs: [WEST], action: [goto, LOC_ALIKE12]},
{verbs: [NW], action: [goto, LOC_DEADEND12]}, {verbs: [NW], action: [goto, LOC_MAZEEND12]},
] ]
- LOC_DEADEND10: - LOC_MAZEEND10:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1410,7 +1410,7 @@ locations: !!omap
travel: [ travel: [
{verbs: [EAST, OUT], action: [goto, LOC_ALIKE12]}, {verbs: [EAST, OUT], action: [goto, LOC_ALIKE12]},
] ]
- LOC_DEADEND11: - LOC_MAZEEND11:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null
@ -1762,7 +1762,7 @@ locations: !!omap
{verbs: [NORTH, ACROS, CROSS], cond: [not, RESER, WATERS_PARTED], action: [speak, BAD_DIRECTION]}, {verbs: [NORTH, ACROS, CROSS], cond: [not, RESER, WATERS_PARTED], action: [speak, BAD_DIRECTION]},
{verbs: [NORTH], action: [goto, LOC_RESBOTTOM]}, {verbs: [NORTH], action: [goto, LOC_RESBOTTOM]},
] ]
- LOC_DEADEND12: - LOC_MAZEEND12:
description: description:
long: 'Dead end' long: 'Dead end'
short: !!null short: !!null

4
init.c
View file

@ -31,8 +31,8 @@ struct game_t game = {
* chest's eventual location inside the maze. This loc is saved * chest's eventual location inside the maze. This loc is saved
* in chloc for ref. The dead end in the other maze has its * in chloc for ref. The dead end in the other maze has its
* loc stored in chloc2. */ * loc stored in chloc2. */
.dloc[6] = LOC_DEADEND12, .dloc[6] = LOC_MAZEEND12,
.chloc = LOC_DEADEND12, .chloc = LOC_MAZEEND12,
.chloc2 = LOC_DEADEND13, .chloc2 = LOC_DEADEND13,
.abbnum = 5, .abbnum = 5,
.clock1 = WARNTIME, .clock1 = WARNTIME,

View file

@ -9,7 +9,11 @@ import sys, yaml
def allalike(loc): def allalike(loc):
"Select out loci related to the Maze All Alike" "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__": if __name__ == "__main__":
with open("adventure.yaml", "r") as f: with open("adventure.yaml", "r") as f:
@ -22,7 +26,7 @@ if __name__ == "__main__":
travel = attrs["travel"] travel = attrs["travel"]
if len(travel) > 0: if len(travel) > 0:
for dest in travel: for dest in travel:
verbs = dest["verbs"] verbs = [abbreviate(x) for x in dest["verbs"]]
if len(verbs) == 0: if len(verbs) == 0:
continue continue
action = dest["action"] action = dest["action"]