Well, I've finally finished it (I've attached the .txt file at the bottom of this post). Right now, it basically finds it's way from the start cell to the goal cell and prints the map with the path and analyzed cells marked (at least that's what it's supposed to). It is based primarily on Abe Howell's ER1 mapper: link: http://www.abotics.com/buildit_yourself.htm
(it's at the very bottom of the page). His algorithm is written in Visual Basic, so I tried the best I could to "translate" it into a Python script.
Alright, here's the problem(s). It treats blocked cells as regular, open cells. In my program, blocked cells are represented by zeros and open cells are represented by ones (just like Admin's wavefront tutorial). The original program set up a boolean called "CellStatus", it was true if the cell being analyzed was open and false if it was blocked. So part of the script looked like this:
IF (CellStatus = false) THEN:
Basically, the code could be written without a boolean, just by saying: if cell = 0, ignore this cell and jump to south cell (because 0 means it's blocked). There are no "goto" abilities in Python like there are in Visual Basic or C/C++. So, I wrote it a little differently:
if map[Ycell][Xcell] != 0:
Therefore, a cell that does equal zero will not satisfy the first if condition, will not be analyzed and the program will go to the next if condition for the next cell (skipping the cell that equals zero). However, this does not happen; it treats each blocked cell as an open cell and I don't know why.
The second and (hopefully) last problem is about parent cells. In both C++ and Visual Basic versions of this algorithm, parent cells are represented like this:
parent(cell A) = [cell B]
Now, this type of xy variable does not exist in Python, so I made the surrounding cells parent the middle, current cell. So when a cell with the lowest F score is selected, it is the parent of the four surrounding cells and the next cell with the lowest F score is the parent of it's surrounding cells. These parent/formerly current cells are put in a list and the map has them marked. However, when the map is printed, every analyzed cell is marked as a parent cell (so no path is visible). I think it might have something to do with my heuristics (usually 3 out of 4 surrounding cells have equal F scores, so my program picks the first one it comes across as the next cell to be analyzed), or I may be approaching the selection of parent cells completely wrong, I don't know.
I have tried to figure out how to get around these problems, but I just can't think of anything; so I ask you guys for help. I also ask for feedback on my code, for it would be most helpful.
EDIT: In the attached code, I typed a '>' instead of a '!=' as I stated above. I did this because I was trying different methods and I forgot to return the code to its original state. They both mean the same thing (since unblocked cells have values greater than 0) and both gave unsatisfactory results (treating blocked cells as open cells).