hn.today

Solving Factorio Quality

exyr.org250 points98 comments
Screenshot of Solving Factorio Quality

This explains how the Space Age expansion’s five-tier Quality system in Factorio can be modeled and planned using linear algebra. Items and recipes now come in five quality tiers and quality modules give a probabilistic chance q of bumping output tiers; multiple module slots stack to raise q (up to ~24.8% with four slots). Representing a recipe’s mapping from ingredient-tier probabilities to product-tier probabilities as a 5×5 transition matrix T_quality(q) makes multi-step chains trivial via matrix multiplication. A zero-quality chance yields the identity matrix; successive processes (mining, smelting, assembly) are T_quality matrices multiplied in sequence. An explicit numeric example (mining 7.5%, smelting 5%, crafting 10%) gives a final pipe distribution of roughly 79.09% normal, 17.43% uncommon, 2.97% rare, 0.45% epic, 0.07% legendary.

The piece then applies the same formalism to quality strategies that use the recycler (which returns 25% of ingredients) to “wash” items until they reach a target tier. Filtering and recycling are encoded as matrices (keep/extract filters and L = T_filterKeep · 1/4 · T_quality(q)), and the full extraction distribution is the geometric series fresh_unit · (∑i≥0 L^i) · T_filterExtract. This reduces the looping, probabilistic upcycling problem to finite linear-algebra operations, enabling exact planning of ingredient consumption, expected yields, and tradeoffs between opportunistic crafting and repeated recycling. An online calculator implements these computations.

Read on exyr.org98 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Other

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.