|
On Wed, September 28, 2005 12:09 pm, Brian Davis wrote:
> > I'm only keeping 2 bits per node
>
> Hmm. OK, that's got me confused. I *know* I'm storing more information than
> needed, but each node in the path only takes 2 bits? If those two bits encode
> the direction to the next node (three possible states for L-R-Straight, or four
> possible states for N-E-S-W). But if the path the robot is going down is a
> dead-end, then the robot has to back up, and it needs to know... oh, OK, it
> *does* know which branch it went down at the last node, OK...
Nodes I haven't seen have a value of zero.
Every time I [re]enter a node, I add 1 to the value that's currently there. If
there's no right turn (I follow the right "wall"), I add 2. When the total is 4,
you're done searching that node.
So, when I'm done, I have a map of values, either 1=right, 2=forward, or 3=left,
that tell me which way to go at each node.
> Huh. Remember kids, always demonstrate your ignorance in a public forum where
> lots of other people can see it. It's much more fun ;-).
:)
Originally, I was also keeping the number of possible directions, but that can be
calculated every time you reach a node.
My programming is much like my building. First, build what you need, using whatever
parts are required. Then, take off parts you don't need.
Steve
|
|
Message is in Reply To:
13 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|