Algorithm (CoV)

Hello, this is the Algorithm for Congress of Vienna

Like AltE, we will have explanations

Casus Belli
Goes by first country to declare war. Allies joining won't matter, because it is 0 for that. Obviously only for attackers, and only for first battle of the war.
 * No reason: -5 (nobody's willing to match)
 * Fake: -4 (someone's going to find out)
 * Provide lebensraum: -3 (they can benefit from it, but they don't want to move their family)
 * Honour: -1 (lives are more important)
 * Allies: 0 (at least we're better together)
 * Provoked: +2 (people are angry)
 * Defend people: +3 if they haven't apologised (even angrier)
 * Similar people and culture: +4 (i love you, bro!)

Motives
Goes by the highest country motive in side.

e.g. If one side have 2, 3, 1, 3, 2, 4 then it's 4 for them.
 * Invading current ally: -6 (you lose trust)
 * Invading former ally (last 5 years): -4 (don't revenge)
 * Religious: -2 (religions are peaceful)
 * Economical: -1 (it actually destroys economy)
 * Political: +1 (it may strengthen positions abroad, but the people won't be happy)
 * Stranger coming: +3 (people don't like strangers) only for defenders
 * Fake casus belli: +4 to defending side
 * Against a dictatorship: +5 (everybody likes democracy) only if you are democratic yourself
 * Sovereignty: +10 (very encouraging)

Knowledge
Goes by best knowledge of battlefield among countries of the side.
 * In territory/Close or on border: +3
 * Well-known: +2 (if you've been fighting or living here before, it's easier)
 * Explored there: +1 (at least you know something)
 * Terra nullius: 0
 * Neutral state: -1 (they're afraid, they will be against you)
 * Enemy land and never there yet: -3 (you don't know everything)
 * If it's in water, there won't be anything at all here.

Landscape
Goes per side. And only for the highest applicable per side.

Important: If it is well-known to the attacker, each side have 1 (except for Desert, Forest, Hill, Mountain and Mountainous Island terrains, in that case the 1 gained over there doesn't count)
 * Plains: 0 (nothing block your view)
 * Desert: +1 for each side
 * Forest: +1.5 for defender
 * Full of lakes and ponds: +2 for defender, +0.5 for attacker
 * Hills: +2 for defender
 * Island: +3 for defender
 * Mountain: +3 for defender, +1 for attacker
 * Mountainous island: +5 for defender, +2 for attacker (and +3/+1 if it's well known to attacker)

Defensive position
Only for defensive side Mods will evaluate if your economy is good enough for these things. And if a Great Wall is short enough, bypassing it would take 1 turn. Then the Great Wall doesn't count.
 * Fortifications: +8, and it will take two turns
 * Great Walls: +12, and it will take three turns
 * Incomplete would be a fraction of this.

Miscellaneous
Goes per side.
 * Surrounded: -10 to surrounded side (doesn't count if you have a Great Wall covering all of your coast and border)
 * Superiority: +2 to superior side
 * Bad memories: -4 if you lost last turn in this war
 * Every turn deduction: -1 (starting from third consecutive turn)
 * If you skip less than 5 turns before starting a second war, you must carry your war-weariness deduction to the next war, with reduce in deduction 5*(no. of turns skipped).
 * If you skip 5 turns or more, no carry
 * If you fight on 2+ fronts at the same time and you don't mention how many per front, your army will be split evenly
 * An unguarded front: your score is 1, regardless what you've got above

Population
Per belligerent country. For each country, you only count the closest contiguous area to the battlefield.
 * Under 2 million: +1
 * 2m - 5m: +2
 * 5m - 20m: +3
 * 20m - 50m: +4
 * Over 50m: +5
 * If you have a densely populated area being attacked, then you get +5, because they will form guerrilas

Menforce
=(Army force + Knight force x 3 + Marine force x 2 + Guerrila force x 0.5) x 0.001

Technology, Science etc.

 * Side with total population higher: +2
 * Side with greater industry: +4
 * Side with better science and technology: +4
 * Non-Military help (per nation): = Total Population of that country

Bonuses

 * Military junta established/autocrat military regime installed last 4 turns: +3
 * Against a superpower belligerent neighbor: +5
 * Unchosen/mod controlled nations as Defendant: +2

Economy and Military Points
Goes by highest points per side.

Similar to AltE's system.
 * EP is never smaller than MP
 * EP and MP are both between 0 and 5
 * Defenders get EP+MP, Attackers get MP only

Finally, the results

 * 1) Find the expansion limit for the first country that declare war in the side. (use the rule of AltE, and the px size in the World Map, however if battlefield in Europe only count the pixels that are in European Map)
 * 2) Add things up
 * 3) Which side have more points win
 * 4) Find winning coefficient (losing score/winning score)
 * 5) Winning side casualities = Losing side casualities * winning coefficient (winning side casualities cannot exceed 3/4 total winning army)
 * 6) Winning side takes = (expansion limit / winning coefficient) * battle role multiplier
 * 7) If it's attacker winning defender, the attacker cannot take more than the whole defender area.