0
$\begingroup$

Similar to my last question, I'm trying to figure out how to do something for the game SCP: Secret Laboratory.

There are four victory types in the game:

  • Facility Forces (MTF) Win
  • Chaos Insurgency Win
  • Anomalies Win
  • Draw

A diagram for the victory conditions can be found here.

The final two branches are exclusive (SCPs are alive or not alive), so there are three possibilities:

First and Second Branch

  1. Facility Forces - 20%
  2. Stalemate - 40%
  3. Anomalies - 20%
  4. Chaos Insurgency - 20%

Second and Third Branch

  1. Stalemate - 40%
  2. Anomalies - 20%
  3. Insurgency - 40%

First and Second Branch

  1. Foundation - 25%
  2. Stalemate - 50%
  3. Insurgency - 25%

I don't know how to use set notation formatting (I tried) but this essentially leaves me with three sets:

{20, 40, 20, 20} = 100 {40, 20, 40} = 100 {25, 50, 25} = 100

What I want to do is apply a percent increase to one element of the set while scaling the other elements of the set down at the same rate.

For instance, if 80% of remaining players are Facility Forces, with 10% Anomalies and 10% Chaos Insurgency, I want to scale the first set so that the probabilities more accurately reflect this:

20 * 1.8 = 36 = {36, 40 * ?, 20 * ?, 20 * ?} = 100

Here are all the algorithms I've tried so far. You can tell why I'm a programmer and not a mathematician.

  1. MTF probability times (1 + (mtfAlive / totalAlive)), Chaos Insurgency times (1 - (mtfAlive / totalAlive)), etc. without changing draw percentage, probability goes over 1.
  2. Times draw probability by (1 - (totalAlive - (aliveMTF + aliveCI + aliveSCPs)) / totalAlive).
  3. Get the MTF probability buff (1 + (aliveMTF / totalAlive)) and then calculate the debuff by multiplying the other values by (1 - (aliveMTF / totalAlive)) / 3.
  4. Same as above but I used subtraction for the second step
  5. Get the percent change in MTF probability mtfProbability * 1 + (aliveMTF / totalAlive) - mtfProbability and then divide that change by 3. Add the buff to MTF probability and subract the divided buff from all other probabilities (this worked, but some percentages were negative).

Does anyone know how I can increase one value by a certain rate and then decrease the other values in the set by the same rate?

Visually, I imagine it working like a slider except moving one position on the slider moves the other positions.

$\endgroup$
6
  • $\begingroup$ You don't need set notation as you are considering sums of numbers: $20+40+20+20=100$. Sets would not be suitable here, since there is no repetition of elements in a set. For example, $\{20,40,20,20\}=\{20,40\}$ (I believe most programming languages follow the same convention). $\endgroup$
    – Taladris
    May 9, 2022 at 3:35
  • $\begingroup$ @Taladris What do you mean by repetition of elements? Because for {20, 40, 20, 20} each of those is equal to {FacilityForces, Draw, Anomalies, ChaosInsurgency}. $\endgroup$
    – PatPeter
    May 10, 2022 at 1:20
  • $\begingroup$ I mean that, as a set, $\{ 20,40,20,20 \}=\{20,40\}$ since a set would "ignore" the repetitions of the number $20$. Also, in a set, the order does not matter, so $\{20,40\}=\{40,20\}$. You need to use tuples (wikiwand.com/en/…), vectors, row or column matrices, or finite sequences if the order is important, and repetitions are allowed. This is the equivalent of an array or a list in programming. $\endgroup$
    – Taladris
    May 10, 2022 at 1:51
  • $\begingroup$ Actually, set notations are not the main problem in the OP. I cannot access the diagram linked but the post seems unclear to me. For example, Chaos Insurgency is replaced by Insurgency at some point; are they the same? $\endgroup$
    – Taladris
    May 10, 2022 at 2:01
  • $\begingroup$ If I understand your question, you initially have an ordered list of $4$ nonnegative numbers $(a,b,c,d)$ with $a+b+c+d=1$. You want to change these numbers to $(A,B,C,D)$ where $A+B+C+D=1$, $r=A/a$ is known (the increase or decrease of $a$ in proportions) and the relative ratios of $(B,C,D)$ is the same as the relative ratios of $(b,c,d)$ (for example, if $b=c$ and $d=2c$, then $B=C$ and $D=2C$). Is that correct? $\endgroup$
    – Taladris
    May 10, 2022 at 2:05

1 Answer 1

1
$\begingroup$

Mathematically, you initially have an ordered list of nonnegative numbers $(a,b,c,d)$ with $a+b+c+d=1$ and you want to change these numbers to $(A,B,C,D)$ such that $A+B+C+D=1$, $r=A/a$ and the relative ratios of $(B,C,D)$ are the same as the relative ratios of $(b,c,d)$, where $r$ is known.

The second condition means that $\frac{b}{b+c+d}=\frac{B}{B+C+D}$, $\frac{c}{b+c+d}=\frac{C}{B+C+D}$ and $\frac{d}{b+c+d}=\frac{D}{B+C+D}$.

We have $A=ra$, $B=b \frac{B+C+D}{b+c+d} = b \frac{1-A}{1-a} = \frac{1-ra}{1-a}b$ and similar formulas for $C$ and $D$. Therefore,

$$ (A,B,C,D) = (ra, \frac{1-ra}{1-a}b, \frac{1-ra}{1-a}c, \frac{1-ra}{1-a}d) $$

Example: If $(a,b,c,d)=(20\%,40\%,20\%,20\%)$ and $a$ is increased by $80\%$, we have $r=1.8$ so $A=36\%$, $\frac{1-ra}{1-a}=\frac{9}{10}$, hence $B=36\%$, $C=18\%$ and $D=18\%$ (Note that $c=d$ and $b=2c$, so $C=D$ and $B=2C$).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .