Linear Vanguard Algebra PART 1

So…life moment here, I finished my Linear Algebra Exam a couple of days ago. Was worried as hell, but it wasn’t the terrible tyrant it seemed like. But backing a few days before while I was feverishly practicing for said exam vanguard-related stuff derailed me. Aside from the fact that this may affect my GPA, I also found an idea which I might or might not develop further. (In the middle of exam week too. whee!) I forewarn you that I may be slightly inaccurate(I’m not a prof!) but I believe I have a good grasp to just present what I have to justify a blog post. If you spot any errors please notify me so I can fix it!

Cardfight vanguard has many fixed elements. These elements fall along two different generalizations:

  • Linear. These variables almost always don’t change during its sub-game.
    • 55% to get at least one trigger for every check you do. Exception: The really rare Bison-Vocal loop.
  • Exponential. It changes over a certain period of time or actions.
    • (45%)^n chance to fail n number of drive checks.

Linear systems

Say for every turn you have a specific number of soulblasts, counterblasts, bounces, discards, soulcharges, unflips and calls that happens every turn. You also have a target number of soul, unflipped damage, etc. in mind. Graphically:

Express to 3 unknowns as a system of linear equations like so:

Equation for Cards on Field: x3 + x1 = 2 + 1
Equation for Soul count: 2 + x2 + 1 = x3 + 3
Equation for Unflipped Damage: 1 + 3 = x1 + 1 + x2

And rearranged into
1x1 + 0x2 + 1x3 = 3
0x1 + 1x2 – 1x3 = 0
1x1 +1x2 + 0x3 = 3

Or the augmented matrix

\begin{bmatrix}1 &0 &1 & 3\\ 0 & 1 & -1 & 0\\ 1 & 1 & 0 & 3\end{bmatrix}
*Yay for LaTeX support

So what does x1, x2, x3 and x4 mean? Well, if you’ve worked with algebra at all you’ll know the = sign means the two sides of the equation are the same. But since there are three different equations we need to satisfy all three. So the variables correspond to (the counterblast cost to put a unit on the field), and the like. But they can’t just be any random number! They must follow the three equalities. You can solve the three equations the traditional way, but one of the powers of linear application is the ability to solve systems in a much more efficient way. So we apply a series of row operations to reduce to echelon form that solves for the same system:

\begin{bmatrix}1 &0 &1 & 3\\ 0 & 1 & -1 & 0\\ 0 & 0 & 0 & 0\end{bmatrix}

therefore, the solution to the system is:

\begin{bmatrix}3\\3\\ 0\end{bmatrix}+s\begin{bmatrix}-1\\ -1\\ 1\end{bmatrix}

Or as:
x2 = 3 – x1
x3 = 3 – x1

This means that the numbers for x2 and x3 are dependent on the value of x1. Try it out and see: let x1 = 0 and you find everything adds up, do the same for x1 = 2. In vanguard, the completed solution means that it doesn’t matter how much soul or how many cards on the field you have, the system in dependent on the amount of damage. Negative numbers also exist in this system! This means that extra cards leave the field and more unflipping is done. (to fuel the soul to fuel the calling…)

Restrictions

This is actually a bad system for Vanguard (or any game for that matter). The biggest consequence is the continuity of the system, how you can keep all your resources to whatever you desire. (just call it an infinite loop). But there are limits and enough of them incorporated to force a game to an end. Such restrictions include the damage available, max cards on field and the omnipotent deckout stanza. You may have ten cards in hand with on-call effects but they are all sitting uselessly becuase the expected payoff from the effect is less than the two costs associated with it. With that in mind, here is [an incomplete] matrix overview of vanguard:

Additional topics of using matrices this way:

  • Vectors can represent the advantage engine of a card over a number of turns
  • The impacts a trigger has over several turns
  • Numerical entropy calculations

Markov Chains

Here is another application of linear algebra, used in many fields including game theory. Consider a deterministic AI engine that determines its next move based on the current standings:

