Very well done. Yes I will keep Octave in the loop. Can they be incorporated into the code?
Simon
We normally bottom post on this list.
Try this.
Now that I have spent some time figuring out spiral-numbers, I can understand the code at
With my version of spiralNumbers the move number 1 is at the centre of the square matrix, but
they seem to call that spot x0=0 y0=0. So a simple offset should convert between the 2 systems.
this line
xy2num = @(x,y) SpiralNumbering(x,y);
is making a function xy2num(x,y) that if you give it an x,y location
in a spiral array,it gives you back a move number.
this part remembers what we have done.
% add current square to sequence
seqX(end+1) = x0;
seqY(end+1) = y0;
seqNum(end+1) = xy2num(x0,y0);
this part
% apply all possible moves
x = x0 + dx;
y = y0 + dy;
gets all 8 new positions.
So I think I am close :-)