Nano factory with push down automata

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
gridstop
Inserter
Inserter
Posts: 44
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Nano factory with push down automata

Post by gridstop »

So ever since I saw Case's original nano factory viewtopic.php?f=8&t=27349 I wanted to do something like that. And I had been experimenting with state machines for solving train issues, so I figured I'd give a universal nano factory w/ push down automata a try.

This uses a single assembly machine (plus two for barelling, more on that later) to build any item in the game, and automatically compute & build all the intermediates in the same machine. The crafting combinator viewtopic.php?f=93&t=34405 is used to switch recipes and compute intermediate products.
The state machine
The stack
The basic operation is something like this. When idle, if there is something on the stack, pop it off the stack into the temp register. Figure out the sub-components, if we have what we need to build it in storage, go ahead and build it. If we are missing at least one sub-component, push the temp register back onto the stack, then go through each sub-component, and anything we're missing push that on the stack too, and go back to idle.
Example transition rules
The assembler
Fluid handling
You could use the same setup to do all your chemical plant stuff as well. Though if you didn't have separate light oil cracking it would probably spend all its time doing that. So far this is just built in creative mode, I'm trying to decide if it's worth trying to actually build a factory using this. It'll probably depend on if there's anything in 0.15 for handling blueprints earlier. I don't really want to rebuild it all by hand.

Practical? Of course not. But it was a lot of fun and taking on the challenge made me feel good about my theory of computation class in college (anybody need a context free language parsed in factorio?), as well as learning a lot about combinators.

Ratzap
Filter Inserter
Filter Inserter
Posts: 371
Joined: Sun Aug 16, 2015 11:15 pm
Contact:

Re: Nano factory with push down automata

Post by Ratzap »

Very nice. The first question that springs to mind is this: how easy would it be (or is it even possible) to fetch open logistics requests from the player which cannot be satisfied from storage and then build them for delivery.

Eg: request 3 pumpjacks, 1 in storage then the nano factory builds the last two and places them in storage.

gridstop
Inserter
Inserter
Posts: 44
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: Nano factory with push down automata

Post by gridstop »

Ratzap wrote:Very nice. The first question that springs to mind is this: how easy would it be (or is it even possible) to fetch open logistics requests from the player which cannot be satisfied from storage and then build them for delivery.

Eg: request 3 pumpjacks, 1 in storage then the nano factory builds the last two and places them in storage.
Thanks!

I was trying to figure out a way to see if you could get a 'unsatisfied requests' count from the network. I know when bots are in flight sometimes you can see negative numbers in the logistics network's contents, but I'm not sure what that represents precisely, and it doesn't show you simply 'amount of requests'. For instance a network with a requester box asking for 50 copper, but no actual copper in the network just shows no signal from the roboport.

Case
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Jun 28, 2016 9:25 am
Contact:

Re: Nano factory with push down automata

Post by Case »

Wow ... just wow .. very impressive.

I would like to see this thing in action - so plz :) make a nano factory out of this concept.

Take Care
Case

gridstop
Inserter
Inserter
Posts: 44
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: Nano factory with push down automata

Post by gridstop »

Case wrote:Wow ... just wow .. very impressive.

I would like to see this thing in action - so plz :) make a nano factory out of this concept.

Take Care
Case
Thanks! Ever since I saw your factory I wanted to build one, but I'm too lazy to sit there and change the recipes to make everything. Hence... this contraption.

gridstop
Inserter
Inserter
Posts: 44
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: Nano factory with push down automata

Post by gridstop »

I did actually do this before 15.0 dropped. Got lazy bastard too. Research took a LONG time. Let it run overnight twice.

Here's the final setup. I used the crafted artifacts mod to make the chemical processes more interesting (had to make superconductors). Otherwise all it would ever do is make sulfuric & plastic. And since I wasn't going to run with biters.
nano-4.png
nano-4.png (2.83 MiB) Viewed 19688 times
At this point everything was fully automated, I could put it into 'research mode' where it would automatically queue & construct science packs, and I used the research queue mod to keep it going when I was away.

Victory. I feel bad for running over those 4 trees.
nano-win.png
nano-win.png (265.12 KiB) Viewed 19688 times

kann_
Inserter
Inserter
Posts: 44
Joined: Fri Apr 15, 2016 4:36 pm
Contact:

Re: Nano factory with push down automata

