View Single Post
 
Reply
Posted 2006-02-11, 09:36 AM in reply to Demosthenes's post starting "I did a hexagon problem like this..."
When the function calls itself, how do you make sure it's not going back to the same place? What if you had a circle of them? That would infinite loop...

*thinks* I guess I could get an array of grid locations and use it like a stack.

Start at 0,1: Store 0,1 in 'stack'
Find next at 1,1: Store 1,1 in 'stack'
Find next at 1,2: Store 1,2 in 'stack'
Find next at 2,2: Store 2,2 in 'stack'
Find next at 2,1: Store 2,1 in 'stack'
Find next at 1,1: 1,1 already exists in 'stack' do not take.

And then when I fall out of an iteration, I can set the most recent location in the 'stack' back to -1,-1. That may be hard to code correctly...

I suppose if I sat down and worked on it, I might find out... but meh. I'll do it later.
D3V said:
This message is hidden because D3V is on your ignore list.
What is it they say about silence being golden?
Old
Profile PM WWW Search
Medieval Bob enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzMedieval Bob enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Medieval Bob