Bounty Ended with 500 reputation awarded by lirtosiast
5 Markdown hates spaces...
source | link
  • Reference array: The grid is stored columns 2 apart, with a value at each step:
    • 0 represents either a , 0 or a valid place that was accessed more moves ago than would be required to exit the place in any direction.
    • 1 represents a + that hasn't yet been reached.
    • (higher number) represents the move number where there will have been enough moves to exit the place in any direction.
    • 10 also represents a new-line: these are never reached assuming they immediately follow the last non-white-space character.
  • Rail: Consists of -1s with a single -2 on the left, allows memory pointer to quickly return to the core processing area.
  • Path stack: Stores each of the untested paths in order by path ID (which is directly related to move number so the shorter paths are tested first). The path is stored as follows:
    Path layout
    • Rot: the rotation at the end of the current path: 0 for up-left and increasing clockwise to 5
    • Move: the current move number (instructions - 1)
    • Path: the current path, stored in quaternary with F, R, L as 1, 2, 3 respectively
    • x/y: coordinates at the end of the current path: x+1 -1s right then y values up (though y=0 is processed as 1 anyway for the purposes of separating the rail from the reference data)
  • Reference array: The grid is stored columns 2 apart, with a value at each step:
    • 0 represents either a , 0 or a valid place that was accessed more moves ago than would be required to exit the place in any direction.
    • 1 represents a + that hasn't yet been reached.
    • (higher number) represents the move number where there will have been enough moves to exit the place in any direction.
    • 10 also represents a new-line: these are never reached assuming they immediately follow the last non-white-space character.
  • Rail: Consists of -1s with a single -2 on the left, allows memory pointer to quickly return to the core processing area.
  • Path stack: Stores each of the untested paths in order by path ID (which is directly related to move number so the shorter paths are tested first). The path is stored as follows:
    Path layout
    • Rot: the rotation at the end of the current path: 0 for up-left and increasing clockwise to 5
    • Move: the current move number (instructions - 1)
    • Path: the current path, stored in quaternary with F, R, L as 1, 2, 3 respectively
    • x/y: coordinates at the end of the current path: x+1 -1s right then y values up (though y=0 is processed as 1 anyway for the purposes of separating the rail from the reference data)
  • Reference array: The grid is stored columns 2 apart, with a value at each step:
    • 0 represents either a , 0 or a valid place that was accessed more moves ago than would be required to exit the place in any direction.
    • 1 represents a + that hasn't yet been reached.
    • (higher number) represents the move number where there will have been enough moves to exit the place in any direction.
    • 10 also represents a new-line: these are never reached assuming they immediately follow the last non-white-space character.
  • Rail: Consists of -1s with a single -2 on the left, allows memory pointer to quickly return to the core processing area.
  • Path stack: Stores each of the untested paths in order by path ID (which is directly related to move number so the shorter paths are tested first). The path is stored as follows:
    Path layout
    • Rot: the rotation at the end of the current path: 0 for up-left and increasing clockwise to 5
    • Move: the current move number (instructions - 1)
    • Path: the current path, stored in quaternary with F, R, L as 1, 2, 3 respectively
    • x/y: coordinates at the end of the current path: x+1 -1s right then y values up (though y=0 is processed as 1 anyway for the purposes of separating the rail from the reference data)
4 Re-uploaded image
source | link

FunctionsFunctions
Note: -111 shouldDivisions are generally correct but may occasionally be -110 in the above imagea rough guess.

  • S: The starting function - reads the input and sets up the "reference array", then starts the "path stack" with the three paths F, R and L ready for main processing. Instruction pointer 0 moves to function 0 while the execution moves to function 1.
  • 1 (-11): The main function - uses 2 to get a path, 3 to check its validity, and if valid goes to function -110/-10 twice and then 4 three times to copy the new paths across into the "path stack", finishing by returning to itself. May call function 5 if the path is at the end location.
  • 2: Gets the next path off the "path stack" ready for processing, calls function -1 if no paths left on the stack. Returns to function 1.
  • 3: Takes a pair of values as well as the move number and checks the "reference array" to see whether the current path has ended at a valid location. A valid location is either the start within the first 3 moves, or any + within 2 moves of it first being reached. Returns to function 1.
  • -10/-110: Copies the current path. Returns to function 1.
  • 0: Helps function 1 to manage direction of movement with F. Returns to function 1.
  • 4: Takes a copy of the current path and interlinked with function 1 changes it into the same path with either F, R or L appended. Returns to function 1.
  • 5: Takes the path and prints out the correct path (e.g. FFLF), then terminates the program.
  • -1: Prints Invalid maze! and terminates.
  • (ArrowsDouble arrows): Due to lack of space, function 1/-11 had to go off into the space above function -1.

