I have this problem on what algorithm or approach will I consider to solve a particular problem of finding a path from point A to point B wherein both points aren't on the same plane (are on different floor / level of the compound - may not be on the same building).
I am considering both A* and Dijkstra's algorithms. Yet basing from this algorithm's this only (correct me if I am wrong) only focus on a single map plot. Having different map plots (due to many floors and many buildings) can have a different story for both of the said algorithm.
In line with the difficulty, I have devised a format to all of my maps to follow consistency of data. In each map there exists the data for the building name, floor number, and the sections each floor may have and with the floor plan (converted into a two-dimensional single character array). For example (Both maps are on different files):
//MainFloor1 //MainFloor2
Main Main
1st 2nd
1:Wall 1:Wall
2:Door 2:Door
3:Elevator 3:Elevator
# 4:Room1
1111441111 5:Room2
1 1 #
1 1 1111441111
1 1 1552 2441
1111221111 1551 1441
# 1551 1441
//End-MainFloor1 1111221111
#
//End-MainFloor2
From the given map if I want to consider going from Point A (Below the 1st '2' from lest of MainFloor1) to Point B (The first '4' from the top-left of MainFloor2) would return me the result.
// X is the path from Point A to Point B
1111X41111 1111X41111
1 X 1 1552XXXB41
1 X 1 1551 1441
1 X 1 1551 1441
1111A21111 1111221111
What approach will I consider or take to produce such result from the given map inputs?
Thanks
A*, BFS, and others are all algorithms that work on graphs. Your problem can be considered a graph where there is an edge between two nodes (vertices) if they are adjacent and on the same floor, or if they represent the same elevator but on different floors.
Note that you can build the graph explicitly in memory, but you don't have to - you can simply treat it like one from your pathfinder's perspective.