Explanation: If the computer gave all the effects of the crit trigger to the vanguard the last time it received a crit, they will have a% chance to try it again, g% chance to give it to the RG, and e% chance to give the power to VG and crit to RG. The matrix would be something like:

\begin{bmatrix}a &g &e \\ d & b & i \\ h & f & c \end{bmatrix}

The great thing about this particular matrix is that it is a stochastic on in other words the sum of each column all add up to one [This is mainly because the system is probability vectors]. We also define an initial state vector [j k l]T which will most likely be psuedo-randomly generated by the internal clock state or noise, depending on the method of the system. Although it is nice to see that the odds are part of a recursive program (making it extremely hard to track), and that the odds follow a set pattern, we need to know if there is a steady state: The general probabilities of each chance as the number of iterations approach infinity.

\lim_{N \to \infty} P^{N} = \begin{bmatrix}a &g &e \\ d & b & i \\ h & f & c \end{bmatrix}

So shall we take an example?Sure!

\begin{bmatrix}0.55 &0.40 &0.05 \\ 0.10 & 0.80 & 0.10 \\ 0.19 & 0.80 & 0.01 \end{bmatrix}

When you complete the solution you’ll notice that the odds of the matrix change with the initial state. Well that’s not helpful! We need something that has a consistent state (So the AI plays out with the same general strategy each time)*. We’ll try for a stationary distribution. Let’s try this:
*Or you just have the AI be unpredictable, masochist.

\lim_{N \to \infty} P^{N} = \begin{bmatrix}0.92 &0.4\\ 0.08 & 0.6 \end{bmatrix}\implies\:a\:steady\:state\:vector\:of\begin{bmatrix}\frac{5}{6}\\ \frac{1}{6} \end{bmatrix}

Very dandy. Regardless of how the computer randomizes, about 83% of the time it will give the trigger effects to the rearguard. But in a given game, you can expect the computer to continuously nourish the RG (Benefited with a luxurious 92% replay rate).

Additional topics of using matrices this way:

  • Other developments in AI, such as performing a Pale Moon soul swap loop
  • Track expected guard quality or triggers for the following turn based on what was already revealed
  • Track what field is likely to develop from the initial hand

War Arms Race

And nuclear weapons a plenty: DOTE, Bad End Dragger, Descendent to name a few. So once you’ve delved into Linear algebra I’m going to pop some in with differential equations. Oh yes, now I’m adding calculus into this mess.

Suppose y1 and y2 be the cost of investment of two players. The one who invests more wins more but they only need “enough” to beat the other person. We have no equation (yet) to determine what the functions are but we do know, by taking the amount of money they spend in regular intervals*, the change in cost for both decks. We can model the function as:
*The amount of creepy stalking we need to do as mathematicians. All for research!

y1‘ = -qy1 + sy2
y2‘ = ty1ry2

q and r being the distaste to invest more in their deck, s and t is the degree of fear that they have of falling behind (and acquire strength by other means…). So let’s hypothetically write off:

y1‘ = -3y1 + 2y2
y2‘ = 3y12y2

(Player 1 doesn’t like to spend as much money as Player 2.). By now, you are probably well vested in matrix algebra in your head, so I’m going to go right ahead and provide the eigenvalues of the matrix:

\lambda_{1} = -5\implies\:u_{1} = \begin{bmatrix}-1\\ 1 \end{bmatrix}

and

\lambda_{2} = 0\implies\:u_{2} = \begin{bmatrix}2\\ 3 \end{bmatrix}

making the general solution:

y_{1}=-c_{1}e^{-5t} + 2c_{2}
y_{2}=c_{1}e^{-5t} + 3c_{2}

If we knew how much they invested at any specific point, we’ll know what c1 and c2 are by substitution.

Additional topics of using matrices this way:

  • Optimal strategies against dominated strategies
  • Trends in an opponent’s decision
  • Maximum/minimum payoffs
  • Tracking the current meta

Conclusion

Hopefully this will ignite some thoughts on using matrices in vanguard. There are many topics left waiting to be explored in vanguard, especially in fields off the beaten path.