Algorithm (Congress of Vienna Reinstalled Map Game)

Algorithm for Congress of Vienna - Reinstalled (Map Game). Note: Unfortunately and miserably, I've just found out that this algorithm would not work to the slightest meaning of the term to people who are revolting to create independence. So that means we would need another algorithm. Revolting Algorithm is a purely new concept and have not been incorporated anywhere else (in fact, elsewhere people just decide the outcomes without having algorithm, because revolting forces don't have anything about trained menforce, economic and military points, technology/science/industry, population cannot be evaluated, bonus certainly can't be used, cannot evaluate knowledge, landscape and defending positions so the revolters will easily lose). We will try, yes.

Land vs Sea Battles
Land battles: Do all parameters

Sea battles: Only Casus Belli, Motive, Miscellaneous (Superiority, Bad memories, War-weariness Turn-by-Turn deduction, Unguarded Fronts), Menforce, Technology/Science/Industry/Total Population/Non-Military Help, Bonuses, Economical and Military Points count

In Sea battles, you skip: Knowledge, Landscape, Defending Positions (you can't fortify the high seas), Population.

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) - can't be used for sea battles
 * 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) and +2 if they apologised (sometimes it's not enough, guys)
 * 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 side.

Important: Only applies to Defending side. Contiguous area may span more than one country. Finally islands that have no borders count towards the closest landmass that have border (like St Pierre and Miquelon counts towards Canada and not France), except for main island of an islandic country.

Eg. If Russia invades Alaska, then the Population count for the US only includes the state of Alaska. But if Canada helps the US defend, then the total count = Alaska + Canada + Contiguous 48 states
 * 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

For Land Battles
=(Army force + Knight force x 3 + Marine force x 2 + Guerrila force x 0.5) x 0.001

For Sea Battles
=(Marine force + Navy 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.

For how to calculate these points, look at the rules. For Economic Points: For Military Points: 0 mp +0, 1 mp +1, 2 mp +2, and so on.
 * 1) Crashing (0 ep) -5
 * 2) Falling (1 ep) -3
 * 3) Poor (2 ep) -1
 * 4) Average (3 ep) +1
 * 5) Good (4 ep) +3
 * 6) Great (5 ep) +5

Finally, the results

 * 1) Find the expansion limit for the first country that declare war in the side. (use the rule)
 * 2) Add things up (the points over there)
 * 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