Remarks: Maze Walker
From Maze
(Difference between revisions)
(→Walking the Maze) | (→Walking the Maze) | ||
| Line 109: | Line 109: | ||
Thus, a particular screen location (such as the yellow highlighted location in [figure]), identifies one of the slanting characters (a wall segment), but does not identify which side of the wall (corridor segment) is currently occupied. | Thus, a particular screen location (such as the yellow highlighted location in [figure]), identifies one of the slanting characters (a wall segment), but does not identify which side of the wall (corridor segment) is currently occupied. | ||
| + | [[File:MazeLocationAmbiguity.gif]] | ||
| + | |||
The esoteric programming language Path, which uses forward and backslashes as reflectors to control the 2D program counter, provides a set of movement rules that can be used to disambiguate maze location. Given a character location (identified wall segment), we can imagine someone approaching the wall from above, below, left and right. The walker ricochets off the wall in the directions indicated in [figure]. Approaching a forward slashing character from above or from the left implicitly indicates that the walker is in the corridor segment above the wall, while approaching from below or from the right indicates the walker is in the corridor segment below the wall. These relationships are reversed for the backward slashing characters. Therefore, in addition to an x,y location, a third piece of information, movement direction, is required to uniquely identify a maze location as well as where the walker will go next. | The esoteric programming language Path, which uses forward and backslashes as reflectors to control the 2D program counter, provides a set of movement rules that can be used to disambiguate maze location. Given a character location (identified wall segment), we can imagine someone approaching the wall from above, below, left and right. The walker ricochets off the wall in the directions indicated in [figure]. Approaching a forward slashing character from above or from the left implicitly indicates that the walker is in the corridor segment above the wall, while approaching from below or from the right indicates the walker is in the corridor segment below the wall. These relationships are reversed for the backward slashing characters. Therefore, in addition to an x,y location, a third piece of information, movement direction, is required to uniquely identify a maze location as well as where the walker will go next. | ||
| + | [[File:MazePathDirections.gif]] | ||
| + | |||
Given an initial location and direction, the walker moves through the maze in a drunken walk, bouncing off walls in the manner depicted in [figure]. | Given an initial location and direction, the walker moves through the maze in a drunken walk, bouncing off walls in the manner depicted in [figure]. | ||
| + | |||
| + | [[File:MazeWalkingDiagram.gif]] | ||
The BASIC code for the maze walker appears below. | The BASIC code for the maze walker appears below. | ||
