Solve path between 2 cells

  1. given a grid where random cells are either 0 or 1
  2. given a starting cell (the value will be 0) call it [X,Y]
  3. given an ending cell (also 0) call it [X1,Y1]
  4. find the shortest path between [X,Y] and [X1,Y1] traveling only on cells that are 0
  5. note … there may NOT be a path and this too needs to be captured

the path need not be a straight line and in most cases will not be

well the answer is
the A* Algorithm

now to find an example I can adapt :slight_smile:

Ha! I asked POE.COM (an AI) to write one… .and it did… and it compiled…
now to see if it works.

1 Like

Take a look at this Dave:

All of Amit’s stuff is top notch.

1 Like

no no no… the Air Force has its own Algorithm :wink:

The code written by POE.com actually worked… I had to make one tiny adjustment to get it to fit the rest of the code in my app… Color me impressed

1 Like

AI coding is kinda like doing a google search and clicking the “I’m feeling lucky” button. I LOVE it. PHPStorm give me suggestions as I type code and sometimes the suggestion is better AND more consistent than what I planned to do.

The result needs to be verified either way… :slight_smile:

I’ve had pretty good results with Go code too. I asked for something specific with replacing a string in a pattern and I assumed it would give me a RegEx pattern. It did not. So when I asked for RegEx version it gave me one that doesn’t work in the normal Go library. And in the long run I ended up using something similar to what it originally gave me.

So yeah, I think it’s just a better search engine that puts it in an easier format. In the long run you still have to debug it and approve of the results.

2 Likes

just try POE.com with Python code… pretty impressive