How to the reach the goal fastest in this kind game?

46 Views Asked by At

I have 100 golds, I can build mine to get more golds. Each mine costs 100 golds, and output 1 gold starting from next day.

How long will it take to get 1000 golds?

If I build few mines, I have to wait for a long.

If I build lots of mines, it takes a long time.

So I need to find the right number of mines.


Computer Simulation

comsim

Rush[{m, p, c, g}] means:

$m:$ initial funding

$p:$ output of each mine every round

$c:$ cost of each mine

$g:$ our goal

Rush[pp_] := Block[{ans},
  ConsTry[max_] := With[{}, {t, n} = {0, max};
    {m, p, c, g} = pp;
    While[n > 0, {a, b} = QuotientRemainder[m, c];
     p = p + a; m = b + p; n -= a; t++]; t + Ceiling[(g - m)/p]];
  ans = Array[{#, ConsTry@#} &, 100];
  Print@ListLinePlot[ans, PlotTheme -> "Detailed"];
  SortBy[ans, Last][[1]]]

That is to say, if I build 8 mines and I can get 1000+ gold in 284 days.

Then I want to find mathematical expression of function Rush, approximate expression also ok.


My attempt

We have $M_0$ as initial funding, and our goal name as $G$. Each mine cost $\color{red}c$ and can get $\color{red}a$ starting from next round.

$N_n$ as number of the mines, so we can get $a N_n$ this round.

If we get enough fund, then pay ${c}\left\lfloor {\cfrac{{{M_{n - 1}}}}{{{c}}}} \right\rfloor $ immediately to build $\left\lfloor {\cfrac{{{M_{n - 1}}}}{{{c}}}} \right\rfloor $ mines.

$$\begin{array}{r |l l} n& & M&N \\ \hline 0& & {{M_0}}&0 \\ 1& & {{M_0} - {c}\left\lfloor {\frac{{{M_0}}}{{{c}}}} \right\rfloor }&{\left\lfloor {\frac{{{M_0}}}{{{c}}}} \right\rfloor } \\ 2& & {{M_1} - {c}\left\lfloor {\frac{{{M_1}}}{{{c}}}} \right\rfloor + {a}{N_1}}&{{N_1} + \left\lfloor {\frac{{{M_1}}}{{{c}}}} \right\rfloor } \\ \vdots & & \vdots & \vdots \end{array} $$

That is to say:

$$\left\{\begin{aligned} {M_n} &= {M_{n - 1}} + {a}{N_{n - 1}} - {c}\left\lfloor {\frac{{{M_{n - 1}}}}{{{c}}}} \right\rfloor \\ {N_n} &= {N_{n - 1}} + \left\lfloor {\frac{{{M_{n - 1}}}}{{{c}}}} \right\rfloor\\ \end{aligned} \right.$$

Now, I need to find the shortest time form $M_0$ to $G$.

Obviously, second one is ${N_n} = \sum\limits_{i = 1}^n {\left\lfloor {\cfrac{{{M_{i - 1}}}}{{{c}}}} \right\rfloor } $.

Then:

$${M_n} = {M_{n - 1}} + {a}\sum\limits_{i = 1}^{n - 1} {\left\lfloor {\frac{{{M_{i - 1}}}}{{{c}}}} \right\rfloor } - {c}\left\lfloor {\frac{{{M_{n - 1}}}}{{{c}}}} \right\rfloor $$

If we build $N=\text{max}$ mines, then waiting $\left\lceil {\cfrac{{{c_2} - {M_{\max }}}}{{{a}}}} \right\rceil $ rounds to reach $G$.

I can't figure out how to solve next.


General Case

How about there are two or more kinds of resources?

Solve $N_{\max}$ and $t_{\min}$ from $\{\overrightarrow{m} , \overrightarrow{p} , \overrightarrow{c} , \overrightarrow{g}\}$, need mathematical expression or approximate expression.

1

There are 1 best solutions below

0
On

It will take $100$ days for a mine to pay itself back. Which means that if you at any point have over $100$ gold, and want to decide whether to build a mine, the answer is that if you build one, you will have less gold than if you don't build one for $99$ days, then after that you will have more gold than if you don't build one.

The big deciding factor is therefore whether you will reach $1000$ gold within $100$ days. If it takes more than $100$ days, then you will get there faster by building another mine, and if it takes less than $100$ days, you will get there slower if you build another mine.

If it takes exactly $100$ days for you to reach $1000$ gold, then you can choose whether you want to build a mine or not. In the end, this means that you should build mines as fast as you can until you have nine of them. It's up to you if you want to build a tenth (when you're at $100$ gold again, and nine mines, it takes exactly $100$ days to reach $1000$ gold).