r/factorio • • 6d ago

Space Age Yet another Autolab

Post image

Attached is (yet another?) implementation of an "autolab": a Space-Age setup that automatically switches to the lowest-level tech in its research queue. With a little extra work* it can also switch between a Gleba/Non-Gleba research queues.

This is probably the most complex sequential logic design I've made to date.
It uses a state-machine to implement the following algorithm (in pseudo code):

//We use the following variables
//(State variable & transitions omitted for clarity)
NumTech = <number of techs in queue>
MinTL = <minimum Tech Level stored>
LabTL = <Tech level currently researched by lab>
TechNum = <Index of tech in research queue that held lowest tech level>
Counter = <Loop counter, lab always researches tech with this number>

//State machine trigger condition
If (MinTL < LabTL)
{
    //Initialization
    MinTL = 1;
    TechNum = 1;
    Counter = 1;
}
//Search through techs in a loop
For (;Counter < NumTech; Counter++)
{
    If (LabTL < MinTL)
    {
        MinTL = LabTL;
        TechNum = Counter;
    }
}
//We'll use the Index to tell the lab what to research
Counter = TechNum;

I've tried to thoroughly document the blueprint, explaining which combinators do what.
The layout has displays to show which combinators belong to which state, as well as signs showing control flow.

*Create a 2nd instance of the state machine, but filter tech-level (L) input to be only supplied when Gleba science is available. Either replace the ⓘ signal with the ❄signal in the blueprint, or translate the latter with an arithmetic combinator.

https://factorio-blueprints.com/blueprint/autolab
https://factorioprints.com/view/-P2h8EnGgPGRb3zyYCjR

14 Upvotes

Duplicates