trinity icon indicating copy to clipboard operation
trinity copied to clipboard

"FOLLOW SHADOW" can move you in the wrong direction

Open eriktorbjorn opened this issue 4 years ago • 0 comments

>LOOK
Crater's Edge

The forest around you is bent and splintered, as if a mighty fist had smashed
through the branches. Sooty fumes hang in the air; the earth is dark with ashes
and rubble.

The eastern path ends at the lip of a deep crater, forty or fifty feet across.

A triangular shadow inches across the ground.

>EXAMINE SHADOW
Its sharp point is sweeping slowly southeastward.

>FOLLOW SHADOW
You follow the shadow's sweep southeastward.

Bluff

A spectacular crop of toadstools extends far and wide across the valley below.
Narrow trails curve southeast and southwest, away from the edge of the bluff.

To the east stands a little cottage, nestled in a shady copse. The front door is
closed.

Except the Bluff is actually to the northwest of Crater's Edge. Southeast is blocked by trees.

This is because of a bug in RESET-SHDIRS. Usually Y is set to the direction property corresponding to X (the direction in which she shadow is moving), e.g. when X is "east", Y is P?EAST. But not when the shadow is moving to the southeast:

	       (<L? ,OSIGN 10>
		<COND (<ZERO? ,FLIP?>
		       <SET X "southeast">
		       <SET Y ,P?NW>
		       <SET Z "southwest">
		       <SET Q "northeast">)
		      (T
		       <SET X "southwest">
		       <SET Y ,P?NE>
		       <SET Z "southeast">
		       <SET Q "northwest">)>)

So the bug also happens when the world is flipped.

The actual walking is triggered by FOLLOW-SHADOW? and seems to be the only place where the shadow direction property is ever used:

		<TELL "You follow the " D ,PRSO "'s sweep ">
		<SHDIRWARD>
		<TELL ,PCR>
		<DO-WALK <GET ,SHDIRS 1>>

eriktorbjorn avatar Sep 23 '20 07:09 eriktorbjorn