Post by kann_ »

That is super cool. I was building a very similar setup, but wasn't happy enough with it to post it. very very cool!

You should make a movie and post it on reddit. My plan was to contact the guy with the self expanding mining grid to combine both. https://www.youtube.com/watch?v=xF--1XdcOeM

edit: reading through the description it is fascinating how similar my solution was. I also had a state machine, a stack, the temp register...
My problem was that I tried to do it with less combinators and without bots. -.-

kleopi
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sun Apr 23, 2017 9:01 pm
Contact:

Re: Nano factory with push down automata

Post by kleopi »

Is there a save somewhere, or a blueprint? I'd like to learn some stuff (splitting signals, the stack system, etc).
Awesome work!
Creator of the [TKN] Mods.
Check out our Discord for further information:
http://discord.gg/G9QwJWA

User avatar
T-A-R
Fast Inserter
Fast Inserter
Posts: 163
Joined: Tue May 22, 2018 4:20 pm
Contact:

Re: Nano factory with push down automata

Post by T-A-R »

im trying my nano attempt now in .16.(waiting for 0.17) i use a beltloop shuffeling a fish trough boxes to create singular signals to determin what is needed to craft. The ingredient combinator (from crafting combinator mod) also saves alot of headache.

Im producing blue potions now, ill make a showcase after i launched a rocket.

gridstop
Inserter
Inserter
Posts: 44
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: Nano factory with push down automata

Post by gridstop »

I did another one of these with a bit different sub-product calculation system (calculates all sub-components at once and inserts them into a single register instead of using a stack) for 0.16. Also did a lazy bastard rocket launch and nuclear power (with a single centrifuge & single reactor of course). Then it could automatically (slowly) do infinite researches, which I did a couple bot speeds before retiring it.

Using a single refinery & chem plant to do all refining/cracking/oil products was interesting too. LOTS of issues counting fluids & preventing jamming when changing inputs & outputs though, it was pretty tedious.

Not sure how fluid system will work with crafting combinator (if and when it gets updated for 0.17) and whether that'll make it easier or worse. They didn't fix any of the real problems with circuit network & fluids with the fractional values not showing up as a signal. Between that and the fact that you can't read logistics requests I probably won't do another one, as there's not really much more to do with it that I can see.

User avatar
T-A-R
Fast Inserter
Fast Inserter
Posts: 163
Joined: Tue May 22, 2018 4:20 pm
Contact:

Re: Nano factory with push down automata

Post by T-A-R »

I left my machine after 0.17 dropped. I saw the crafting combinator has updated, but the fluid update is not complete yet. well see what that brings

zynixen
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Sep 10, 2021 12:39 pm
Contact:

Re: Nano factory with push down automata

Post by zynixen »

I know it's an old tread, but was hoping someone had a blueprint for this?

User avatar
T-A-R
Fast Inserter
Fast Inserter
Posts: 163
Joined: Tue May 22, 2018 4:20 pm
Contact:

Re: Nano factory with push down automata

Post by T-A-R »

The way i tackled the fluid mixing was by using barrels. The crafting combinator can be configured to remove fluids from the connected pipe, thereby automate switching the fluid input. This required a extra barrel assemblers (disqualifying the run somehow). Pics are all version 0.17 btw, the factory was named "We are one", but never launched a rocket yet. I guess i won't be upgrading the 0.17 file so all we have is some pics and a single bp.

178k items crafted.png
178k items crafted.png (3.1 MiB) Viewed 4000 times
Raws are taken from the wagon, intermediates are stored in a sorted register. Distance to the assembler is based on the usage frequency. A mix of register items is kept in the south chests of the crafting assembler.

pit 1.png
pit 1.png (3.44 MiB) Viewed 4000 times
Zoomed out a bit the labs and the fishbit state machine shows. The item register is linked to the computer to decide what is needed via a green wire.

fishbit state machinestripped.png
fishbit state machinestripped.png (787.74 KiB) Viewed 3999 times
The program loops through the items, by the fish on a belt. each loop the intermediates are checked before more advanced parts get ordered on the red wire. When a order is done the fish passes a speaker to play a little happy tune. By using a belt contraption it is easy to filter a single signal, and make different states in a visual way imo. The purple inserters have items in their filter so the show on the alt mode what the combinator below it is set to. All they do is pick the fish from the box when the specific order is done.

