Calculating coordinates in a spiral shape

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Kratos Aurion
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Sep 26, 2017 5:46 pm
Contact:

Calculating coordinates in a spiral shape

Post 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...

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Calculating coordinates in a spiral shape

Post 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.

coppercoil
Filter Inserter
Filter Inserter
Posts: 472
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: Calculating coordinates in a spiral shape

Post 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.

Kratos Aurion
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Sep 26, 2017 5:46 pm
Contact:

Re: Calculating coordinates in a spiral shape

Post 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.

coppercoil
Filter Inserter
Filter Inserter
Posts: 472
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: Calculating coordinates in a spiral shape

Post 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.

Kratos Aurion
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Sep 26, 2017 5:46 pm
Contact:

Re: Calculating coordinates in a spiral shape

Post 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.

Post Reply

Return to “Gameplay Help”