Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //From "The Turning Points of History", Pyramid 3/41
- //HOW TO USE:
- //1. Download and install Processing (Baby's First Java) from https://processing.org/download
- //2. Save this file as blah.pde
- //3. Open this file in Processing and click the "Run" button at the upper-left corner of the window
- //4. Follow the instructions given at the bottom of the window
- int count=1;
- String[] results;
- void setup(){
- noLoop();
- results=new String[0];
- }
- void draw(){
- println("Left-click in the little gray window that just appeared to generate a hundred historical events.");
- println("Right-click for a THOUSAND events!");
- println("Middle-click to export everything generated so far as a .txt file.");
- println("");
- }
- int roll(){
- return int(random(1,7));
- }
- void mouseClicked(){
- if(mouseButton==LEFT){
- for(int a=0;a<100;a++){
- event(count);
- count++;
- }
- }else if(mouseButton==RIGHT){
- for(int a=0;a<1000;a++){
- event(count);
- count++;
- }
- }else if(mouseButton==CENTER){
- saveStrings(nf(year(),4)+nf(month(),2)+nf(day(),2)+nf(hour(),2)+nf(minute(),2)+nf(second(),2)+".txt",results);
- }
- }
- void event(int count){
- int roll=int(random(0,72));
- int secondary;
- String result="";
- String string1="",string2="";
- if(roll<2){result="Alliance/peace treaty with "+external();
- }else if(roll<4){
- do{
- string1=internal();
- string2=internal();
- }while(string1.equals(string2));
- result="Assimilation of "+string1+" by "+string2;
- }else if(roll<5){result="Conquest of "+external();
- }else if(roll<6){result="Conquest by "+external();
- }else if(roll<7){result="Major democratization in favor of "+internal();
- }else if(roll<9){result="Minor democratization in favor of "+internal();
- }else if(roll<11){result="Fragmentation of "+internal();
- }else if(roll<12){result="Significant legislation";
- }else if(roll<14){result="Migration of "+external()+" into the area";
- }else if(roll<16){result="Centralization";
- }else if(roll<17){result="Prosperity";
- }else if(roll<18){result="Raids by "+external();
- }else if(roll<20){result="Revolt of "+internal();
- }else if(roll<22){
- if(random(1)<0.5){result="Rise of "+internal()+" to importance";
- }else{result="Rise of member of "+internal()+" to importance";
- }
- }else if(roll<24){result="Suppression of "+internal();
- }else if(roll<25){result="Successful war with "+external();
- }else if(roll<26){result="Unsuccessful war with "+external();
- }else if(roll<27){result="Bad omens";
- }else if(roll<28){result="Blizzards";
- }else if(roll<30){
- secondary=int(random(4));
- if(secondary==0){result="Climate becomes hotter";
- }else if(secondary==1){result="Climate becomes colder";
- }else if(secondary==2){result="Climate becomes wetter";
- }else{result="Climate becomes drier";
- }
- }else if(roll<31){result="Diabolic influence";
- }else if(roll<32){result="Dragons";
- }else if(roll<34){result="Drought";
- }else if(roll<36){result="Earthquake";
- }else if(roll<38){result="Famine";
- }else if(roll<39){result="Fire";
- }else if(roll<41){result="Flood";
- }else if(roll<42){result="Hauntings";
- }else if(roll<43){result="Heavy weather";
- }else if(roll<44){result="Massacre";
- }else if(roll<45){
- secondary=int(random(2));
- if(secondary==0){result="Malignant otherworldly breakthrough";
- }else{result="Benign otherworldly breakthrough";
- }
- }else if(roll<47){result="Plague";
- }else if(roll<48){result="Crime/atrocity";
- }else if(roll<49){result="Death of prominent person";
- }else if(roll<51){result="Decadence";
- }else if(roll<52){result="Divine contact";
- }else if(roll<53){result="Domestic changes";
- }else if(roll<54){
- secondary=int(random(2));
- if(secondary==0){result="Demise of prominent dynasty";
- }else{result="Rise of prominent dynasty";
- }
- }else if(roll<56){result="Invention/development in art";
- }else if(roll<57){result="Invention/development in magic";
- }else if(roll<59){result="Invention/development in materials";
- }else if(roll<60){result="Invention/development in mechanics";
- }else if(roll<62){result="Invention/development in the military";
- }else if(roll<63){result="Invention/development in science";
- }else if(roll<65){result="Invention/development in subsistence";
- }else if(roll<66){result="Invention/development in transportation";
- }else if(roll<67){result="Heroism";
- }else if(roll<68){result="New fashion";
- }else if(roll<70){result="New religion";
- }else{result="Religious revival";
- }
- results=append(results,result);
- println(count+". "+result);
- }
- String internal(){
- int roll1=roll();
- int roll2=roll();
- String result;
- if(roll1<=2){
- if(roll2<=1){result="fringe clergy";
- }else if(roll2<=2){result="mainstream clergy";
- }else if(roll2<=3){result="craftsmen";
- }else if(roll2<=5){result="ethnic minority";
- }else{result="rural gentry";
- }
- }else if(roll1<=4){
- if(roll2<=1){result="urban gentry";
- }else if(roll2<=2){result="magicians";
- }else if(roll2<=3){result="merchants";
- }else if(roll2<=5){result="peasants";
- }else{result="religious minority";
- }
- }else{
- if(roll2<=1){result="ruling class";
- }else if(roll2<=2){result="slaves";
- }else if(roll2<=3){result="urban poor";
- }else if(roll2<=4){result="soldiers";
- }else if(roll2<=5){result="officers";
- }else{result="intellectuals";
- }
- }
- return result;
- }
- String external(){
- int roll1=roll()+roll();
- String result;
- if(roll1<=6){result="neighboring state";
- }else if(roll1<=7){result="neighboring tribe";
- }else if(roll1<=8){result="migrating tribe";
- }else if(roll1<=9){result="pirates/raiders";
- }else if(roll1<=10){result="refugees";
- }else{result="semi-autonomous "+internal();
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement