I am creating an A* algorithm in python, and I am trying to figure out how to save the locations that my algorithm has previously visited within a binary array such as the one below.
nmap = np.array([
[0,0,0,0],
[1,1,1,0],
[0,0,0,0],
[1,0,1,1],
[0,0,0,0]
])
The only way I can think of is to save the location of the previously visited binary numbers via coordinates. For instance,
nmap[0][0]
would save the first binary number in a list or dictionary, and thus would not be revisited. The problem is I am not sure how to achieve this. Please keep in mind that I want to save the coordinates as the algorithm is running instead of previously writing out the coordinates. My reasoning for this is if I have an array with thousands of integers, previously writing this code could be quite cumbersome. Anyone know how I can accomplish this?