Dylan Hanson
- Allow user manipulation of blank
100x100
grid through coordinate entry- Enter
origin
coordinates - Enter
destination
coordinates - Enter coordinates of obstacles along path
- OR: Obstacles randomly generated by computer
- Enter
- Determine shortest coordinate path from
origin
todestination
using Dijkstra's algorithm - Visualize path using inline console text
The user interface is entirely console based. It is structured hierarchically as a series of titled, nested menus. At each menu, the user is given a list of options, each identified by a letter, as well as a brief description of the menu/action to be opened/performed upon selection.
***************************************
MENU TITLE
A > Sub-menu 1
B > Sub-menu 2
C > Action 1
A
, B
, and C
are all options. By typing A
into the command line, Menu 1
will be entered.
Note: Option recognition is case insensitive and error-proof
There are many situations throughout the program in which the user will need to input coordinates. These can be entered in two ways:
X,Y
, with one coordinate pair on each lineX1,Y1
X2,Y2
X3,Y3
X4,Y4
X5,Y5
with multiple coordinates on each line, separated by spaces
Note: When prompted for one coordinate, even if the user enters multiple, the first one inputted will be used
It is key that the user be able to input their own obstacles. Obstacles can be added to the graph in two ways:
- User input
- User enters either a single coordinate for one obstacle, or two coordinates to define obstacle edges. When defining obstacles, you may not enter multiple coordinates on one line unless you are defining corners.
- Random generation
Obstacles are randomly computer-generated by selecting a random point on the graph, then selecting a diameter from 1 to 6. A block of that size is then placed at the coordinates.
An iterative algorithm that finds the most direct path from the
origin
node to thedestination
node. It does this by assuming that the first path to reach the ending node is also the fastest (i.e. shortest) path.
- All nodes have an intitial distance of infinity, except
starting node
, which has a distance ofzero
- Begin with
current node
. This will bestarting node
for first iteration - Find all edges connected to
current node
and save the length of each edge - For each edge:
-
if (current_node.distance + edge.length < connected_node.distance) then (connected_node.distance = current_node.distance + edge.length)
( Essentially, this gives each node a tangible, shortest possible distance from the starting point )
5. Find the node with the least distance in the ENTIRE GRAPH. This is now current node
6. If ending node
has been visited, the shortest path has been found
6. Repeat steps 2 through 6 until ending node
has been visited
This algorithm charts the path of least resistance to every point on the graph, allowing us to find that path for ending node
.
None currently known