An idle game (Cookie Clicker is a well-known example) is a game where you set up automatic resource production, and most of reasonable human play is then waiting as resources accumulate. Typical implementation is in the form of a "tick loop", where resources update say once per second, generally increasing.
But many games can implement an "offline mode" where instead you can exactly calculate any number of ticks in one step. For example if you were producing 1000 cookies/second, and you come back after 1 hour, you've produced 3.6 million cookies exactly--no need to simulate all 3600 ticks. Then the player can reduce the update rate on screen, or come back to the game in 5 hours without running a program continuously. (Aside: many real games offer an "offline mode" which does NOT exactly match what would happen playing the game for the same length of time, but here I'm asking about exact simulation).
I am trying to figure out for which idle games an it's possible to efficiently compute many ticks in one step ("offline mode").
In a typical idle game (think "cookie clicker"), you have a bunch of resource generators, and each one generates some resources each tick. For example, maybe you have a cookie stove, which produces 5 cookies/tick. And you could also have a generator factory, which produces 1 cookie stove/tick.
For each resource, it produces some fixed list of resources each tick. Let's say we just have a list of what each resource produces each tick.
A resource costs something to buy. This is actually irrelevant for the simulation--buying is only a player action, and can't be done automatically.
A problem input will be a set of starting resources, and a number of ticks to simulate. Output should be the resources after that number of ticks.
If there are no cycles, an offline mode is definitely possible. The number of each resource is a linear (if it is not produced by anything else), quadratic (if it is produced by a linear resource), etc. So it's always a polynomial, which is easy to calculate.
My first question: is this still easy if we allow cycles, ex a "general purpose factory" that produces both general purpose factories, and cookies?
Second question: is this easy if we allow simple "autobuy"? Ex. convert 1000 cookies into a cookie factory, and buy as many as possible, on each game tick.
If it's easy, show how to do it. If it's hard, prove it!