reset password
Author Message
rabbott
Posts: 1649
Posted 15:56 May 26, 2012 |

I liked Adam's idea of assigning negative values to dead-end cells. But I couldn't get it to work. The immediate problem was that in maze_02p_01.map the hill itself is in what becomes a dead end. The original exit from the hill out of its cave is correct. But once the hill becomes a dead end and its values and the values along that exit route are made negative, the exit route no longer works.  Perhaps some adjustment can be made to deal with that, but I'm not going to think about it now.

If anyone can make it work, I'd be interested in your solution. The code is in W8.Bot.stateInfo.MyHillsContourMap.java. To make Adam's suggested change, add 

contourMap.put(neighbor, -contourMap.get(neighbor) - 1);

to the beginning of propagateDeadEndProperty and add

 

exitRoutes.put(neighbor, cell);
 
to the loop so that the newly declared dead end will have an exit route back out to its former parent.
rabbott
Posts: 1649
Posted 17:26 May 26, 2012 |

In an attempt to simply the changes needed to do Adam's dead-end processing, I over-simplified. I also made one piece a bit more complex than needed.  Instead of 

contourMap.put(neighbor, -contourMap.get(neighbor) - 1);

you don't have to subtract 1. So the following should be ok.

contourMap.put(neighbor, -contourMap.get(neighbor));

But, here are the additional complexities.

  • The function isADeadEnd should be copied and the copy  named hasDeadEndProperties. Then the calls at the end of extendMyHillContour and at the end of propagateDeadEndProperty should be changed to call hasDeadEndProperties
  • The other calls in the code to isADeadEnd should be left as is.  But the function isADeadEnd should be changed to return contourMap.get(neighbor) < 0

The reason is that contourMap.get(neighbor) < 0 is true of all cells that have been marked as dead ends. (It's contourMap value has been negated.) But the two calls to hasDeadEndProperties is not asking whether a cell has already been marked as a dead-end but whether it should be marked as a dead-end.  Both functions are needed since we ask both questions at various places in the code.

Making these additional changes doesn't fix the problem mentioned in the first message.