Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <unistd.h>
- #include <chrono>
- #include <thread>
- #include <fstream>
- #include <algorithm>
- #include <utility>
- #include <cmath>
- using namespace std;
- //string allparties[6][5] = {{"National Revival Rally - L", "Collectivist Union","Labor Party", "New Cultural Movement - L", "Patriotic Socialists United - L"}, {"National Reform Council", "New Cultural Movement - P", "Yellow & Blue Alliance - P", "People's Nationalist League - P", "National Revival Rally - P"}, {"Liberal Democratic Congress", "Unity and Nation - M", "Yellow & Blue Alliance - M", "Centrist Democrats", "National Revival Rally - M"}, {"The Traditional Way", "Unity and Nation - R", "Yellow & Blue Alliance - R", "Conservative Labor", "National Revival Rally - R"},{"Order and Culture Front", "Unity and Nation - N", "Patriotic Socialists United - N", "National Revival Rally - N", "People's Nationalist League - N"}, {"National Development Corp", "United Officer's League", "People's Revolutionary Vanguard"}};
- string allparties[6][10]= {
- {"Labor Action Front","Democratic Liberation Party","Socialist United Front","National Democratic Party","Worker's Party","National Congress of Unions","Labor, Liberty, Action","People's Liberation Party","People's Struggle Party","Worker's Unity Front"},
- {"Progressive Unity Party","Forward Party","Social Prosperity Coalition","Social Democrats","Left Bloc","Democratic Renewal Front","National Labor Coalition","Progressive Democracy","Labor Interests List","Social Bloc"},
- {"Unity and Independence Movement","Progressive Moderates Alliance","Common Ground","Centrist Democrats","Unity Party","Liberal Party","Center Alliance","A Better Future","National Stability Coalition","National Unity List"},
- {"Reform Party","Tradition and Democracy","National Sovereignty Party","Democratic Interests Alliance","Righteous Future Movement","Restoration Party","True Democracy","Federalist-Nationalist Party","Nationalist Revival Coalition","United Right Party"},
- {"Homeland First Party","Social Purity Movement","Sovereign Nation Party","Patriotic Renewal Front","One Nation, One Culture","Heritage Party","Our Land","Nationalist Democratic Movement","Patriotic Movement","New Nationalism"},
- {"National Stability Directorate","National Security Council","Order Maintenance Committee","Defense Authority Council","Sovereignty Guardianship Council","Military Oversight Committee","National Harmony Command","Authority Preservation Council","Unity and Defense Directorate","Strategic Leadership Council"}
- };
- string par_name[7] = {"Labor Action List", "Nationalist People's Party", "Unity and Independence Movement", "National Sovereignty Party", "Nationalist Democratic Movement", "National Development Corp", "Vacant"};
- string par_acro[7] ={"Far-Left", "Center-Left", "Center", "Center-Right", "Far-Right", "Military", "Vacant"};
- string ideologies[5][5] = {
- {"Communism","Reformist Syndicalism","Socialism", "Market Socialism", "National Communism"},
- {"Social Democracy","Social Liberalism","Progressive Liberalism", "Left-wing Populism", "Religious Socialism"},
- {"Market Liberalism","Third Way","Fiscal Conservatism", "Religious Liberalism", "Big Tent"},
- {"Dynastic Democracy","Populist Conservatism","Libertarianism", "Religious Conservatism", "Neoconservatism"},
- {"Nationalism","Right Corporatism","Traditionalism", "National Socialism", "National Conservatism"},
- };
- string pcro[5];
- int acronum[7] = {0,1,2,3,4,0,0};
- int par_coal[5];
- float par_seats[5];
- int par_seats_int[5];
- int regions = 150;
- bool ismajor[5] = {false,false,false,false,false};
- int wbmid =0; // 0 = midterm before snap: make next elect general, 1 = general before snap, make next elect midterm
- bool snap = false;
- int friendly[6];
- int ctfnum =0;
- bool ctfyes = false;
- int mode =0; // 0 = Sainte-league , 1 = D'Hondt
- string flags[13] = {"Economic Redistribution", "Labor Rights Empowerment", "Social Welfare Expansion", "Education Reform", "Market Regulation", "Immigration Management", "Foreign Relations Diplomacy", "Cultural Heritage Preservation", "Strong National Defense", "Identity-Based Citizenship", "Environmental Protection", "National Security Enhancement", "Ethnic and National Exclusivity"};
- int minumpol = 7;
- int pflags[5];
- int prevseats[5] = {0,0,0,0,0};
- string prevideo;
- int splural = 0;
- int startyear = 1948;
- bool isnew[5] = {true,true,true,true,true};
- int ppyear= 1948;
- int psyear = startyear;
- string ppar = "vacant";
- bool prevmid = false;
- int fpol =0;
- int military = 80;
- int milfav = 4, milenem =0;
- int milyear = startyear;
- int intervals = 2;
- int inyear = startyear;
- string userinput ="";
- bool wassnap = false;
- int prevtot =0;
- int policy;
- float pfloat = 0.50;
- int year = startyear;
- int trendyear = startyear;
- int lhgains[5] = {0,0,0,0,0};
- int population = 1526789;
- float turnout = 0.5;
- int votingpops =0;
- int militancy = 50;
- int prevpercent[5] = {0,0,0,0,0};
- bool fair = true;
- int presyear =startyear, premyear = startyear;
- string cannames[8];
- string pcannames[7] = {"","","","","","",""};
- int pcanyear[5] = {startyear,startyear,startyear,startyear,startyear};
- int canyear[5] = {startyear,startyear,startyear,startyear,startyear};
- string prevpres = "", prevprem = "";
- string presprename, premprename;
- string pname, pmname;
- string president, primeminister, opposition;
- int trending =2;
- float par_votes[5] = {25,25,25,25,25};
- int par_votes_int[5];
- float par_percent[5];
- int par_percent_int[5];
- float popularity[5] = {20,20,20,20,20};
- int totalvotes =0;
- int tvts =0;
- int prevpop =100000;
- int people =100;
- int pefav = trending, penem = 4;
- int peyear = startyear; // note: create a people's revolution mechanic
- int seats = 250;
- int seatcheck;
- int presidentnum =6;
- int pres_votes =0;
- int juntayear = startyear-8;
- int primeministernum =6;
- int oppositionnum =6;
- int govmembers=0;
- int gmem[5];
- int govseats;
- int govper;
- int plurality;
- int pluralvotes;
- int oppomembers =0;
- int omem[5];
- int opposeats;
- int oppoper;
- int indepmembers =0;
- int imem[5];
- int indepseats =0;
- int indeper;
- int prevpar =6;
- int prvtot =0;
- int p_auth[7] = {0,0,0,0,0};
- // -5 to 5
- int totauth = 20; // higher, less authoritarian, lower more authoritarian
- // -100 to 100
- int av_correspond =0; // this integer will correspond to the "i" integer use din the for loop for adding votes
- bool midterm = false;
- bool junta = false;
- bool ot =false;
- int countdown = startyear;
- int economy = 40; // only goes 1 to 100
- int competence[5] = {2,3,4,3,2};
- int BBC = 5;
- bool boom = true;
- int shiffty;
- void mupdate()
- {
- /*militancy += (p_auth[presidentnum]*10)*0.10;
- militancy += totauth*0.5;
- militancy += people*0.20;
- militancy -= ((year - presyear)/100)*0.20;*/
- militancy = (totauth*0.25) + (people*0.25) + (((year - presyear)/100)*0.25) + ((p_auth[presidentnum]*10)*0.10);
- if(militancy > 100)
- {
- militancy =100;
- }
- if(militancy < -100)
- {
- militancy = -100;
- }
- }
- void upturnout()
- {
- turnout = turnout*100;
- float tchange, pfol = (float) people*0.50, efol = (float)economy*0.25, tfol = (float)totauth*0.25;
- /*if(pfol <5)
- {
- pfol = 5;
- }
- if(efol < 5)
- {
- efol =5;
- }
- if(tfol < 5)
- {
- tfol = 5;
- }*/
- tchange = (pfol+efol+tfol)/100;
- /*string ipt;
- cout << "total change: " << tchange << endl;
- cout << "people: " << pfol << endl;
- cout << "Economy: " << efol << endl;
- cout << "totauth: " << tfol << endl;
- cin >> ipt;*/
- //float tchange = (float) (people*0.50) + (economy*0.25) + (totauth*0.25);
- turnout += (float) turnout*tchange;
- while(turnout >= 100)
- {
- if(turnout >= 100)
- {
- turnout -= rand()%30;
- }
- }
- if(turnout <1)
- {
- turnout += (rand()%30)+1;
- }
- if(turnout < 70)
- {
- turnout += (70 - turnout) + rand()%20;
- }
- turnout /=100;
- }
- void uppop()
- {
- float tchange = (float)people*0.05;
- tchange += (float)economy*0.025;
- tchange += (float)totauth*0.025;
- if(tchange <=-2)
- {
- tchange =-2;
- }
- tchange = tchange/100;
- population += population*tchange;
- }
- void calcto()
- {
- votingpops = population*turnout;
- }
- void updateauth()
- {
- float auadd = (float) p_auth[presidentnum]*(popularity[presidentnum] + (par_seats[presidentnum]/seats));
- //cout << "Before: " << totauth << endl;
- totauth += p_auth[presidentnum];
- //cout << "Party Auth: " << p_auth[presidentnum] << endl;
- totauth += militancy*0.025;
- //cout << "Militancy: " << militancy*0.025 << endl;
- float pear = (float) year, spear = (float) psyear;
- auadd = (float)(pear - spear);
- auadd /= 100;
- totauth -= totauth* auadd;
- //cout << "totauth decrease: " << auadd << endl;
- totauth += 10 - rand()%5;
- if(par_seats_int[presidentnum] >= seats*0.75)
- {
- totauth -= 10;
- }
- //cout << "Before: " << totauth << endl;
- //totauth += auadd;
- if(totauth > 100)
- {
- totauth = 100;
- } else if(totauth < -100)
- {
- totauth = -100;
- }
- }
- void bbcupdate()
- {
- if(boom)
- {
- BBC++;
- } else
- {
- BBC--;
- }
- if(BBC >= 10)
- {
- BBC--;
- boom = false;
- }
- if(BBC <= -10)
- {
- shiffty = (rand()%3)*5;
- BBC++;
- boom = true;
- }
- if(boom == false)
- {
- if(rand()%10 < competence[presidentnum]/2)
- {
- boom = true;
- shiffty = (rand()%3)*5;
- }
- } else if(boom == true)
- {
- if( rand()%10 > competence[presidentnum]*2)
- {
- boom = false;
- }
- }
- }
- void shiftcomp(int k)
- {
- if(rand()%10 <5)
- {
- competence[k]++;
- } else
- {
- competence[k]--;
- }
- if(competence[k] > 10)
- {
- competence[k] = 10;
- }
- if(competence[k] < 1)
- {
- competence[k] = 1;
- }
- }
- void ecupdate()
- {
- float bonus =0;
- //cout << "competence: " << competence[presidentnum] << endl;
- switch(competence[presidentnum])
- {
- case 1:bonus = -0.25;
- break;
- case 2:bonus = -0.2;
- break;
- case 3:bonus = -0.15;
- break;
- case 4:bonus = -0.1;
- break;
- case 5:bonus = -0.05;
- break;
- case 6:bonus = 0;
- break;
- case 7:bonus = 0.1;
- break;
- case 8: bonus = 0.15;
- break;
- case 9: bonus = 0.2;
- break;
- case 10: bonus = 0.25;
- break;
- default:
- bonus = 0;
- break;
- }
- switch(people/10)
- {
- case 1:bonus += -0.25;
- break;
- case 2:bonus += -0.2;
- break;
- case 3:bonus += -0.15;
- break;
- case 4:bonus += -0.1;
- break;
- case 5:bonus += -0.05;
- break;
- case 6:bonus += 0.05;
- break;
- case 7:bonus += 0.1;
- break;
- case 8: bonus += 0.15;
- break;
- case 9: bonus += 0.2;
- break;
- case 10: bonus += 0.25;
- break;
- default:
- if(people < 0)
- {
- bonus += -0.3;
- }else
- {
- bonus += 0.3;
- }
- }
- float BBChange = (float) BBC/100;
- //cout << "Before " << economy << endl;
- economy += economy*BBChange;
- //cout << "Boom Bust Effect: " << BBChange << endl;
- //cout << "Ecobonus: " << bonus << endl;
- economy += economy*bonus;
- int downturn = rand()%10;
- //cout << "downturn: " << downturn << endl;
- economy -= downturn;
- economy += militancy*0.025;
- //cout << "Militancy Bonus: " <<militancy*0.025 << endl;
- //cout << "After " << economy << endl;
- if(economy > 100)
- {
- economy = 100;
- }
- if(economy < -100)
- {
- economy = -100;
- }
- }
- void indivgen(int k)
- {
- string consonant[20] = {"B","B","K","D","G","H","H","L","L","M","N","P","R","S","S","T","T","W","W","Y"};
- string vowel[13] = {"A","A","A","A","A","E","I","I","I","O","O","O","U"};
- string aftercon[11] = {"NG","NG","M","M","N","K","K","P","P","T","Y"};
- string bloc1,bloc2, bloc3;
- string fname, lname;
- bloc1 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc1 += aftercon[rand()%11];
- }
- bloc2 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc2 += aftercon[rand()%11];
- }
- bloc3 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc3 += aftercon[rand()%11];
- }
- fname = bloc1 + bloc2;
- if(rand()%10 < 5)
- {
- fname += bloc3;
- }
- bloc1 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc1 += aftercon[rand()%11];
- }
- bloc2 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc2 += aftercon[rand()%11];
- }
- bloc3 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc3 += aftercon[rand()%11];
- }
- lname = bloc1 + bloc2;
- if(rand()%10 < 5)
- {
- lname += bloc3;
- }
- cannames[k] = fname + " " + lname;
- }
- void pmindivgen(int k)
- {
- string consonant[20] = {"B","B","K","D","G","H","H","L","L","M","N","P","R","S","S","T","T","W","W","Y"};
- string vowel[13] = {"A","A","A","A","A","E","I","I","I","O","O","O","U"};
- string aftercon[11] = {"NG","NG","M","M","N","K","K","P","P","T","Y"};
- string bloc1,bloc2, bloc3;
- string fname, lname;
- bloc1 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc1 += aftercon[rand()%11];
- }
- bloc2 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc2 += aftercon[rand()%11];
- }
- bloc3 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc3 += aftercon[rand()%11];
- }
- fname = bloc1 + bloc2;
- if(rand()%10 < 5)
- {
- fname += bloc3;
- }
- bloc1 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc1 += aftercon[rand()%11];
- }
- bloc2 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc2 += aftercon[rand()%11];
- }
- bloc3 = consonant[rand()%20] + vowel[rand()%13];
- if(rand()%10 < 3)
- {
- bloc3 += aftercon[rand()%11];
- }
- lname = bloc1 + bloc2;
- if(rand()%10 < 5)
- {
- lname += bloc3;
- }
- pcannames[k] = fname + " " + lname;
- }
- void pecheck()
- {
- int dbgto=0;
- if(acronum[presidentnum] == pefav)
- {
- people += 10;
- dbgto += 10;
- } else if(acronum[presidentnum] == penem)
- {
- people -= 10;
- dbgto -= 10;
- } else
- {
- if(acronum[presidentnum] > pefav)
- {
- people -= acronum[presidentnum] - pefav;
- dbgto -= acronum[presidentnum] - pefav;
- } else
- {
- people -= pefav -acronum[presidentnum];
- dbgto -= pefav -acronum[presidentnum];
- }
- if(acronum[presidentnum] > penem)
- {
- people += acronum[presidentnum] - penem;
- dbgto += acronum[presidentnum] - penem;
- } else
- {
- people += penem -acronum[presidentnum];
- dbgto += penem -acronum[presidentnum];
- }
- }
- if(pefav == acronum[oppositionnum])
- {
- people -= 5;
- dbgto -= 5;
- }
- if(penem == acronum[primeministernum])
- {
- people -= 5;
- dbgto -= 5;
- }
- if(pefav == acronum[primeministernum])
- {
- people += 5;
- dbgto += 5;
- }
- //cout << "Total pos bonus: " << dbgto << endl;
- people -= par_percent_int[penem]/2;
- //cout << "penem bonus: " << par_percent_int[penem]/2 << endl;
- people += par_percent_int[pefav]/2;
- //cout << "pefav bonus: " << par_percent_int[pefav]/2 << endl;
- people += economy*0.15;
- //cout << "Eco bonus: " << economy*0.15 << endl;
- people += totauth*0.10;
- //cout << "Auth bonus: " << totauth*0.10 << endl;
- people += militancy*0.10;
- //cout << "Mil bonus: " << militancy*0.10 << endl;
- if(fair == false)
- {
- people -= year - presyear;
- }
- //string upt;
- //cin >> upt;
- if(people > 100 && acronum[presidentnum] == pefav)
- {
- people = 100;
- } else if (people > 40 && acronum[presidentnum] == acronum[penem])
- {
- people = 40;
- } else if (people > 70 && acronum[presidentnum] != acronum[pefav] && presidentnum != acronum[penem])
- {
- people = 70;
- }
- if(people < -200)
- {
- people = -200;
- }
- }
- void pshift()
- {
- /*switch(rand()%10)
- {
- case 1:
- case 2:
- penem++;
- break;
- case 9:
- case 8:
- penem --;
- break;
- default:
- break;
- }*/
- int cchange =0;
- cchange = (rand()%2) -1;
- penem += cchange;
- cchange = (rand()%2) -1;
- pefav += cchange;
- if(penem > 4)
- {
- penem = 4;
- }
- if(penem < 0)
- {
- penem =0;
- }
- if(pefav > 4)
- {
- pefav = 4;
- }
- if(pefav < 0)
- {
- pefav =0;
- }
- if(penem == pefav)
- {
- penem = rand()%4;
- }
- }
- void revcheck()
- {
- if(rand()%20 < year - peyear)
- {
- if(people < -25 && rand()%20 > (people + par_percent_int[presidentnum])-intervals && militancy < -10)
- {
- intervals =0;
- peyear = year;
- ofstream presfile;
- presfile.open("Presidents.txt", fstream::app);
- presfile << presprename << " (" << prevpres << " | " << prevideo << ") " << presyear << " - " << year << " (REVOLT)" << endl;
- presfile.close();
- presyear = year;
- prevpres = par_name[presidentnum];
- presprename = cannames[presidentnum];
- ofstream pmfile;
- pmfile.open("Premieres.txt", fstream::app);
- pmfile << premprename << " (" << prevprem << ") " << premyear << " - " << year << " (REVOLT)"<< endl;
- pmfile.close();
- premyear = year;
- prevprem = par_name[primeministernum];
- premprename = cannames[primeministernum];
- economy -= (rand()%5)*5;
- if(presidentnum == milfav)
- {
- military -=50;
- } else if(presidentnum == milenem)
- {
- military += 25;
- } else
- {
- military -=30;
- }
- totauth += (rand()%100)-50;
- popularity[presidentnum] = 0;
- intervals = 0;
- ot = true;
- militancy += (rand()%100)-50;
- acronum[pefav] = pefav;
- par_name[pefav] = allparties[acronum[pefav]][rand()%9];
- presidentnum = pefav;
- popularity[presidentnum] = 100;
- oppositionnum = penem;
- president = par_name[pefav];
- opposition = par_name[oppositionnum];
- presyear = year;
- pname = cannames[pefav];
- primeministernum = 6;
- primeminister = "VACANT";
- premyear = year;
- pmname = "VACANT";
- fair = true;
- junta = false;
- midterm = false;
- people =99;
- cout << "REVOLUTION!" << endl;
- sleep(1);
- }else if(people < -10 && rand()%100 < military)
- {
- people += rand()%200;
- militancy += rand()%200;
- totauth -= rand()%200;
- int plr = popularity[presidentnum]/2;
- popularity[presidentnum] = (float )plr;
- cout << "REVOLUTION FAILED" << endl;
- sleep(1);
- }
- }
- }
- void mchange()
- {
- if((rand()%year-startyear)+1 < year - milyear)
- {
- milyear = year;
- int k = rand()%10;
- int cchange = 0;
- cchange = (rand()%3) -1;
- milfav += cchange;
- if(milfav > 4)
- {
- milfav =4;
- } else if( milfav < 0)
- {
- milfav = 0;
- }
- cchange = (rand()%3) -1;
- milenem += cchange;
- for(int i=0; i!= oppomembers; i++)
- {
- if(milfav == omem[i])
- {
- military -=5;
- }
- if(milenem == omem[i])
- {
- military +=5;
- }
- }
- for(int i=0; i!= govmembers; i++)
- {
- if(milfav == gmem[i])
- {
- military +=5;
- }
- if(milenem == gmem[i])
- {
- military -=5;
- }
- }
- if(milenem > 4)
- {
- milenem =4;
- } else if( milenem < 0)
- {
- milenem = 0;
- }
- if(milfav > 4)
- {
- milfav =4;
- } else if( milfav < 0)
- {
- milfav = 0;
- }
- while(milenem == milfav)
- {
- milenem = rand()%4;
- }
- }
- par_name[5] = allparties[5][rand()%3];
- }
- void covalues()
- {
- if(acronum[presidentnum] == milfav)
- {
- military += 10;
- }else if(acronum[presidentnum] == milenem)
- {
- military -= 10;
- }else
- {
- if(acronum[presidentnum] < milenem)
- {
- military += milenem - acronum[presidentnum];
- } else
- {
- military += acronum[presidentnum] - milenem;
- }
- if(presidentnum < milfav)
- {
- military -= milfav - acronum[presidentnum];
- }else
- {
- military -= acronum[presidentnum] - milfav;
- }
- }
- if(acronum[primeministernum] == milfav)
- {
- military += 5;
- } else if(acronum[primeministernum] == milenem)
- {
- military -= 5;
- }
- if(oppositionnum == milfav)
- {
- military -= 20;
- }
- if(fair == false)
- {
- military -= year- presyear;
- }
- if(military > 100 && acronum[presidentnum] == milfav)
- {
- military = 100;
- } else if (military > 40 && acronum[presidentnum] == milenem)
- {
- military = 40;
- } else if (military > 70 && acronum[presidentnum] != milfav && acronum[presidentnum] != milenem)
- {
- military = 70;
- }
- if(military < -100)
- {
- military =-100;
- }
- military += economy/10;
- military-= totauth/10;
- military += (int) (par_seats[milfav] / seats)*100;
- military -= (int) (par_seats[milenem] / seats)*100;
- }
- void coupcheck()
- {
- // coup factor = term length(year - presyear)
- if(rand()%8 < year - juntayear && junta == false)
- {
- int supportfactor = (int)(par_percent_int[presidentnum]/10 + ((par_seats[presidentnum] / seats)*100) + military) - (year-presyear);
- int sfcheck = rand()%50;
- sfcheck = sfcheck - (sfcheck*2);
- if(sfcheck > supportfactor-intervals)
- {
- intervals = 0;
- junta = true;
- ot = true;
- juntayear = year;
- ofstream presfile;
- presfile.open("Presidents.txt", fstream::app);
- presfile << presprename << " (" << prevpres << " | " << prevideo << ") " << presyear << " - " << year << " (COUP)" << endl;
- presfile.close();
- presyear = year;
- prevpres = par_name[presidentnum];
- presprename = cannames[presidentnum];
- ofstream pmfile;
- pmfile.open("Premieres.txt", fstream::app);
- pmfile << premprename << " (" << prevprem << ") " << premyear << " - " << year << " (COUP)"<< endl;
- pmfile.close();
- premyear = year;
- prevprem = par_name[primeministernum];
- premprename = cannames[primeministernum];
- economy -= (rand()%5)*5;
- if(presidentnum == pefav)
- {
- people -=50;
- } else if(presidentnum == penem)
- {
- people += 25;
- } else
- {
- people -=30;
- }
- fair = false;
- totauth += (rand()%50)-100;
- militancy += (rand()%50)-100;
- intervals = 0;
- presidentnum = milfav;
- pcro[milfav] = "Junta";
- par_name[milfav] = "Military Government";
- isnew[milfav] = true;
- prevseats[milfav] = 0;
- prevpercent[milfav] = 0;
- canyear[milfav] = year;
- indivgen(milfav);
- shiftcomp(milfav);
- p_auth[milfav] = (rand()%10) -(5+(abs(acronum[milfav]-3)*2));
- pflags[milfav] = (rand()%minumpol)+acronum[milfav];
- friendly[milfav] = (rand()%20)-10;
- oppositionnum = milenem;
- president = par_name[presidentnum];
- opposition = par_name[oppositionnum];
- presyear = year;
- pname = cannames[milfav];
- primeministernum = 6;
- primeminister = "VACANT";
- premyear = year;
- pmname = "VACANT";
- midterm = false;
- military =99;
- cout << "MILITARY COUP!" << endl;
- sleep(1);
- } else if(military < -10 && rand()%100 < people)
- {
- military += rand()%200;
- militancy += rand()%200;
- totauth -= rand()%200;
- int plr = popularity[presidentnum]/2;
- popularity[presidentnum] = (float )plr;
- cout << "COUP ATTEMPT FAILED" << endl;
- sleep(1);
- }
- }
- }
- void countplural()
- {
- pluralvotes = 0;
- for(int i=0; i!=5; i++)
- {
- if(par_votes_int[i] > pluralvotes)
- {
- plurality =i;
- pluralvotes = par_votes_int[i];
- }
- }
- }
- void dsdhondt()
- {
- int winr = 6;
- int winnum =0;
- int vcomp[6];
- int counts[6]= {0,0,0,0,0};
- int leading =6;
- int lnum =0;
- vcomp[5] =0;
- for(int i=0; i!=5; i++)
- {
- if(par_votes_int[i] > lnum)
- {
- leading =i;
- lnum = par_votes_int[i];
- }
- }
- for(int i=0; i!=5; i++)
- {
- vcomp[i] = par_votes_int[i];
- }
- int prv =seats*pfloat; //abs
- int cng =0;
- while(0< seats*pfloat)
- {
- //cout << "A";
- for(int j=0; j!=5; j++)
- {
- //cout << "B";
- if(vcomp[j] > winnum)
- {
- if(par_votes_int[j] > ctfnum)
- {
- winr = j;
- winnum = vcomp[j];
- }
- //winr = j;
- //winnum = vcomp[j];
- }
- }
- /*for(int f=0; f!=5; f++)
- {
- cout << par_name[f] << " " << counts[f]+1 << " " << vcomp[f] << " ";
- if(f == winr)
- {
- cout << "+";
- if(f == leading)
- {
- cout << "5";
- }
- }
- cout << endl;
- }*/
- prv = counts[winr];
- counts[winr]++;
- if(winr == leading)
- {
- par_seats[winr]+= par_percent_int[winr]/10;
- par_seats_int[winr]+= par_percent_int[winr]/10;
- }
- vcomp[winr] = par_votes_int[winr]/(counts[winr]+1);
- par_seats[winr]++;
- par_seats_int[winr]++;
- if(vcomp[winr] == 0 && rand()% 100 < par_percent_int[winr])
- {
- for(int c=0; c!=5; c++)
- {
- vcomp[c] = par_votes_int[c];
- }
- }
- cng += counts[winr];
- if(cng >= seats*pfloat)
- {
- break;
- }
- winnum =0;
- winr =6;
- //sleep(1);
- //system("CLS");
- }
- for(int i=0; i!=5; i++)
- {
- lhgains[i] = par_seats_int[i];
- }
- }
- void cutoff()
- {
- int totv =0;
- for(int i=0; i!=5; i++)
- {
- totv+= par_votes_int[i];
- }
- ctfnum = totv/((seats/regions)+5);
- }
- void checkcutoff()
- {
- int ctotau = totauth+100;
- if(par_votes_int[presidentnum] < totalvotes /2)
- {
- ctfyes = true;
- cutoff();
- } else
- {
- ctfyes = false;
- }
- }
- void domode()
- {
- int ctotau = totauth+100;
- int kai = rand()%200;
- if(kai < ctotau)
- {
- mode = 0;
- } else if (kai > ctotau && govseats > seats*0.75)
- {
- mode =1;
- }
- }
- void discont()
- {
- srand(time(NULL));
- int order[5] = {0,0,0,0,0};
- int oper[5] = {0,0,0,0,0};
- for(int i=0; i!=5; i++)
- {
- oper[i] = par_percent_int[i];
- order[i] = i;
- }
- for(int i=0; i!=5; i++)
- {
- if(i == presidentnum && midterm == true)
- {
- oper[i] += 5;
- } else if(i == plurality && midterm == false)
- {
- oper[i] += 15;
- } else if(i == presidentnum && midterm == false)
- {
- oper[i] += 5;
- } else if(i == plurality && midterm == true)
- {
- oper[i] += 10;
- }
- if(i == presidentnum)
- {
- oper[i] +=10;
- }
- if(i == primeministernum)
- {
- oper[i] += 5;
- }
- if( i == oppositionnum)
- {
- oper[i] += 5;
- }
- if(acronum[i] == trending)
- {
- oper[i] += 7;
- }
- if(i == presidentnum)
- {
- oper[i] -= year-presyear;
- }
- if(plurality != presidentnum && i == plurality)
- {
- oper[i] += par_percent_int[plurality] - par_percent_int[presidentnum];
- }
- }
- int k =0;
- /*if(year == startyear)
- {
- policy = ((rand()%13) *5)+35;
- pfloat = (float) policy/100;
- }*/
- for(int c=0; c< round(seats*pfloat); c++)
- {
- for(int f=0; f!=5; f++)
- {
- k = rand()%100;
- if(k < oper[f])
- {
- par_seats[order[f]]++;
- par_seats_int[order[f]]++;
- break;
- }
- }
- }
- for(int i=0; i!=5; i++)
- {
- lhgains[i] = par_seats_int[i];
- }
- }
- void calsplu()
- {
- int winer = 1;
- for(int i=0; i!=5; i++)
- {
- if(par_seats_int[i] > winer)
- {
- splural = i;
- winer = par_seats_int[i];
- }
- }
- }
- int add_votes(int rmn)
- {
- srand(time(NULL));
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- float advote =0;
- int event = rand()%5;
- if(av_correspond == presidentnum){
- switch(event)
- {
- case 3:
- advote += (rand()%rmn) *1.10;
- case 4:
- case 5:
- advote += (rand()%rmn) *1.05;
- break;
- default:
- advote += (rand()%rmn) * 0.50;
- }
- }
- if(av_correspond == primeministernum) {
- switch(event)
- {
- case 1:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 0.75;
- }else
- {
- advote += (rand()%rmn)*0.95;
- }
- break;
- case 2:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 0.45;
- }else
- {
- advote += (rand()%rmn)*1;
- }
- case 3:
- case 4:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 0.20;
- }else
- {
- advote += (rand()%rmn)*0.45;
- }
- break;
- default:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 0.05;
- }else
- {
- advote += (rand()%rmn) * 0.10;
- }
- }
- }
- if(av_correspond == oppositionnum){
- switch(event)
- {
- case 1:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 1.05;
- }else
- {
- advote += (rand()%rmn) *1.10;
- }
- case 2:
- case 3:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 0.45;
- } else
- {
- advote += (rand()%rmn) *1;
- }
- break;
- default:
- if(primeministernum == oppositionnum)
- {
- advote += (rand()%rmn) * 0.10;
- }else
- {
- advote += (rand()%rmn) * 0.5;
- }
- }
- }
- int kal = rand()%100;
- if(kal >50)
- {
- advote += (rand()%rmn)/100;
- } else if(kal <50 && kal >30)
- {
- advote += (rand()%rmn)/50;
- } else if( kal < 30 && kal > 10)
- {
- advote += (rand()%rmn)/20;
- } else if(kal <10 && kal >3)
- {
- advote += rand()%rmn;
- } else
- {
- advote += (rand()%rmn)*2;
- }
- if(pcro[presidentnum] == pcro[oppositionnum])
- {
- if(av_correspond == presidentnum || av_correspond == oppositionnum)
- {
- advote -= advote * 0.50;
- }
- }
- if(pflags[av_correspond] == fpol)
- {
- advote += advote * 0.25;
- }
- if(ismajor[av_correspond] == true)
- {
- advote += advote*0.25;
- if(av_correspond != presidentnum && av_correspond != oppositionnum)
- {
- advote += advote*2;
- }
- }
- float pla = popularity[av_correspond]/100;
- advote += advote * pla;
- if(av_correspond == presidentnum)
- {
- float tsl = (year - ppyear)/ 200;
- advote -= advote * tsl;
- }
- for(int i=0; i!=5; i++)
- {
- if(acronum[i] == acronum[av_correspond] && i != av_correspond)
- {
- advote -= advote*0.1;
- }
- }
- if(fair == false)
- {
- if(av_correspond != presidentnum)
- {
- advote = advote /100;
- }
- }
- float qwer = (5 - abs(trending - pflags[acronum[av_correspond]]))/100;
- advote += advote * qwer;
- //float paut = (p_auth[av_correspond]+10)/100;
- //advote += advote*paut;
- if(junta == true && av_correspond == milenem)
- {
- advote = advote /10;
- }
- if(trending == acronum[av_correspond] && junta == false)
- {
- advote += advote *0.75;
- }
- if(acronum[presidentnum] > 3 && acronum[oppositionnum] > 3)
- {
- if(acronum[av_correspond] <=3)
- {
- advote += advote*0.75;
- } else if(av_correspond == presidentnum || av_correspond == oppositionnum)
- {
- advote -= advote * 0.75;
- }
- }
- if(acronum[presidentnum] < 3 && acronum[oppositionnum] < 3)
- {
- if(acronum[av_correspond] >=3)
- {
- advote += advote*0.75;
- } else if(av_correspond == presidentnum || av_correspond == oppositionnum)
- {
- advote -= advote * 0.75;
- }
- }
- float fly = (friendly[av_correspond]+10)/100;
- advote += advote*fly;
- if(av_correspond == presidentnum)
- {
- float age = (year-presyear) /100;
- advote -= advote*age;
- }
- int aconvert = (int) advote;
- return aconvert;
- }
- void count_total()
- {
- prvtot = totalvotes;
- totalvotes =0;
- for(int i=0; i!=5; i++)
- {
- par_votes_int[i] = (int) par_votes[i];
- totalvotes += par_votes_int[i];
- }
- }
- void oppoprimaries()
- {
- int wvotes =0;
- int opint[5];
- for(int i=0; i!=5; i++)
- {
- opint[i] = par_seats_int[i];
- }
- if((acronum[presidentnum] > 3 && acronum[oppositionnum] > 3) || (acronum[presidentnum] < 3 && acronum[oppositionnum] < 3))
- {
- opint[oppositionnum] = opint[oppositionnum]*0.9;
- }
- for(int i=0; i!=oppomembers; i++)
- {
- opint[omem[i]] += abs(acronum[omem[i]] - acronum[presidentnum]) * (opint[omem[i]]*0.10);
- }
- for(int i=0; i!= oppomembers; i++)
- {
- if(opint[omem[i]] > wvotes)
- {
- oppositionnum = omem[i];
- wvotes = opint[omem[i]];
- }
- }
- }
- void vcalc()
- {
- for(int i=0; i!=5; i++)
- {
- par_percent[i] = (par_votes[i] / totalvotes);
- par_percent_int[i] = (int)(par_percent[i]*100);
- }
- }
- float tseats =0;
- float remaining =0;
- void seatcalc()
- {
- tseats =0;
- seatcheck =0;
- for(int i=0; i!=5; i++)
- {
- tseats += par_seats[i];
- }
- remaining =0;
- remaining = seats-tseats;
- for(int i=0; i!=5; i++)
- {
- par_seats[i] += round(remaining * par_percent[i]);
- par_seats_int[i] = (int) par_seats[i];
- }
- }
- void prescalc()
- {
- int loservotes =1;
- pres_votes =1;
- for(int i=0; i!=5; i++)
- {
- if(par_votes_int[i] > pres_votes)
- {
- presidentnum = i;
- pres_votes = par_votes_int[i];
- }
- }
- for(int i=0; i!=5; i++)
- {
- if(par_votes_int[i] < pres_votes && par_votes_int[i] > loservotes)
- {
- oppositionnum =i;
- loservotes = par_votes_int[i];
- }
- }
- gmem[govmembers] = presidentnum;
- govseats += par_seats_int[presidentnum];
- govper += par_percent_int[presidentnum];
- govmembers++;
- if(pres_votes >= (totalvotes/2))
- {
- cout << cannames[presidentnum] << " (" << par_name[presidentnum] << ") has won the Presidency by a Majority!" << endl;
- } else
- {
- cout << cannames[presidentnum] << " (" << par_name[presidentnum] << ") has won the Presidency by a Plurality!" << endl;
- }
- if(par_name[presidentnum] != ppar)
- {
- ppar = par_name[presidentnum];
- psyear = year;
- }
- if(presidentnum != prevpar)
- {
- prevpar = presidentnum;
- prevideo = pcro[prevpar];
- ppyear = year;
- }
- if(cannames[presidentnum] != presprename && junta == false)
- {
- ofstream presfile;
- presfile.open("Presidents.txt", fstream::app);
- presfile << presprename << " (" << prevpres << " | " << prevideo << ") " << presyear << " - " << year << endl;
- presfile.close();
- presyear = year;
- prevpres = par_name[presidentnum];
- presprename = cannames[presidentnum];
- }
- if( cannames[presidentnum] != presprename && junta == true && ot == true)
- {
- ot = false;
- ofstream presfile;
- presfile.open("Presidents.txt", fstream::app);
- presfile << par_name[5] << " " << presyear << " - " << year << endl;
- presfile.close();
- presyear = year;
- prevpres = par_name[presidentnum];
- presprename = cannames[presidentnum];
- } else if( cannames[presidentnum] != presprename && junta == true && ot == false)
- {
- ofstream presfile;
- presfile.open("Presidents.txt", fstream::app);
- presfile << presprename << " (" << prevpres << " | " << prevideo << ") " << presyear << " - " << year << endl;
- presfile.close();
- presyear = year;
- prevpres = par_name[presidentnum];
- presprename = cannames[presidentnum];
- }
- pname = cannames[presidentnum];
- }
- void coalitionform()
- {
- oppomembers =0;
- omem[oppomembers] = 0;
- opposition = "";
- opposeats += 0;
- oppoper += 0;
- opposition = par_name[oppositionnum];
- omem[oppomembers] = oppositionnum;
- opposeats += par_seats_int[oppositionnum];
- oppoper += par_percent_int[oppositionnum];
- oppomembers++;
- int gchance =0;
- int ochance =0;
- gchance = par_percent_int[presidentnum]/2;
- ochance = par_percent_int[oppositionnum]/2;
- int ichance = 10;
- //cout << "Prepared Variables" << endl;
- for(int i=0; i!=5; i++)
- {
- gchance = par_percent_int[presidentnum]/2;
- ochance = par_percent_int[oppositionnum]/2;
- ichance = ((gchance+ochance)*0.05)+1;
- if(i != presidentnum && i!= oppositionnum)
- {
- if(acronum[presidentnum] > acronum[i])
- {
- ochance += (acronum[presidentnum] - acronum[i])*5;
- } else if (acronum[presidentnum] < acronum[i])
- {
- ochance += (acronum[i]-acronum[presidentnum])*5;
- } else if(acronum[presidentnum] == acronum[i])
- {
- gchance == 10;
- }
- if(acronum[oppositionnum] > acronum[i])
- {
- gchance += (acronum[oppositionnum] - acronum[i])*5;
- } else if (acronum[oppositionnum] < acronum[i])
- {
- gchance += (acronum[i]-acronum[oppositionnum])*5;
- }else if(acronum[oppositionnum] == acronum[i])
- {
- ochance == 10;
- }
- if(pflags[i] == pflags[presidentnum])
- {
- if(presidentnum > i)
- {
- gchance += (presidentnum - i)*5;
- } else
- {
- gchance += (i-presidentnum)*5;
- }
- } else if(pflags[i] == pflags[oppositionnum])
- {
- if(oppositionnum > i)
- {
- gchance += (oppositionnum - i)*5;
- } else
- {
- gchance += (i-oppositionnum)*5;
- }
- } else
- {
- if(pflags[i] > pflags[presidentnum])
- {
- ochance += (pflags[i] - pflags[presidentnum])*2;
- } else
- {
- ochance += (pflags[presidentnum] - pflags[i])*2;
- }
- if(pflags[i] > pflags[oppositionnum])
- {
- gchance += (pflags[i] - pflags[oppositionnum])*2;
- } else
- {
- gchance += (pflags[oppositionnum] - pflags[i])*2;
- }
- }
- gchance += friendly[presidentnum]*2;
- ochance += friendly[oppositionnum]*2;
- if(par_seats_int[presidentnum] >= seats/2)
- {
- ochance+=10;
- gchance-=10;
- }
- if(snap == true)
- {
- gchance *=10;
- }
- //cout << "Finished Manipulating Chances" << endl;
- // coalition chance
- /*long long ccer =0;
- long long totalChance = ochance + gchance + ichance;
- if (totalChance <= RAND_MAX) {
- ccer = (rand() % totalChance) + 1;
- } else
- {
- totalChance/=10;
- ccer = (rand() % totalChance) + 1;
- }
- ccer = (rand()%(ochance + gchance + ichance))+1;*/
- int tchan = (ochance + gchance + ichance)+1;
- float ocp = (ochance / static_cast<float>(tchan)) * 100;
- float gcp = (gchance / static_cast<float>(tchan)) * 100;
- float icp = (ichance / static_cast<float>(tchan)) * 100;
- int evt = rand()%100;
- //cout << "Generated Random Number" << endl;
- if(evt >= ocp+icp)
- {
- gmem[govmembers] = i;
- govseats += par_seats_int[i];
- govper += par_percent_int[i];
- govmembers++;
- } else if(evt < ocp && evt > icp)
- {
- omem[oppomembers] =i;
- opposeats += par_seats_int[i];
- oppoper += par_percent_int[i];
- oppomembers++;
- } else
- {
- imem[indepmembers] =i;
- indepseats += par_seats_int[i];
- indeper += par_percent_int[i];
- indepmembers++;
- }
- //cout << "Finished Deciding Coalitions" << endl;
- }
- }
- if(oppositionnum == presidentnum)
- {
- oppositionnum = omem[rand()%oppomembers];
- }
- }
- void pmcalc()
- {
- float goseats = (float) govseats, opseats = (float) opposeats, inseats = (float) indepseats;
- goseats = (goseats/seats)*100;
- opseats = (opseats/seats)*100;
- inseats = (inseats/seats)*100;
- govper = (int) goseats;
- oppoper = (int) opseats;
- indeper = (int) inseats;
- bool hasfoundpm = false;
- int gplu =0;
- if(govseats+1 > opposeats && indepseats < (govseats+1) + opposeats)
- {
- int tgovseats = 0;
- for(int i=0; i!= govmembers; i++)
- {
- tgovseats += par_seats_int[gmem[i]];
- }
- cout << "The Ruling Party has secured a majority in parliament" << endl;
- if(par_seats_int[presidentnum] > tgovseats/2)
- {
- primeministernum = presidentnum;
- }else
- {
- int wnp =0;
- int wnr = 6;
- for(int i=0; i!= govmembers; i++)
- {
- //cout << "A" << endl;
- if(par_seats_int[gmem[i]] > wnp)
- {
- wnp = par_seats_int[gmem[i]];
- wnr = gmem[i];
- //cout << "B" << endl;
- }
- }
- primeministernum = wnr;
- }
- //cout << "Finished picking a PM" << endl;
- cout << pcannames[primeministernum] << "(" << par_name[primeministernum] << ") has been appointed Prime Minister" << endl;
- } else
- {
- if(indepseats >= (govseats+1) + opposeats)
- {
- cout << "A majority in parliament has declared a boycott. \nSnap elections have been scheduled later this year" << endl;
- intervals = 0;
- primeministernum = 6;
- } else if(opposeats >= govseats+1)
- {
- int tgovseats = 0;
- for(int i=0; i!= oppomembers; i++)
- {
- tgovseats += par_seats_int[omem[i]];
- }
- cout << "The Opposition has secured a majority in parliament" << endl;
- if(par_seats_int[oppositionnum] > tgovseats/2)
- {
- primeministernum = oppositionnum;
- }else
- {
- int wnp =0;
- int wnr = 6;
- for(int i=0; i!= oppomembers; i++)
- {
- //cout << "A" << endl;
- if(par_seats_int[omem[i]] > wnp)
- {
- wnp = par_seats_int[omem[i]];
- wnr = omem[i];
- //cout << "B" << endl;
- }
- }
- primeministernum = wnr;
- }
- //cout << "Finished picking a PM" << endl;
- cout << pcannames[primeministernum] << "(" << par_name[primeministernum] << ") has been appointed Prime Minister" << endl;
- }
- }
- if(oppomembers == 0)
- {
- oppositionnum = 7;
- opposition = "";
- }
- pmname = pcannames[primeministernum];
- if(pcannames[primeministernum] != premprename && junta == false)
- {
- ofstream pmfile;
- pmfile.open("Premieres.txt", fstream::app);
- pmfile << premprename << " (" << prevprem << ") " << premyear << " - " << year << endl;
- pmfile.close();
- premyear = year;
- prevprem =par_name[primeministernum];
- premprename = pcannames[primeministernum];
- }
- if( pcannames[primeministernum] != premprename && junta == true && ot == true)
- {
- ot = false;
- ofstream pmfile;
- pmfile.open("Premieres.txt", fstream::app);
- pmfile << premprename << " (" << par_name[5] << ") " << premyear << " - " << year << endl;
- pmfile.close();
- premyear = year;
- prevprem =par_name[primeministernum];
- premprename = pcannames[primeministernum];
- } else if( pcannames[primeministernum] != premprename && junta == true && ot == false)
- {
- ofstream pmfile;
- pmfile.open("Premieres.txt", fstream::app);
- pmfile << premprename << " (" << prevprem << ") " << premyear << " - " << year << endl;
- pmfile.close();
- premyear = year;
- prevprem =par_name[primeministernum];
- premprename = pcannames[primeministernum];
- }
- if(cannames[primeministernum] == pcannames[primeministernum])
- {
- premprename = cannames[primeministernum];
- } else
- {
- premprename = pcannames[primeministernum];
- }
- }
- void converttoint()
- {
- for(int i=0; i!=5; i++)
- {
- par_percent_int[i] = (int)(par_percent[i]*100);
- par_votes_int[i] = (int)par_votes[i];
- }
- }
- void restart()
- {
- president = par_name[presidentnum];
- primeminister = par_name[primeministernum];
- opposition = par_name[oppositionnum];
- plurality =0;
- pluralvotes =0;
- if(people < 30 && people > 10 && primeministernum != 6)
- {
- intervals -= 3/(people/10);
- } else if(people <=10 && primeministernum != 6)
- {
- intervals += people/10;
- }
- pefav = trending;
- if(fair == true)
- {
- for(int i=0; i!=5; i++)
- {
- popularity[i] = par_percent[i];
- if(popularity[i] < 0.01)
- {
- popularity[i] =0.01;
- }
- }
- }
- /*for(int i=0; i!=5; i++)
- {
- cout << popularity[i];
- }
- string inp;
- cin >> inp;*/
- for(int i=0; i!=5; i++)
- {
- isnew[i] = false;
- if(rand()%100 > par_percent_int[i] && par_seats_int[i] <= seats*0.10 && intervals >1 && i != presidentnum && i!= primeministernum)
- {
- if(i == oppositionnum)
- {
- oppositionnum = 6;
- }
- acronum[i] = rand()%5;
- par_name[i] = allparties[acronum[i]][rand()%9];
- pcro[i] = ideologies[acronum[i]][rand()%4];
- isnew[i] = true;
- prevseats[i] = 0;
- prevpercent[i] = 0;
- canyear[i] = year;
- indivgen(i);
- shiftcomp(i);
- p_auth[i] = (rand()%10) -(5+(abs(acronum[i]-3)*2));
- pflags[i] = (rand()%minumpol)+acronum[i];
- friendly[i] = (rand()%20)-10;
- }
- }
- par_name[presidentnum] = president;
- par_name[primeministernum] = primeminister;
- par_name[oppositionnum] = opposition;
- int mf = rand()%10;
- int polyear = startyear;
- for(int i=0; i!=5; i++)
- {
- prevseats[i] = par_seats_int[i];
- prevpercent[i] = par_percent_int[i];
- }
- for(int i=0; i!=5; i++)
- {
- par_coal[i]=0;
- par_seats[i]=0;
- par_seats_int[i]=0;
- par_votes[i] =10;
- par_votes_int[i] =0;
- par_percent[i] =0;
- par_percent_int[i] =0;
- totalvotes =0;
- pres_votes =0;
- govper=0;
- oppoper =0;
- indeper=0;
- govmembers=0;
- gmem[i] =0;
- govseats =0;
- oppomembers =0;
- omem[i] =0;
- opposeats =0;
- indepmembers =0;
- imem[i] =0;
- indepseats =0;
- av_correspond =0;
- }
- if(primeministernum != 6 && intervals < 1)
- {
- intervals = 1;
- }
- }
- void updates()
- {
- int mf = rand()%10;
- int polyear = startyear;
- if(junta == true && rand()%100 < year - juntayear)
- {
- junta = false;
- }
- if(junta == true)
- {
- people += (year - presyear)/10;
- }
- if(rand()%15 < (year-trendyear))
- {
- trending = rand()%4;
- trendyear = year;
- }
- for(int i=0; i!= intervals; i++)
- {
- updateauth();
- bbcupdate();
- ecupdate();
- mupdate();
- uppop();
- //string upt;
- //cin>> upt;
- }
- for(int i=0; i!=5; i++)
- {
- int s = rand()%75;
- if(fair == true)
- {
- s = rand()%50;
- } else
- {
- s = rand()%80;
- }
- s += year-canyear[i];
- if(s > par_percent_int[i] - (((year-canyear[i])+ friendly[i])- p_auth[i]) && intervals >1 && wassnap == false)
- {
- if(rand()%100 > par_percent_int[i])
- {
- if(i == presidentnum)
- {
- cannames[i] = pname;
- pflags[i] = (rand()%minumpol)+acronum[i];
- pcro[i] = ideologies[acronum[i]][rand()%4];
- shiftcomp(i);
- p_auth[i] = (rand()%10) -(5+(abs(acronum[i]-3)*2));
- friendly[i] = (rand()%20)-10;
- } else
- {
- cannames[i] = pcannames[i];
- pflags[i] = (rand()%minumpol)+acronum[i];
- shiftcomp(i);
- p_auth[i] = (rand()%10) -(5+(abs(acronum[i]-3)*2));
- friendly[i] = (rand()%20)-10;
- pcro[i] = ideologies[acronum[i]][rand()%2];
- }
- } else
- {
- canyear[i] = year;
- indivgen(i);
- pcro[i] = ideologies[acronum[i]][rand()%2];
- pflags[i] = (rand()%minumpol)+acronum[i];
- shiftcomp(i);
- p_auth[i] = (rand()%10) -(5+(abs(acronum[i]-3)*2));
- friendly[i] = (rand()%20)-10;
- popularity[i] -= 10;
- }
- }
- }
- for(int i=0; i!=5; i++)
- {
- int v = rand()%100;
- if(v > par_percent_int[i] - (year-pcanyear[i]))
- {
- pcanyear[i] = year;
- pmindivgen(i);
- }
- }
- if(rand()%50 < year - polyear)
- {
- polyear = year;
- switch(mf)
- {
- case 1:
- pfloat = 0.20;
- case 2:
- pfloat = 0.25;
- case 3:
- pfloat = 0.30;
- case 4:
- pfloat = 0.35;
- case 5:
- pfloat = 0.40;
- case 6:
- pfloat = 0.45;
- case 7:
- pfloat = 0.50;
- case 8:
- pfloat = 0.55;
- case 9:
- pfloat = 0.60;
- case 10:
- pfloat = 0.65;
- default:
- break;
- }
- }
- /*if(primeministernum == presidentnum)
- {
- if(rand()%100 < par_percent_int[primeministernum]*0.75 && intervals >1)
- {
- cannames[presidentnum] = pcannames[primeministernum];
- }
- }*/
- domode();
- if(wassnap == true)
- {
- wassnap = false;
- }
- fpol = rand()%13;
- }
- void calcdif()
- {
- /*int difference = ((year - startyear)/10) +2;
- seats = rand()%difference;
- regions += rand()%difference;
- float tdif = (float)totalvotes, ttot = (float) prevtot;
- if(totalvotes > prevtot)
- {
- tdif = (tdif-ttot) /totalvotes;
- } else
- {
- tdif = (ttot-tdif) /prevtot;
- }
- seats += regions*2;
- seats += round(seats*tdif);
- if(seats <=3)
- {
- seats =3;
- }*/
- regions += rand()%5;
- float difference = (float)(population - prevpop)/population;
- float cnge = (float) ((rand()%10)-5)/100;
- difference += cnge;
- seats = regions;
- seats += seats*difference;
- if(seats <regions)
- {
- seats = regions;
- }
- }
- void dispall()
- {
- int lowerhouse =0;
- for(int i=0; i!=5; i++)
- {
- lowerhouse += lhgains[i];
- }
- int upperhouse = 0;
- for(int i=0; i!=5; i++)
- {
- upperhouse += par_seats_int[i] - lhgains[i];
- }
- for(int i =0; i!=5; i++)
- {
- cout << "======================================" << endl;
- if(cannames[i] == pcannames[i])
- {
- cout << cannames[i] << " - " << par_name[i] << " (" << pcro[i] << ")\n" << par_votes_int[i] << " (" << par_percent_int[i] << "% | ";
- } else
- {
- cout << cannames[i] << " / " << pcannames[i] << " - " << par_name[i] << " (" << pcro[i] << ")\n" << par_votes_int[i] << " (" << par_percent_int[i] << "% | ";
- }
- if(isnew[i] != true)
- {
- if(par_percent_int[i] >= prevpercent[i])
- {
- cout << "+" << par_percent_int[i] - prevpercent[i] << "%)" << endl;
- }else
- {
- cout << par_percent_int[i] - prevpercent[i] << "%)" << endl;
- }
- } else
- {
- if(par_percent_int[i] >= prevpercent[i])
- {
- cout << "+" << par_percent_int[i] - prevpercent[i] << "%) - NEW" << endl;
- }else
- {
- cout << par_percent_int[i] - prevpercent[i] << "%) - NEW" << endl;
- }
- }
- for(int b=0; b< par_percent_int[i]; b++)
- {
- cout << "|";
- }
- cout << "\nTotal Seats Won: " << par_seats_int[i] << " (US: " << par_seats_int[i] - lhgains[i] << " | LS: " << lhgains[i] << " | ";
- if(isnew[i] != true)
- {
- if(par_seats_int[i] >= prevseats[i])
- {
- cout << "+" << par_seats_int[i] - prevseats[i] << ")" << endl;
- }else
- {
- cout << par_seats_int[i] - prevseats[i] << ")" << endl;
- }
- } else
- {
- if(par_seats_int[i] >= prevseats[i])
- {
- cout << "+" << par_seats_int[i] - prevseats[i] << ") - NEW" << endl;
- }else
- {
- cout << par_seats_int[i] - prevseats[i] << ") - NEW" << endl;
- }
- }
- cout << "FLAGSHIP POLICY: " << flags[pflags[i]] << endl;
- }
- }
- void checkmajors()
- {
- for(int i=0; i!=5; i++)
- {
- ismajor[i] = false;
- }
- for(int i=0; i!=5; i++)
- {
- if(par_percent_int[i] >= 10)
- {
- ismajor[i] = true;
- }
- }
- }
- int main()
- {
- srand(time(NULL));
- //cngen();
- population += rand()%population;
- shiffty = (rand()%3)*5;
- trending = rand()%5;
- fpol = rand()%13;
- for(int i=0; i!=5; i++)
- {
- acronum[i] = rand()%5;
- par_name[i] = allparties[acronum[i]][rand()%9];
- pcro[i] = ideologies[acronum[i]][rand()%4];
- isnew[i] = true;
- prevseats[i] = 0;
- prevpercent[i] = 0;
- canyear[i] = year;
- indivgen(i);
- pmindivgen(i);
- shiftcomp(i);
- p_auth[i] = (rand()%10) -(5+(abs(acronum[i]-3)*2));
- pflags[i] = (rand()%minumpol)+acronum[i];
- friendly[i] = (rand()%20)-10;
- }
- policy = ((rand()%13) *5)+35;
- pfloat = (float) policy/100;
- ofstream presfile;
- presfile.open("Presidents.txt");
- presfile << "FILE SCCUESSFULLY CREATED" << endl;
- presfile.close();
- ofstream pmfile;
- pmfile.open("Premieres.txt");
- pmfile << "FILE SCCUESSFULLY CREATED" << endl;
- pmfile.close();
- ofstream erecord;
- erecord.open("Elections.txt");
- erecord << "FILE SCCUESSFULLY CREATED" << endl;
- erecord.close();
- trending = rand()%5;
- game:
- system("CLS");
- cout << "Votes are being counted..." << endl;
- upturnout();
- calcto();
- int pvb[5];
- //cout << votingpops << endl;
- //string asl;
- //cin >> asl;
- float cdt = turnout*100;
- int rct = (int) cdt;
- int i= votingpops;
- while(i > votingpops*0.01)
- {
- count_total();
- for(int b=0; b!=5; b++)
- {
- av_correspond =b;
- pvb[b] = par_votes[b];
- float mik = (float) 0.01+ (popularity[av_correspond]/100);
- //cout << mik << endl;
- //cin>> userinput;
- par_votes[b] += add_votes(i*mik);
- int slr = par_votes[b] - pvb[b];
- i-= slr;
- }
- count_total();
- //i -= totalvotes- prvtot;
- //string inp;
- //cin >> inp;
- vcalc();
- converttoint();
- system("CLS");
- /*cout << "Total Votes: " << totalvotes << endl;
- cout << "voters remaining: " << i << endl;
- cout << "turnout: " << turnout << endl;*/
- if(snap == false)
- {
- if(midterm == true)
- {
- cout << year << " Parliamentary Elections Opinion Polls:" << endl;
- } else
- {
- cout << year << " General Elections Opinion Polls:" << endl;
- }
- } else
- {
- cout << year << " Snap Elections Opinion Polls:" << endl;
- }
- cout << "President: " << pname << "("<< president << ")" << endl;
- cout << "Prime Minister: " << pmname << "("<< primeminister << ")" << endl;
- cout << "Opposition: " << pcannames[oppositionnum] << "("<< opposition << ")" << endl;
- cout << endl;
- /*int lowerhouse = round(seats * pfloat);
- int upperhouse = round(seats - lowerhouse);
- cout << "Seats Last Election: " << seats << endl;
- cout << "-Upper House: " << upperhouse << endl;
- cout << "-Lower House: " << lowerhouse << endl;*/
- for(int i =0; i!=5; i++)
- {
- cout << "======================================" << endl;
- if(cannames[i] == pcannames[i])
- {
- cout << cannames[i] << " - " << par_name[i] << " (" << pcro[i] << ")\n" << par_votes_int[i] << " (" << par_percent_int[i] << "%)" << endl;
- }else
- {
- cout << cannames[i] << " / " << pcannames[i] << " - " << par_name[i] << " (" << pcro[i]<< ")\n" << par_votes_int[i] << " (" << par_percent_int[i] << "%)" << endl;
- }
- for(int b=0; b< par_percent_int[i]; b++)
- {
- cout << "|";
- }
- cout << endl;
- cout << "FLAGSHIP POLICY: " << flags[pflags[i]] << endl;
- }
- //std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- system("CLS");
- prevtot = totalvotes;
- count_total();
- vcalc();
- converttoint();
- calcdif();
- countplural();
- cutoff();
- if(fair == true)
- {
- /*if(mode == 0)
- {
- sainteleague();
- } else if(mode == 1)
- {
- dsdhondt();
- }*/
- dsdhondt();
- }else
- {
- discont();
- }
- seatcalc();
- checkmajors();
- if(snap == false)
- {
- if(midterm == true)
- {
- cout << year << " Parliamentary Elections" << endl;
- } else
- {
- cout << year << " General Elections" << endl;
- }
- } else
- {
- cout << year << " Snap Elections" << endl;
- }
- calsplu();
- if(midterm == false || snap == true)
- {
- prescalc();
- //cout << "elected Pres" << endl;
- } else if(midterm == true || snap == true)
- {
- gmem[0] = presidentnum;
- govseats += par_seats_int[presidentnum];
- govper += par_percent_int[presidentnum];
- govmembers++;
- //cout << "Appointed Gov" << endl;
- }
- countplural();
- //cout << "counted plurality" << endl;
- oppoprimaries();
- coalitionform();
- //cout << "formed coalitions" << endl;
- pmcalc();
- //cout << "Appointed PM" << endl;
- cout << endl;
- int lowerhouse =0;
- for(int i=0; i!=5; i++)
- {
- lowerhouse += lhgains[i];
- }
- int upperhouse = 0;
- for(int i=0; i!=5; i++)
- {
- upperhouse += par_seats_int[i] - lhgains[i];
- }
- /*cout << "Calculated House" << endl;
- system("CLS");
- if(midterm == true)
- {
- cout << year << " Parliamentary Elections" << endl;
- } else
- {
- cout << year << " General Elections" << endl;
- }*/
- cout << "President: " << pname << "("<< par_name[presidentnum] << ")" << endl;
- cout << "Prime Minister: " << pmname << "("<< par_name[primeministernum] << ")" << endl;
- cout << "Opposition: " << pcannames[oppositionnum] << "("<< par_name[oppositionnum] << ")" << endl;
- cout << "\nFlagship Policy: " << flags[pflags[presidentnum]];
- if(primeministernum != presidentnum && flags[pflags[primeministernum]] != flags[pflags[presidentnum]] && primeministernum != 6)
- {
- cout << " And " << flags[pflags[primeministernum]];
- }
- cout << endl;
- cout << "\nTotal Seats: " << upperhouse + lowerhouse;
- cout << " (Upper Seats: " << upperhouse;
- cout << " | Lower Seats: " << lowerhouse << ")" <<endl;
- float gfloat = govseats;
- float ofloat = opposeats;
- float ifloat = indepseats;
- seats = upperhouse + lowerhouse;
- cout << "Composition:" << endl;
- if(govseats >0)
- {
- if(indepseats >0)
- {
- cout << "Government: " << govseats << " Seats (" << round((gfloat/seats)*100) << "% | "<< round((gfloat/(seats-indepseats))*100) << "%)"<< endl;
- }else
- {
- cout << "Government: " << govseats << " Seats (" << round((gfloat/seats)*100) << "%)" << endl;
- }
- cout << "Members: ";
- for(int i=0; i!=govmembers; i++)
- {
- cout << par_name[gmem[i]];
- if(i != govmembers-1)
- {
- cout << ", ";
- }
- }
- }
- if(opposeats > 0)
- {
- if(indepseats >0)
- {
- cout << "\n=====\nOpposition: " << opposeats << " Seats (" << round((ofloat/seats)*100) << "% | "<< round((ofloat/(seats-indepseats))*100) << "%)"<< endl;
- }else
- {
- cout << "\n=====\nOpposition: " << opposeats << " Seats (" << round((ofloat/seats)*100) << "%)" << endl;
- }
- for(int i=0; i!=oppomembers; i++)
- {
- cout << par_name[omem[i]];
- if(i != oppomembers-1)
- {
- cout << ", ";
- }
- }
- }
- if(indepseats > 0)
- {
- cout << "\n=====\nBoycotting: " << indepseats<< " Seats (" << round((ifloat/seats)*100) << "%)" << endl;
- for(int i=0; i!=indepmembers; i++)
- {
- cout << par_name[imem[i]];
- if(i != indepmembers-1)
- {
- cout << ", ";
- }
- }
- }
- cout << endl;
- pecheck();
- covalues();
- mchange();
- pshift();
- cout << "\nMilitary Status: ";
- //cout << military << endl;
- switch(military/10)
- {
- case 1:
- cout << "General Dissatisfaction" << endl;
- break;
- case 2:
- cout << "Discontent Among Lower Ranks" << endl;
- break;
- case 3:
- cout << "Divided" << endl;
- break;
- case 4:
- cout << "Slight Disagreements" << endl;
- break;
- case 5:
- cout << "Low Support for Government" << endl;
- break;
- case 6:
- cout << "Apolitical Military" << endl;
- break;
- case 7:
- cout << "Generally Supportive" << endl;
- break;
- case 8:
- cout << "Secretly Endorses the Government" << endl;
- break;
- case 9:
- cout << "Open Military Endorsement" << endl;
- break;
- case 10:
- cout << "Fanatically Loyal" << endl;
- break;
- case 0:
- cout << "Strained Relations with the Government" << endl;
- break;
- case -1:
- cout << "Officers Openly Denouncing Government" << endl;
- break;
- case -2:
- cout << "Generally Disloyal Army" << endl;
- break;
- case -3:
- cout << "Small Outbreaks of Mutinies" << endl;
- break;
- case -4:
- cout << "Officers Leading Mutinies" << endl;
- break;
- case -5:
- cout << "Widespread Military Defections" << endl;
- break;
- default:
- if(military < 0)
- {
- cout << "Military Coup Imminent" << endl;
- } else
- {
- cout << "Fanatically Loyal" << endl;
- }
- break;
- }
- //cout << "Military-backed Party: " << par_name[milfav] << endl;
- //cout << "Military-opposed Party: " << par_name[milenem] << endl;
- cout << "National Status: ";
- //cout << people << endl;
- switch(people/10)
- {
- case 10:
- case 9:
- cout << "Nationwide Support" << endl;
- break;
- case 8:
- case 7:
- case 6:
- case 5:
- cout << "Supportive Populace" << endl;
- break;
- case 4:
- case 3:
- case 2:
- case 1:
- cout << "Indifferent People" << endl;
- break;
- case 0:
- case -1:
- cout << "Divided" << endl;
- break;
- case -2:
- case -3:
- cout << "General Discontent" << endl;
- break;
- case -4:
- case -5:
- case -6:
- case -7:
- cout << "Widespread Protests" << endl;
- break;
- case -8:
- case -9:
- default:
- if(people < 0)
- {
- cout << "Nationwide Riots" << endl;
- } else
- {
- cout << "Nationwide Support" << endl;
- }
- break;
- }
- cout << "Economic Status: ";
- //cout << economy << endl;
- switch(economy/10)
- {
- case 10:
- case 9:
- case 8:
- case 7:
- cout << "Booming" << endl;
- break;
- case 6:
- case 5:
- case 4:
- case 3:
- cout << "Expanding" << endl;
- break;
- case 2:
- case 1:
- case 0:
- case -1:
- cout << "Contracting" << endl;
- break;
- case -2:
- case -3:
- case -4:
- case -5:
- cout << "Recession" << endl;
- break;
- case -6:
- case -7:
- case -8:
- case -9:
- cout << "Depression" << endl;
- break;
- default:
- if(economy > 0)
- {
- cout << "Booming" << endl;
- }else
- {
- cout << "Depression" << endl;
- }
- break;
- }
- cout << "Freedom Level: ";
- //cout << totauth << endl;
- switch(totauth/10)
- {
- case 10:
- case 9:
- cout << "High" << endl;
- break;
- case 8:
- case 7:
- case 6:
- case 5:
- cout << "Above Average" << endl;
- break;
- case 4:
- case 3:
- case 2:
- case 1:
- case 0:
- case -1:
- cout << "Average" << endl;
- break;
- case -2:
- case -3:
- case -4:
- case -5:
- cout << "Below Average" << endl;
- break;
- case -6:
- case -7:
- case -8:
- case -9:
- cout << "Low" << endl;
- break;
- default:
- if(totauth < 0)
- {
- cout << "Low" << endl;
- } else
- {
- cout << "High" << endl;
- }
- break;
- }
- cout << "Militancy Level: ";
- //cout << militancy << endl;
- switch(militancy/10)
- {
- case 10:
- case 9:
- cout << "None" << endl;
- break;
- case 8:
- case 7:
- case 6:
- case 5:
- cout << "Nothing Significant" << endl;
- break;
- case 4:
- case 3:
- case 2:
- case 1:
- case 0:
- case -1:
- cout << "Low Militancy" << endl;
- break;
- case -2:
- case -3:
- case -4:
- case -5:
- cout << "Some Militancy" << endl;
- break;
- case -6:
- case -7:
- case -8:
- case -9:
- cout << "Abundant Militancy" << endl;
- break;
- default:
- if(militancy < 0)
- {
- cout << "Abundant Militancy" << endl;
- } else
- {
- cout << "None" << endl;
- }
- break;
- }
- //cout << "People-backed Party: " << par_name[pefav] << endl;
- //cout << "People-opposed Party: " << par_name[penem] << endl;
- //cout << tseats << endl;
- //cout << remaining << endl;
- // cout << "DEBUG: " << totalvotes << endl;
- //cout << presidentnum << endl;
- //cout << oppositionnum << endl;
- erecord.open("Elections.txt", fstream::app);
- if(midterm == false)
- {
- erecord << year << " GENERAL ELECTIONS" << endl;
- erecord << "WINNERS:" << endl;
- if(presidentnum == primeministernum)
- {
- erecord << "President & Prime Minister: " << cannames[presidentnum] << " (" << par_name[presidentnum] << ") - " << par_percent_int[presidentnum] << "%" << endl;
- } else
- {
- erecord << "President: " << cannames[presidentnum] << " (" << par_name[presidentnum] << ") - " << par_percent_int[presidentnum] << "%" << endl;
- erecord << "Prime Minister: " << cannames[primeministernum] << " (" << par_name[primeministernum] << ") - " << par_percent_int[primeministernum] << "%" << endl;
- }
- erecord << "\n==========" << endl;
- } else
- {
- erecord << year << " MIDTERM ELECTIONS" << endl;
- erecord << "WINNER:" << endl;
- erecord << "Prime Minister: " << cannames[primeministernum] << " (" << par_name[primeministernum] << ") - " << par_percent_int[primeministernum] << "%" << endl;
- erecord << "\n==========" << endl;
- }
- erecord.close();
- if(snap == true)
- {
- snap =false;
- wassnap = true;
- }
- //cout << "A" << endl;
- if(fair == false)
- {
- intervals = par_percent_int[presidentnum] /10;
- intervals = (rand()%intervals)+1;
- intervals = intervals *1.5;
- }
- //cout << "M" << endl;
- intervals -= totauth/50;
- if(fair == true)
- {
- intervals = 2;
- }
- if(fair == false)
- {
- intervals = 5;
- }
- //cout << "O" << endl;
- if(govseats + opposeats < indepseats )
- {
- if(midterm == true)
- {
- prevmid = true;
- } else
- {
- prevmid = false;
- }
- snap = true;
- intervals = 0;
- //midterm = false;
- if(presidentnum == milfav)
- {
- military -= 20;
- } else if(presidentnum == milenem)
- {
- military += 10;
- } else
- {
- military -=10;
- }
- if(presidentnum == pefav)
- {
- people -= 20;
- } else if(presidentnum == penem)
- {
- people += 10;
- } else
- {
- people -=10;
- }
- }
- if(snap == false)
- {
- if(midterm == true)
- {
- midterm = false;
- } else if(midterm == false)
- {
- midterm = true;
- }
- }
- //cout << "G" << endl;
- /*cout << "ECONOMY: " << economy << endl;
- if(boom)
- {
- cout << "BOOM ENDS IN " << year + shiffty << endl;
- }*/
- tvts = 0;
- for(int i=0; i!=5; i++)
- {
- tvts+= par_votes_int[i];
- }
- float tnot = (float) tvts / population;
- //cout << "U" << endl;
- cout << "\nVoter Turnout This Election: " << tvts << " (" << round(tnot*100) << "%)" << endl;
- //cout << "Person Represented Per Seat: " << tvts/seats << endl;
- cout << "Voter-to-Seat Ratio: " << population/seats+1 << " : 1" << endl;
- if(primeministernum != 6 && intervals < 1)
- {
- intervals =1;
- }
- if(primeministernum == 6)
- {
- intervals =0;
- }
- cout << "\nNext Election: " << year + intervals << endl;
- if(year >= 2023)
- {
- ofstream presfile;
- presfile.open("Presidents.txt", fstream::app);
- presfile << presprename << " (" << prevpres << ") " << presyear << " - CURRENT" << endl;
- presfile.close();
- presyear = year;
- prevpres = par_name[presidentnum];
- presprename = cannames[presidentnum];
- ofstream pmfile;
- pmfile.open("Premieres.txt", fstream::app);
- pmfile << premprename << " (" << prevprem << ") " << premyear << " - CURRENT" << endl;
- pmfile.close();
- premyear = year;
- prevprem = par_name[primeministernum];
- premprename = cannames[primeministernum];
- }
- if(fair ==false)
- {
- midterm = false;
- }
- cout << "\nInput 1 to show full election results" << endl;
- cin >> userinput;
- if(userinput == "1")
- {
- dispall();
- cin >> userinput;
- }
- updates();
- coupcheck();
- if(ot == false)
- {
- revcheck();
- }
- year += intervals;
- restart();
- if(fair == false && rand()%(year - startyear) < (year - presyear) && totauth > -10 && p_auth[presidentnum] >=1)
- {
- fair = true;
- }
- /*if(presidentnum == primeministernum && govmembers == 4 && par_seats[presidentnum] > seats * 0.75 && fair == true && rand()%100 < popularity[presidentnum] *100)
- {
- fair = false;
- }*/
- if(fair == true && presidentnum == primeministernum && govseats > opposeats *2 && rand()%seats < par_seats_int[presidentnum] && totauth < -10 && p_auth[presidentnum]<=0)
- {
- fair = false;
- }
- goto game;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement