Circle generator

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Post Reply
Qon
Smart Inserter
Smart Inserter
Posts: 1633
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Circle generator

Post by Qon »

This thing generates circles. Specifically, it outputs a X,Y values for 1 point on a circle with radius R every 16 ticks (except 4 times per circle where no output is given) as a single tick pulse. With points on the circle of radius R I really mean every point that has a (distance <= R) AND (R - 1 < distance). It will continue doing laps over and over once a full circle has been completed.
Screenshot from 2021-07-06 11-02-13.png
Screenshot from 2021-07-06 11-02-13.png (3.22 MiB) Viewed 425 times
The R,R decider in the top left corner is a memory cell for the R value. You can replace it with something else that outputs an R value (not pulsed) if you connect it to the same constant combinator with red wire. It has no input because this design never modifies the radius automatically. Increase the R value yourself with a circuit that detects that a full loop has been generated if you want multiple concentric circles. Maybe a memory cell that saves first output and sends R=1 when same coordinate is generated again to the memory cell for R to increment the R value and also resets this loop memory.

Above that there is a memory cell for X,Y coordinates. Send a dot signal to this to reset it. Necessary if you want to reduce R (reducing by 1, step by step after it has generated at least 1 point on the current R might work though). If R is increased you don't have to reset this memory cell.

The big power pole on the right is connected to the output red wire. The output also contains a construction bot signal because I've debugged this with Recursive Blueprints.

No mods are necessary for this. The Nixie tubes (Santas simplified ones) and the pushbuttons are just for debugging and control and it works without them. Pushbuttons are neat if you want to test this though. Makes it easy to configure R and reset X,Y memory.

The top constant combinator (next to a lamp) that outputs a check=1 signal is used to run/pause the generator. No state changes and no output is given unless a check=1 signal is sent in. This can be useful if you are using this with big blueprints and Recursive blueprints mod if you need to slow things down.

That's all for how to use it.
TL;DR
Input R gives coordinates out (while check=1) every 16 ticks.
Reset X,Y memory cell (with dot in) if R is reduced.


It works by measuring squared distance of some points nearby current X,Y values and moving to the next point from one of the valid on-circle points "in front of" the current location state. I'll write a more detailed description of how it actually works, what each group of combinators do and how it was designed if someone asks for it.

Drogiwan Cannobi
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue Aug 25, 2020 11:59 am
Contact:

Re: Circle generator

Post by Drogiwan Cannobi »

Why does this look so much less messy than what I come up with? :D

Excited to try it later today!

Qon
Smart Inserter
Smart Inserter
Posts: 1633
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Circle generator

Post by Qon »

Drogiwan Cannobi wrote:
Tue Jul 06, 2021 10:03 am
Why does this look so much less messy than what I come up with? :D
I talked with ssilk in another topic on how to keep circuits organized.
Qon wrote:
Tue Jul 06, 2021 9:00 am
ssilk wrote:
Mon Jul 05, 2021 12:08 pm
What I really miss here with the “Factorio language” are these things:
1. Readability. [...]
Yeah readability is really bad. What I'm doing to mitigate this is for my combinator designs to be placed down in a structured way, similar to the ideas of making your code readable with some empty lines, proper indentation and reasonable line lengths etc. Code is readable because we are taught to make it readable, newbie coders make unreadable code even if it is in text.

But then to fit my designs where I need them I for some cases have to use picker dollies and compress them down to something less readable. :(
But to make it readable I have a start point, and "all" signals flow in the same direction (except for loops) just like control flow in a program. And "all" combinators on the same distance (along the chosen time axis) from the start of the combinator program have equal amount of combinators before them so they are synchronized tick perfectly. I add deciders (each ~= 0 > each count) or arithmetics (each + 0 = each) to do simple single tick delays to stick to this when necessary. This means I get some kind of indentation and lines similar to text code. It's pretty annoying to only be able to move a single thing with dollies and copy paste loses outside connections, but I at least also reduce my need for moving things around, slightly, if I structure where things belong from the start this way.

But it's still not easy to read or modify, just slightly easier than impossible :)
ssilk wrote:
Mon Jul 05, 2021 12:08 pm
5. Difficult to debug/test: [...]
I'm debugging with Editor mode so I can control time and single step through combinators. Also get combinators and space and time to work on the designs for free. And wire shortcuts of course. And I will probably use stack combinator soon. But I agree of course.
Also, I no longer use power poles within circuits for carrying wires. It always makes things harder to read, use constant combinators instead and temporarily add power poles for reading signals if hovering over a decider/arithmetic combinator and reading input isn't good enough.
Drogiwan Cannobi wrote:
Tue Jul 06, 2021 10:03 am
Excited to try it later today!
Would be really cool to see it used for a self-expanding factory or something. Mine is progressing so slowly. Though having circles isn't really a big advantage except some slightly short bot travel times. And it looks nice. But it makes some things more complicated. ;)

Here's a picture of a circle generated with the design from this topic though:
Screenshot from 2021-07-06 13-04-52.png
Screenshot from 2021-07-06 13-04-52.png (514.65 KiB) Viewed 391 times
Map view, max zoom out. The circle is "perfect" but the discovered area is slightly non-circular since radars reveal chunks in a square around them.
64x64 sized cells. R = 48, so (48*2 + 1) * 64 = 6208 tiles wide.
Lasers and artillery removed manually with a filtered decon planner on the inside of a circle. Bots were used to contruct (speed research 100) with materials from infinite provider chests.

Post Reply

Return to “Combinator Creations”