Blueprint:
BPfishbitstatemachine.txt
(6.73 KiB) Downloaded 81 times
100k items unlocked purple.png
100k items unlocked purple.png (329.95 KiB) Viewed 4000 times
The nano system is fed by multiple smelter and refineries to keep up production. You do not want to have your single assembler stalling for even a split second during crafting cycles. *the fishbit belt gives some "latency" when the fish is cycled to select next task*.

rail assembler.png
rail assembler.png (341.72 KiB) Viewed 4000 times
I find the "vanilla" crafting combinator single assembler a really inspiring challenge. Because your factory does not need to grow as much as a regular run, there is way more time to optimize and be creative. The game is more of a idle game. (note i am handcrafting in each pic). This last pic is where i mothballed the project. I wasn't able to get the situation to function as intended. By having a wagon for each item mix, i hoped to reach ultimate item troughput for a single assembler. End game situation will probably be a bot based system, since it is the only way to hit 12 beacons and still have enough inserters to keep up. Another option would be a car belt based system like Allaizn.

mrvn
Smart Inserter
Smart Inserter
Posts: 5112
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Nano factory with push down automata

Post by mrvn »

gridstop wrote:
Mon Mar 20, 2017 10:33 pm
Ratzap wrote:Very nice. The first question that springs to mind is this: how easy would it be (or is it even possible) to fetch open logistics requests from the player which cannot be satisfied from storage and then build them for delivery.

Eg: request 3 pumpjacks, 1 in storage then the nano factory builds the last two and places them in storage.
Thanks!

I was trying to figure out a way to see if you could get a 'unsatisfied requests' count from the network. I know when bots are in flight sometimes you can see negative numbers in the logistics network's contents, but I'm not sure what that represents precisely, and it doesn't show you simply 'amount of requests'. For instance a network with a requester box asking for 50 copper, but no actual copper in the network just shows no signal from the roboport.
A negative number happens when a bot is on the way to pick up an item and you remove it from the chest. The signal shown is number available in the network - number the bots are on the way to pick up. There is no count for things the bots would like to pick up.

To see unsatisfied requests you have to put an item in a chest so a bot comes to pick it up. So you have to produce one of everything ahead of time.

User avatar
Khagan
Fast Inserter
Fast Inserter
Posts: 141
Joined: Mon Mar 25, 2019 9:40 pm
Contact:

Re: Nano factory with push down automata

Post by Khagan »

mrvn wrote:
Fri Oct 22, 2021 1:38 am
There is no count for things the bots would like to pick up.

To see unsatisfied requests you have to put an item in a chest so a bot comes to pick it up. So you have to produce one of everything ahead of time.
Which is a great pity for low-volume high-cost items like rocket silos or spidertrons. Not only do you have to produce at least one that you don't (yet) need, but you have to work quite hard to stop the assembler loading the raw materials for another couple of them.

mrvn
Smart Inserter
Smart Inserter
Posts: 5112
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Nano factory with push down automata

Post by mrvn »

Khagan wrote:
Fri Oct 22, 2021 4:10 am
mrvn wrote:
Fri Oct 22, 2021 1:38 am
There is no count for things the bots would like to pick up.

To see unsatisfied requests you have to put an item in a chest so a bot comes to pick it up. So you have to produce one of everything ahead of time.
Which is a great pity for low-volume high-cost items like rocket silos or spidertrons. Not only do you have to produce at least one that you don't (yet) need, but you have to work quite hard to stop the assembler loading the raw materials for another couple of them.
I don't feel that is really something to worry about. Because you either

a) only need one rocket silo so just fill the assembler manually once.

or

b) you are planning to build many and one extra becomes a fraction of material spend on rocket silos.

The spidertron kind of falls in the middle in a (public) multiplayer game if you don't use it as defense bot. Each player probably wants one. So you might need a bunch and in a public game you need another when a new player joins.

One thing you can do is use trains as signal/switch. Make a pair of stations with a train. It idles at one stop (some impossible condition) and waits for a circuit condition "spidertron > 0" at the other and that station having a train starts the spidertron assembly. So a player can click on the train on the map and send it to the other station and a spidertron is made.

And yes, ordering and counting the ingredients for one spidertron takes a bit of work. Worth it? Your choice.

Post Reply

Return to “Combinator Creations”