my video https://youtu.be/zx6WoApljBI
my story https://community.intersystems.com/post/45-years-intersystems-1978-2023
I followed this rules with (1,1) as base
Starting any other point than (1,1) simply shortens the spiral.
now I reached 259
I really dislike the result as it is composed so unfriendly
just to save same bytes that nobody asked for.
I see a general problem in interpretation of the "spiral"
so I took some drawing for aquadratíc and a rectangular matrix.
- depending on the starting point you have to take a pre-designed direction
- if you hit the diagonal you have to turn right
- you have to invalidate the row/column you just were on
- proceeding to invalid points is not allowed.
- start a the central point is an immediate termination as it has no direction to proceed
The diagonal came to my mind thinking how to NOT increase the imaginative radius of the spiral.
The related subscripts for the diagonale points of an n*m are found as (-n/2+x,-m/2+y)
The pink subscripts are obviously (n/2,m/2) and might be just virtual.
As subscripts start with 1 and first piece position is also 1
some more adjustment of coordinates is required
I haven't written any useful line yet.









Never tried it for long time , but $system.CSP.Shell() might be a starting point
$system.CSP.* seems to have some more useful methods.