1

I have encountered a game mechanic that takes repeated arithmetic to figure out, so I was wondering if it could be made simpler by finding an equation to solve.

In this game, there are resources that can each be used only once each turn. A particular "special" move in this game uses 5 resources, but creates 1 resource, which is immediately ready for use. This resource will stay on subsequent turns. EDIT: There will always be a whole number of resources; there can't be 1.5 resources, for example.

For example, I start with 29 resources, make this "special" move 5 times, using 25 resources, but creating 5 more. I then have 9 unused resources. I use 5 of those resources to create 1 more, leaving me with 5 unused resources. After using these last 5, I end up with 36 resources. The next turn, I can use these in the same manner. The difficulty comes when you have resources numbered in the hundreds or thousands.

My question is two-fold: 1. If you start with X resources, is there an equation that will show you many resources you will have at the end of the turn, or after Y turns? 2. How many turns will it take before you have Z resources?

Note: For those curious enough, an example of this mechanic can be found in the game Magic: The Gathering on the card Sprout Swarm

  • Can I say, for each special move, the 5 input resources can no longer be used in this round, but the 1 output resource can be used immediately. All used or unused resources will stay on subsequent turns. Hence the result of 31 resources in your example? – peterwhy Jan 09 '14 at 09:13
  • @peterwhy: You are correct, though I have altered the example. – Indigenuity Jan 09 '14 at 09:16

1 Answers1

2

Imagine you put all your $X>0$ resources in a straight-line stack. Every "special move", you pop $5$ resources out of the stack, and push $1$ new resource onto the stack. Hence the stack holds the resources that still can be used for further "special move".

For each special move, the number of resources in the stack decrease by $4$, given that there are at least $5$ resources available. Therefore, not counting the bottommost one resource, the number of moves can be made is

$$\left\lfloor\frac{X-1}{4}\right\rfloor$$

As this is the number of special moves that can be made, i.e. the number of new resources created by the special move, the number of resources after the turn is

$$X+\left\lfloor\frac{X-1}{4}\right\rfloor$$

To simplify a bit, since $X>0$ is given as an integer, the number of resources after the turn can be written as

$$X+\left\lfloor\frac{X-1}{4}\right\rfloor = \left\lfloor X+\frac{X-1}{4}\right\rfloor = \left\lfloor\frac{5X-1}{4}\right\rfloor = \left\lfloor\frac{5(X-1)+4}{4}\right\rfloor = \left\lfloor\frac54(X-1)\right\rfloor+1$$

If this process is repeated twice, then the number of resources after two rounds is $$\left\lfloor\frac54\left\lfloor\frac54(X-1)\right\rfloor\right\rfloor+1\le\left\lfloor\left(\frac54\right)^2(X-1)\right\rfloor+1$$ And similarly, an upper bound (not the exact) number of resources after $Y$ turns is $$\text{Number of resources}\le\left\lfloor\left(\frac54\right)^Y(X-1)\right\rfloor+1$$

peterwhy
  • 22,256
  • It's been awhile since I've done much math, but I assume that notation is the floor function? – Indigenuity Jan 09 '14 at 09:39
  • Yes. Try with your example in the other comment: from $28$ resources, the next round will start with $$28+\left\lfloor\frac{28-1}{4}\right\rfloor = 28+\left\lfloor\frac{27}{4}\right\rfloor = 28+\left\lfloor6.75\right\rfloor = 28+6 = 34$$ resources, where $\left\lfloor x\right\rfloor$ means the largest integer smaller than or equal to $x$. – peterwhy Jan 09 '14 at 09:43
  • So how would one extend this to figure out how many resources there will be after Y consecutive turns? – Indigenuity Jan 09 '14 at 09:54
  • 1
    @Indigenuity I have added an upper bound calculation for the number of resources after $Y$ turns. See if that is helpful to you. – peterwhy Jan 09 '14 at 10:19