Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

最近の作業部屋活動履歴

2019-10-20

最近のWikiの更新 (Recent Changes)

No changes on this wiki.

Wikiガイド(Guide)

サイドバー (Side Bar)

Python Factorio Calculator

Just a simple, and painful to use calculator for the game Factorio written in Python

Release Files

No download files.

Recent Commits

Rev.TiempoAutorMensaje RSS
5b2a00772019-10-20 06:06:58Eric HopperMerge.
5aca86ec2019-10-20 06:06:00Eric HopperPickle database update.
540b2fa02019-03-30 11:08:48Eric HopperUpdate to 0.17 item database and the XML based format.
0114c5c12019-03-30 11:06:38Eric HopperUpdate to preferentially read items.xml as the item datab...
0d7388322018-02-09 14:49:39Eric HopperI never use cooked, remove it.
3d95e6a42018-02-07 01:25:29Eric HopperAdjustments for 0.16 times.
e1107f462018-02-06 13:46:18Eric HopperAdded Grenade, Turret, and Black Science to XML.
a1dab0322018-02-06 13:43:20Eric HopperBegin version controlling the XML version of the database.
20ee3b222018-02-03 05:31:16Eric HopperArrange for XML to be sorted in a predictable order. Thi...
462d2d0e2018-02-03 03:37:30Eric HopperAdded code to read and parse XML database.

Python Factorio Calculator

This is a simple calculator for the game Factorio. Since I like rational numbers and the ratios in the game are usually best expressed this way, it does all math with fractions from Python's fractions module.

If you're seeing this on GitHub, I'm a Mercurial user, so this is a mirror of the actual repository on bitbucket.

It requires Python 3.6 to work, mostly because I really like f'' strings. I'm also not much of a fancy UI guy, so it just has a bunch of functions that do the kinds of things I need.

The module is designed to be used like this:

>>> from fractions import Fraction as F
>>> import factorio_calc as fc; from factorio calc import item_db as idb
>>> fc.print_factories(
...     fc.factories_for_each(
...         idb['Yellow Science'],
...         F(1,4),
...         raw_materials=(idb['Circuit'],
...                        idb['Copper'],
...                        idb['Plastic'],
...                        idb['Battery'],
...                        idb['Speed Module 1'],
...                        idb['Sulfur'],
...                        idb['Iron'])))
Factories   (as a fraction)   Rate      Name
---------   ---------------   -------   ---------------------
        2               7/4       1/4   Yellow Science
        4              15/4       3/8   Processing unit
        5               9/2       3/4   Adv Circuit
        2             27/16      27/4   Wire
        1              3/80      15/8   Sulfuric Acid
                                  1/8   Battery
                                    9   Circuit
                                  3/2   Plastic
                                 27/8   Copper
                                 3/16   Sulfur
                                 3/80   Iron
                                 15/4   Water
                                  1/8   Speed Module 1

For items specified as raw materials (or for items that have no ingredients) it will simply list the rate at which they must be produced for the given rate. All rates are in items/sec.

I don't print out dependencies because I don't feel it's terribly useful when building a factory. You can look at the dependencies in the game and figure out how to hook things up so that it all works. What you really need for planning is an idea of how many of which kinds of factory you need, and what sorts of supplies you'll need to provide.

For example, in the above build, I have a main bus for the copper, plastic, circuits, water, and iron. The rates required for batteries, sulfur, and speed modules are low enough that I'm comfortable with using the logistics network to fly them in from other places in my factory where they're made. This will yield at least 1 Yellow Science every 4 seconds, and all the fractional factories tell me I will probably get more production out of it. I could use the actual_production function to figure out just how much.

Latest updated Tickets

No tickets

About Chamber Wiki

Welcome to OSDN Wiki system. Here is your chamber Wiki space.

Check Wiki Guide (English) to refer syntax and functions.