How to determine the round of a game given it's state number?

19 Views Asked by At

Let's say I've made a game where it's possible to mark a total of 15 categories as either used or unused, and have a game score that's anything in the range of 0 and 39 (both inclusive, and ignoring that marking a category leads to a certain minimum score). The total number of game states is therefore 2^15 *40. Marking a category is associated with a round in the game, so after marking your 4th category (any of the currently unmarked ones are available) you're in the 4th round. Determining the number of states in any round i is done using some combinatorics:

$g_{i}=\frac{15!}{(15-i)!(i!)}$

If I summarize all states in each round in sequential order, then it must be possible to say that the j'th state is in round r. Is there a formula to determine, given a state number, which round the state belongs to?

1

There are 1 best solutions below

0
On

No, this is a difficult problem, basically you need to evaluate the break-off points for each round (the last number of state pertaining to each round). Notice the break of point of round $n$ is $\sum_{k=0}^n\binom{15}{k}$. This number is really hard to compute and has no closed form.

I here give you a table of the break-off points:

$$ \begin{matrix} 1&16\\ 2&121\\ 3&576\\ 4&1941\\ 5&4944\\ 6&9949\\ 7&16384\\ 8&22819\\ 9&27824\\ 10&30827\\ 11&32192\\ 12&32647\\ 13&32752\\ 14&32767\\ 15&32678\\ \end{matrix}$$