I am trying to read in from 2 text files (one contains the start and end coordinates, the other is a map of costs for use with the Manhatten Distance) and I'm really struggling with the implementation of the code from various algorithms I've found.
I've been able to read in the text files and put them into 2 separate arrays fine, the real issue I;m having is with adding to the openlist and compares their costs so that the smallest goes onto the Priority Queue and then compare its neighbors, I just cannot work this out after hours upon hours of reading and watching youtube viedos on the subject, any help?
Lines 28-32: To be safe, you should initialize x and y also.
Lines 34-38 define and initialize 5 local variables that are destroyed when the constructor exits, so they don't actually do anything.
Line 50: Since x and y haven't been initialized, you're dereferenceing uninitialized pointers, which is never correct. x and y should probably be passed in as arguments.
Lines 86 & 87: If a C++ arrays has ARRAY_SIZE items, then they are accessed with indices 0 to ARRAY_SIZE-1, so mArray[ARRAY_SIZE] is out of bounds.
Lines 90-123: I suspect that strut pqueue should be defined outside the function, but it's hard to tell.
Can you tell us more about the problem that you're trying to solve? That will help us guide you.
What you need to do is:
1. Have a plan - preferably (and monotonously) pseudocode for it
2. Isolate the functionality you are having trouble with. (you've done that, sort of)
3, Forget about the main program and all its lines and write a test program on just the isolated part. Show us that with your pseudocode and I suspect that you'll get a better response because not everybody has expertise on A*
4. Once that isolated part is working the way you expect it to, put it into the main program.
5 Then and only then move to the next section on the pseudocode plan.
PS Since you are able to read in the file information successfully, hardcode it for the isolated test section.