Skip to content

tdib/maze-pathfinder

Repository files navigation

COSC1076 Assignment 1 - Maze Pathfinder

This is a maze pathfinder that works following a few steps. The maze will first be loaded into the program, and it will then be scanned. The robot can go up, down, left, or right, and for each of these moves it will predict which one is the closest to the goal. It will then move to that particular node and repeat the process until it has reached the goal. Once this is done, these nodes can be backtracked to find the shortest path to the goal. This shortest path is then printed along with the directions taken to get to each location. If the goal node is not reachable after visiting all other possible nodes, the maze will instead be printed with an 'x' in each visited location to indicate exactly where it has been.

Tests

Edge Cases

The following edge cases are organised in order of testing. They begin extremely simple and gradually become slightly more complex, testing various functionalities.

1.narrow-path.env: The simplest test, the pathfinder will simply need to travel in a line straight down. This tests that it will converge to the goal, and also tests it's behaviour upon reaching the goal (e.g. if it actually travels to the goal or stops before it).
2.one-way-square.env: Similar to narrow-path.env, but contains turns to test movement in all directions.
3.cross.env: Primarily used to test adding multiple nodes to the open list, and moving in the correct direction.
4.F.env: The first maze to contain multiple paths, tests that the pathfinder is actually able to navigate the open list properly.
5.square-path-dual-choice.env: Contains multiple paths of equal distance to ensure the algorithm will not collapse on itself.
6.diagonal-path-block.env: A slightly more intricate version of F.env, attempts to trick the pathfinder into taking dead ends, whilst still being required to navigate around the proper corners.
7.up-open-field.env: A straightforward maze that ensures the open list is working flawlessly, as well as the navigation when it is given a variety of nodes to select from.
8.diagonal-open-field.env: An entirely open field to see how the pathfinder reacts when there are many nodes of equal distance.
9.no-possible-moves.env: (Extra case) Tests behaviour when there are absolutely no nodes to travel to.
10.unreachable-goal.env: (Extra case) Tests behaviour when the goal node cannot be reached. If the pathfinder cannot legally reach the goal node, the path will be printed out as 'x' on the map, displaying every node that was visited.

Standard Mazes

Mazes named standard-maze-0x.env are complete mazes and are used to test the pathfinder's ability to navigate its environment. Five of these have been provided to ensure that the goal can be found, even with a number of obstacles and intricacies. These mazes are listed below.

standard-maze-01.env
standard-maze-02.env
standard-maze-03.env
standard-maze-04.env
standard-maze-05.env

Milestone 4 Mazes

Three mazes have been provided to test the functionality of the dynamically sized maze. They have been named with respect to their dimensions.

10x10.env: A maze smaller than the regular 20x20 dimensions.
25x10.env: A rectangular maze to demonstrate the rectangular functionality.
25x25.env: A maze larger than the 20x20 dimensions.

Additional Functionality

As mentioned within unreachable-goal.env, when the goal node cannot be reached, instead of outputting the path which was taken to arrive at each location, an 'x' will be printed at every visited location. This shows exactly where the solid walls are placed (i.e. the area the pathfinder cannot escape), and helps to differentiate whether or not the goal node has been reached.

About

An ASCII maze pathfinder.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published