Functions
Note: -111 should be -110 in the above image

  • S: The starting function - reads the input and sets up the "reference array", then starts the "path stack" with the three paths F, R and L ready for main processing. Instruction pointer 0 moves to function 0 while the execution moves to function 1.
  • 1 (-11): The main function - uses 2 to get a path, 3 to check its validity, and if valid goes to function -110/-10 twice and then 4 three times to copy the new paths across into the "path stack", finishing by returning to itself. May call function 5 if the path is at the end location.
  • 2: Gets the next path off the "path stack" ready for processing, calls function -1 if no paths left on the stack. Returns to function 1.
  • 3: Takes a pair of values as well as the move number and checks the "reference array" to see whether the current path has ended at a valid location. A valid location is either the start within the first 3 moves, or any + within 2 moves of it first being reached. Returns to function 1.
  • -10/-110: Copies the current path. Returns to function 1.
  • 0: Helps function 1 to manage direction of movement with F. Returns to function 1.
  • 4: Takes a copy of the current path and interlinked with function 1 changes it into the same path with either F, R or L appended. Returns to function 1.
  • 5: Takes the path and prints out the correct path (e.g. FFLF), then terminates the program.
  • -1: Prints Invalid maze! and terminates.
  • (Arrows): Due to lack of space, function 1/-11 had to go off into the space above function -1.

Functions
Note: Divisions are generally correct but may occasionally be a rough guess.

  • S: The starting function - reads the input and sets up the "reference array", then starts the "path stack" with the three paths F, R and L ready for main processing. Instruction pointer 0 moves to function 0 while the execution moves to function 1.
  • 1 (-11): The main function - uses 2 to get a path, 3 to check its validity, and if valid goes to function -110/-10 twice and then 4 three times to copy the new paths across into the "path stack", finishing by returning to itself. May call function 5 if the path is at the end location.
  • 2: Gets the next path off the "path stack" ready for processing, calls function -1 if no paths left on the stack. Returns to function 1.
  • 3: Takes a pair of values as well as the move number and checks the "reference array" to see whether the current path has ended at a valid location. A valid location is either the start within the first 3 moves, or any + within 2 moves of it first being reached. Returns to function 1.
  • -10/-110: Copies the current path. Returns to function 1.
  • 0: Helps function 1 to manage direction of movement with F. Returns to function 1.
  • 4: Takes a copy of the current path and interlinked with function 1 changes it into the same path with either F, R or L appended. Returns to function 1.
  • 5: Takes the path and prints out the correct path (e.g. FFLF), then terminates the program.
  • -1: Prints Invalid maze! and terminates.
  • (Double arrows): Due to lack of space, function 1/-11 had to go off into the space above function -1.
3 added 1924 characters in body
source | link

Click the images for a larger and more detailed version.

  • S: The starting function - reads the input and sets up the "reference array", then starts the "path stack" with the three paths F, R and L ready for main processing. Instruction Pointerpointer 0 moves to function 0 while the execution moves to function 1.
  • 1 (-11): The main function - uses 2 to get a path, 3 to check its validity, and if valid goes to function -110/-10 twice and then 4 three times to copy the new paths across into the "path stack", finishing by returning to itself. May call function 5 if the path is at the end location.
  • 2: Gets the next path off the "path stack" ready for processing, calls function -1 if no paths left on the stack. Returns to function 1.
  • 3: Takes a pair of values as well as the move number and checks the "reference array" to see whether the current path has ended at a valid location. A valid location is either the start within the first 3 moves, or any + within 2 moves of it first being reached. Returns to function 1.
  • -10/-110: Copies the current path. Returns to function 1.
  • 0: Helps function 1 to manage direction of movement with F. Returns to function 1.
  • 4: Takes a copy of the current path and interlinked with function 1 changes it into the same path with either F, R or L appended. Returns to function 1.
  • 5: Takes the path and prints out the correct path (e.g. FFLF), then terminates the program.
  • -1: Prints Invalid maze! and terminates.
  • (Arrows): Due to lack of space, function 1/-11 had to go off into the space above function -1.

Memory

Memory layout
Note: Thanks to Esoteric IDE again for the diagram

The memory consists of three main parts:

  • Reference array: The grid is stored columns 2 apart, with a value at each step:
    • 0 represents either a , 0 or a valid place that was accessed more moves ago than would be required to exit the place in any direction.
    • 1 represents a + that hasn't yet been reached.
    • (higher number) represents the move number where there will have been enough moves to exit the place in any direction.
    • 10 also represents a new-line: these are never reached assuming they immediately follow the last non-white-space character.
  • Rail: Consists of -1s with a single -2 on the left, allows memory pointer to quickly return to the core processing area.
  • Path stack: Stores each of the untested paths in order by path ID (which is directly related to move number so the shorter paths are tested first). The path is stored as follows:
    Path layout
    • Rot: the rotation at the end of the current path: 0 for up-left and increasing clockwise to 5
    • Move: the current move number (instructions - 1)
    • Path: the current path, stored in quaternary with F, R, L as 1, 2, 3 respectively
    • x/y: coordinates at the end of the current path: x+1 -1s right then y values up (though y=0 is processed as 1 anyway for the purposes of separating the rail from the reference data)

