Skip to main content
Became Hot Network Question
added 160 characters in body
Source Link
aphid
  • 305
  • 1
  • 4

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.


Part solution:

Another example of someone using a code approach for a related (the inverse of this one) question is here: https://gaming.stackexchange.com/a/178681/148546. Adapting the forward code for this question, you get that $$n_{\text{max}} = 1 / 0.1 = 10 $$

$$\text{lim}_{f \rightarrow \infty} p_{\text{average}} = (\Sigma_{n=1}^{n_{\text{max}}} P(\text{potion nth floor}) \cdot P(\text{potion by nth floor}))^{-1} \approx 0.273207944 $$

The initial '0.4' chance can be entirely ignored as every potion past the first one works exactly the same as the formula there.

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.

Another example of someone using a code approach for a related (the inverse of this one) question is here: https://gaming.stackexchange.com/a/178681/148546

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.


Part solution:

Another example of someone using a code approach for a related (the inverse of this one) question is here: https://gaming.stackexchange.com/a/178681/148546. Adapting the forward code for this question, you get that $$n_{\text{max}} = 1 / 0.1 = 10 $$

$$\text{lim}_{f \rightarrow \infty} p_{\text{average}} = (\Sigma_{n=1}^{n_{\text{max}}} P(\text{potion nth floor}) \cdot P(\text{potion by nth floor}))^{-1} \approx 0.273207944 $$

The initial '0.4' chance can be entirely ignored as every potion past the first one works exactly the same as the formula there.

added 160 characters in body
Source Link
aphid
  • 305
  • 1
  • 4

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.

Another example of someone using a code approach for a related (the inverse of this one) question is here: https://gaming.stackexchange.com/a/178681/148546

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.

Another example of someone using a code approach for a related (the inverse of this one) question is here: https://gaming.stackexchange.com/a/178681/148546

Source Link
aphid
  • 305
  • 1
  • 4

Expectation solution to 'potion chance' mechanic.

This is a question that came up to me about the game Slay the Spire's 'potion chance' mechanic. It also applies to various other similar mechanics in other games (perhaps with different exact numbers).

It works as follows:

The potion chance $p_x$ at floor $x$ is defined based on whether you got a potion previously $r$ (which I take as $1$ if this happened, $0$ otherwise) as:

$$ \begin{equation} p_x = \begin{cases} 0.4 & \text{if } x = 1 \\ 0.1 & \text{if } r_{x-1} = 1 \\ 0.1 + p_{x-1} & \text {if } r_{x-1} = 0 \end{cases} \end{equation} $$

While setting up a spreadsheet to calculate all cases through brute force is possible for the actual game's mechanics (the number of floors where it's possible to get a potion in an act is realistically never above $10$), it's left me wondering if there's an actual closed solution or (failing that) 'close enough' approximation to the following:

Given an amount of combat floors $f$, what is:

  • The expected amount of potions you get $a_f = E(\Sigma_{x=1}^{f}(p_f))$?
  • What happens $\text{lim}_{f \rightarrow \infty}? $
  • The chance of getting $n$ potions $q_{n,f} = P( \Sigma_{x=1}^{f} r = n)$?

For example, $a_0 = 0$, $a_1 = q_{1,1} = 0.4$ trivially, and $a_8 \approx 2.36885918$ via suming 256 possible cases. This makes the brute force method $O(2^n)$.