Self-avoiding walk?
Has anybody played with / thought of a simple way of implementing a self-avoiding walk algorithm for working through 2D matricies?
I'm trying to 'walk' through a [jit.matrix] without repeating steps (which makes me think along the lines of [urn]?), but want to be able to move up/down too. Also, since the steps want to be limited to immediate neighbour cells, maybe I should be looking towards some sort of drunk/markov type thing?
Anybody got any thoughts?
O.
are you talking about a random walk in a 2d space, which does not cross its own past path?
in this case i think you wont come around creating a table with all the past coordinates, so that you can compare new steps with all the past ones.
i would probably use a signal buffer~ to do so.
-110
The trouble with a purely random walk, for anything other than a 2x2 matrix is that there is no guarantee you'll visit every element, which is what @owmtxy wants I think. If you allow wraparound (create a torus out of your matrix), then I think you can do for 2xN, but again no guarantee for 3x3 or larger (thats taking steps to neighbours only).
A possible way to look at this is with various space filling curves.
T