Other important memory locations:

  1. The x/y of the E is stored here.
  2. This space is used to transition paths in and out of memory.
  3. This location is the centre of where each path is stored during processing.
  • S: The starting function - reads the input and sets up the "reference array", then starts the "path stack" with the three paths F, R and L ready for main processing. Instruction Pointer 0 moves to function 0 while the execution moves to function 1.
  • 1 (-11): The main function - uses 2 to get a path, 3 to check its validity, and if valid goes to function -110/-10 twice and then 4 three times to copy the new paths across into the "path stack", finishing by returning to itself. May call function 5 if the path is at the end location.
  • 2: Gets the next path off the "path stack" ready for processing, calls function -1 if no paths left on the stack. Returns to function 1.
  • 3: Takes a pair of values as well as the move number and checks the "reference array" to see whether the current path has ended at a valid location. A valid location is either the start within the first 3 moves, or any + within 2 moves of it first being reached. Returns to function 1.
  • -10/-110: Copies the current path. Returns to function 1.
  • 0: Helps function 1 to manage direction of movement with F. Returns to function 1.
  • 4: Takes a copy of the current path and interlinked with function 1 changes it into the same path with either F, R or L appended. Returns to function 1.
  • 5: Takes the path and prints out the correct path (e.g. FFLF), then terminates the program.
  • -1: Prints Invalid maze! and terminates.
  • (Arrows): Due to lack of space, function 1/-11 had to go off into the space above function -1.

Click the images for a larger and more detailed version.

  • S: The starting function - reads the input and sets up the "reference array", then starts the "path stack" with the three paths F, R and L ready for main processing. Instruction pointer 0 moves to function 0 while the execution moves to function 1.
  • 1 (-11): The main function - uses 2 to get a path, 3 to check its validity, and if valid goes to function -110/-10 twice and then 4 three times to copy the new paths across into the "path stack", finishing by returning to itself. May call function 5 if the path is at the end location.
  • 2: Gets the next path off the "path stack" ready for processing, calls function -1 if no paths left on the stack. Returns to function 1.
  • 3: Takes a pair of values as well as the move number and checks the "reference array" to see whether the current path has ended at a valid location. A valid location is either the start within the first 3 moves, or any + within 2 moves of it first being reached. Returns to function 1.
  • -10/-110: Copies the current path. Returns to function 1.
  • 0: Helps function 1 to manage direction of movement with F. Returns to function 1.
  • 4: Takes a copy of the current path and interlinked with function 1 changes it into the same path with either F, R or L appended. Returns to function 1.
  • 5: Takes the path and prints out the correct path (e.g. FFLF), then terminates the program.
  • -1: Prints Invalid maze! and terminates.
  • (Arrows): Due to lack of space, function 1/-11 had to go off into the space above function -1.

Memory

Memory layout
Note: Thanks to Esoteric IDE again for the diagram

The memory consists of three main parts:

  • Reference array: The grid is stored columns 2 apart, with a value at each step:
    • 0 represents either a , 0 or a valid place that was accessed more moves ago than would be required to exit the place in any direction.
    • 1 represents a + that hasn't yet been reached.
    • (higher number) represents the move number where there will have been enough moves to exit the place in any direction.
    • 10 also represents a new-line: these are never reached assuming they immediately follow the last non-white-space character.
  • Rail: Consists of -1s with a single -2 on the left, allows memory pointer to quickly return to the core processing area.
  • Path stack: Stores each of the untested paths in order by path ID (which is directly related to move number so the shorter paths are tested first). The path is stored as follows:
    Path layout
    • Rot: the rotation at the end of the current path: 0 for up-left and increasing clockwise to 5
    • Move: the current move number (instructions - 1)
    • Path: the current path, stored in quaternary with F, R, L as 1, 2, 3 respectively
    • x/y: coordinates at the end of the current path: x+1 -1s right then y values up (though y=0 is processed as 1 anyway for the purposes of separating the rail from the reference data)

Other important memory locations:

  1. The x/y of the E is stored here.
  2. This space is used to transition paths in and out of memory.
  3. This location is the centre of where each path is stored during processing.
2 added 2114 characters in body; added 6 characters in body
source | link
1
source | link