• 1 Post
  • 1.08K Comments
Joined 1 year ago
cake
Cake day: June 6th, 2024

help-circle



  • Interesting. Optimizing the factory for your immediate current needs sounds very tedious, because those needs change all the time. I instead optimize for expandability and adaptability. The factory game genre isn’t for everyone, but if you are interested in some tips:

    My solution is usually something like:

    • really long line of basic resources (usually a belt of smelted copper and a belt of smelted iron, eventually adding more stuff and adding more belts of iron and copper as supplies are needed)
    • when I need thing 1, I make a little package that builds it, drawing resources from the line with splitters so the excess can continue down the line
    • thing 2 is an independent little package farther down the line
    • When it’s time for thing 3, I build copies of the packages for building thing 1 and thing 2 as necessary to feed the construction of thing 3, again as separate feeds splitting off the main resource line
    • when it’s time for thing 4, its again independent of the production of things 1-3, except they are splitting off the same main resource belt
    • If the resources on the main belt are insufficient to feed all of those machines, one of three things needs to happen: 1. Add more raw resource processing until your belt is full and backed up at the beginning 2. If that’s not enough, upgrade the belt 3. If you don’t have a belt upgrade available, build another main resource line and use splitters to rebalance it onto the main line

    This construction allows for easy expansion without having to destroy anything. I typically don’t disassemble anything unless it’s actually a problem for some reason or I need the space. This is especially important because you often need some basic components like the level 1 belts even into the late game.

    Also, once you unlock robots, you can literally copy-paste, just select an area to upgrade all belts/arms/etc. in, and a lot of other neat tricks that drastically speed things up.

    And one last peace of advice: Overproduce everything and let belts backing up balance out the resource distribution. Then if you discover that belts that previously were backed up are now sparse, figure out why and optimize it, usually by adding more production of whatever the missing resource is.

    Ultimately throughput is all that matters. Loss of throughput because you don’t need something isn’t wasteful. Loss of throughput because you aren’t producing enough of something is a problem to solve. Things that don’t affect throughput don’t matter and aren’t wasteful.


  • Closed form means it can be written out as a specific, finite set of instructions that work the same regardless of what the input to your function is.

    For Fibonacci, it is most commonly defined in its recursive form:

    f(0) = 0
    f(1) = 1
    f(x) = f(x-1) + f(x-2) for integer x > 1
    

    But using this form, computing a very large Fibonacci number requires computing all the numbers before it, so it’s not the same finite set of instructions for every number, it takes more computation to generate larger numbers.

    However, there is a closed form formula for generating Fibonacci numbers. Using this formula, you can directly compute any large Fibonacci number without having to compute all those intermediate steps. It takes the same amount of work to compute any Fibonacci number.

    f(x) = (a^x - b^x)/√5
    a = (1+√5)/2
    b = (1-√5)/2
    

    (Note that a and b here are constants; I only wrote them separately to avoid a mess of nested parenthesis)

    For an example of something that doesn’t have a closed form, we do not know of a closed form for generating prime numbers. There are several known algorithms for generating the nth prime number, but they all depend on computing all the previous prime numbers, making it very difficult to compute very large prime numbers (in fact, how generating large primes is actually done is by making an educated guess and then checking that it’s actually prime). Discovering a closed form formula for prime numbers would have a huge impact on mathematics and cryptography.