Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualKnolanCross

Posted 05 July 2013 - 02:04 PM

Remember that you must only look at the nodes at your open list, and you must not add a node at the open list unless it is a valid move from the node you are currently checking. In my blog there is an implementation if you want to take a look (but it is written on C).

 

It seems to me that you are adding every neighbor to the open list, and this is not correct.

 

In my implementation I use eight booleans (one for each possible neighbor) and I have two functions, one that checks straight cells and the other check diagonal cells. I first call the straight cell check, where I test if the cell is blocked, if it is the two diagonals that would pass by it must also be blocked. For instance, when If test the left cell and it is blocked, I already know that the upper left and lower left cells are also blocked and must not be included in the open list yet.

 

Hope this helps.


#3KnolanCross

Posted 05 July 2013 - 02:02 PM

Remember that you must only look at the nodes at your open list, and you must not add a node at the open list unless it is a valid move from the node you are currently checking. In my blog there is an implementation if you want to take a look (but it written on C).

 

It seems to me that you are adding every neighbor to the open list, and this is not correct.

 

In my implementation I use eight booleans (one for each possible neighbor) and I have two functions, one that checks straight cells and the other check diagonal cells. I first call the straight cell check, where I test if the cell is blocked, if it is the two diagonals that would pass by it must also be blocked. For instance, when If test the left cell and it is blocked, I already know that the upper left and lower left cells are also blocked and must not be included in the open list yet.

 

Hope this helps.


#2KnolanCross

Posted 05 July 2013 - 02:01 PM

Remember that you must only look at the nodes at your open list, and you must not add a node at the open list unless it is a valid move from the node you are currently checking. In my blog there is an implementation if you want to take a look (but it written on C).

 

It seems to me that you are adding every neighbor to the open list, and this is not correct.

 

In my implementation I use eight booleans (one for each possible neighbor) and I have two functions, one that checks straight cells and the other check diagonal cells. I first call the straight cell check, where I test if the cell is blocked, if it is the two diagonals that would pass by it must also be blocked. For instance, when If test the left cell and it is blocked, I already know that the upper left and lower left cells are invalid.

 

Hope this helps.


#1KnolanCross

Posted 05 July 2013 - 02:00 PM

Remember that you must only look at the nodes at your open list, and you must not add a node at the open list unless it is a valid move from the node you are currently checking. In my blog there is an implementation if you want to take a look (but it written on C).

 

It seems to me that you are adding every neighbor to the open list, and this is not correct.

In my algorithm I use eight booleans and I have two functions, one that checks straight cells and the other check diagonal cells. I first call the straight cell check, where I test if the cell is blocked, if it is the two diagonals that would pass by it must also be blocked. For instance, when If test the left cell and it is blocked, I already know that the upper left and lower left cells are invalid.

 

Hope this helps.


PARTNERS