Page 1 of 1

Calculating coordinates in a spiral shape

Posted: Sat Apr 25, 2020 11:48 pm
by Kratos Aurion
I recently finished my first circuit contraption and it is a total mess. I'm glad it works the way it is intended to, but now I'm curios about your theoretical thoughts how to calculate coordinates in a spiral shape. So the desired output should be:

(TickA is the first tick that holds coordinates, x is the time you need to calculate the next coordinates)

TickA + 0x: ( 0/ 0)
TickA + 1x: ( 1/ 0)
TickA + 2x: ( 1/ 1)
TickA + 3x: ( 0/ 1)
TickA + 4x: (-1/ 1)
TickA + 5x: (-1/ 0)
TickA + 6x: (-1/-1)
TickA + 7x: ( 0/-1)
TickA + 8x: ( 1/-1)
TickA + 9x: ( 2/-1)
TickA + 10x: ( 2/ 0)
TickA + 11x: ( 2/ 1)
TickA + 12x: ( 2/ 2)
TickA + 13x: ( 1/ 2)
And so on...

(I'm so sad table layouts aren't supported)

This thread needn't to be one to show me perfect solutions, to offer blueprints or savegames, I'm just curios about your theorycrafted solutions, to compare how good my solution was, to get known to some tricks in circuit networks and so on...

Re: Calculating coordinates in a spiral shape

Posted: Sun Apr 26, 2020 2:50 am
by DaveMcW
Using R=right, L=left, U=up, D=down, we get this pattern to create a spiral:

RD
LLUU
RRRDDD
LLLLUUUU
RRRRRDDDDD
LLLLLLUUUUUU

So you want a couple memory cells, a resettable one to track the current number of RDLU's, and a permanent one to track the maximum before you switch directions.

Re: Calculating coordinates in a spiral shape

Posted: Sun Apr 26, 2020 12:41 pm
by coppercoil
I have made a spiral coordinate generator. It has four run cycles for every square side, run length is increased every two cycles, dX and dY are changed every time cycle ends. That’s all.

Re: Calculating coordinates in a spiral shape

Posted: Sun Apr 26, 2020 1:05 pm
by Kratos Aurion
coppercoil wrote: Sun Apr 26, 2020 12:41 pm I have made a spiral coordinate generator. [...]
May I see a blueprint of your solution? I'm curios about how much space you needed.

Would it be okay, if I would use your solution? I'm sure it's better than my spaghetti.

Re: Calculating coordinates in a spiral shape

Posted: Sun Apr 26, 2020 1:33 pm
by coppercoil
Here is my BP, feel free to use and modify it.
BTW, this is not a perfect generator, several tiles in the very center are not generated, because there are bad transitional processes during generator start. But this is not important for my goals.

Re: Calculating coordinates in a spiral shape

Posted: Sun Apr 26, 2020 2:20 pm
by Kratos Aurion
coppercoil wrote: Sun Apr 26, 2020 1:33 pm Here is my BP, feel free to use and modify it.
BTW, this is not a perfect generator, several tiles in the very center are not generated, because there are bad transitional processes during generator start. But this is not important for my goals.
Funny, you face the some problems I do. And you invented it for the same purpose.