I decided to figure out how balance is calculated from some examples. It took a few data samples to figure it out, but here is how it's done.
========================
First, let me quote Vano:
Full Control is calculated as the sum of all 'Secret Army' values in the following countries:
1 ) under your control
2) your undisclosed Secret Allies
3) with control in dispute (contributes half of its 'Secret Army' value)=====================
Instead of the term "Full Control", I will use the term "Control Total".
The control total for player 1 shall be called CT1.
The control total for player 2 shall be called CT2.
Let us calculate the balance for the player who is ahead (or tied).
Let's say that player 1 is ahead or tied, that is CT1 >= CT2.
We first calculate the following value:
V = (CT1 - CT2)/CT2
Let VI = Int(V), that is the integer part of V.
For example, if V = 2.34, then VI = 2. Just drop everything after the decimal.
We perform a table lookup:
VI Value
---|--------
0 | 0
1 | 40
2 | 80
3 | 100
If V is an integer, for example if V = 2, then the balance is the value from the table.
If V is not an integer, then the balance is calculated by taking the percentage or ratio that V has "moved" towards the next index value, and moving the value from the table proportionately towards the next value.
The game uses some floating point calculations, and truncates. For example, there is a case in which the actual value should be 16%, but the game calculates 15.99999% and truncates it and reports 15%.
Here are some examples:
--------------------
CT1 = 24, CT2 = 8.
V = (CT1 - CT2)/CT2 = (24 -

/8 = 16/8 = 2.
We look in the table with VI = 2, and find 80. The balance is 80%.
--------------------
CT1 = 32, CT2 = 16.
V = (CT1 - CT2)/CT2 = (32 - 16)/16 = 16/16 = 1.
We look in the table with VI = 1, and find 40. The balance is 40%.
-------------------
CT1 = 24, CT2 = 16.
V = (CT1 - CT2)/CT2 = (24 - 16)/16 = 8/16 = 0.5.
Dropping the decimal, VI = 0.
Looking in the table, we find a value of 0.
We also look at the table value for an index of 1, which is 40.
Since V is halfway to 1, we take the value halfway from 0 to 40, which is 20.
The balance is 20%.
------------------------
CT1 = 28, CT2 = 12.
V = (CT1 - CT2)/CT2 = (28 - 12)/12 = 16/12 = 1.33333.
In this case, VI = 1.
The table entry for 1 is 40, and for 2 is 80.
So, we calculate 40 + .33333(80-40) = 40 + 13.333 = 53.333. The program reports a balance of 53%
----------------------