MasterSparky

Pledge/One Mind simulation

Feb 15th, 2016
2,004
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.46 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.ArrayList;
  3.  
  4. public class PledgeSimulation
  5. {
  6.     private double cookiesGained;
  7.     private int clicksPerSecond;
  8.     private int time;
  9.     private int frenzyMult;
  10.     private int frenzyTime;
  11.     private String effect;
  12.     private String lastEffect;
  13.     private Random RNGesus;
  14.  
  15.     public PledgeSimulation(int clicksPerSecond)
  16.     {
  17.         this.clicksPerSecond = clicksPerSecond;
  18.         this.lastEffect = null;
  19.         this.frenzyMult = 1;
  20.         RNGesus = new Random();
  21.     }
  22.  
  23.     public String getEffect(String previousEffect)
  24.     {
  25.         ArrayList<String> possibleEffects = new ArrayList<String>();
  26.         possibleEffects.add("lucky");
  27.         possibleEffects.add("frenzy");
  28.         if(Math.random()<0.15) possibleEffects.add("dragonflight");
  29.         if(Math.random()<0.1) possibleEffects.add("click frenzy");
  30.         if(Math.random()<0.03) possibleEffects.add("cookie chain");
  31.  
  32.         for(int i=0; i<possibleEffects.size(); i++)
  33.         {
  34.             if(possibleEffects.get(i).equals(previousEffect) && Math.random()<0.8) possibleEffects.remove(i);
  35.         }
  36.         String nextEffect = possibleEffects.get(RNGesus.nextInt(possibleEffects.size()));
  37.         effect = nextEffect;
  38.         return effect;
  39.     }
  40.  
  41.     public String getLastEffect()
  42.     {
  43.         return lastEffect;
  44.     }
  45.  
  46.     public double getCookiesGained()
  47.     {
  48.         return cookiesGained;
  49.     }
  50.  
  51.     public void idle()
  52.     {
  53.         cookiesGained += frenzyMult;
  54.         if(frenzyTime>0) frenzyTime--;
  55.         if(frenzyTime==0) frenzyMult = 1;
  56.     }
  57.  
  58.     public void simulate(String gcEffect)
  59.     {
  60.         if(gcEffect.equals("lucky")) cookiesGained += 900*frenzyMult;
  61.         if(gcEffect.equals("frenzy"))
  62.         {
  63.             frenzyMult = 7;
  64.             frenzyTime = 170;
  65.         }
  66.         if(gcEffect.equals("dragonflight")) cookiesGained += 1111*frenzyMult*0.09*1.1*1.1*1.1*22*clicksPerSecond;
  67.         if(gcEffect.equals("click frenzy")) cookiesGained += 777*frenzyMult*0.09*1.1*1.1*1.1*28.6*clicksPerSecond;
  68.         if(gcEffect.equals("cookie chain"))
  69.         {
  70.             if(frenzyMult==7) cookiesGained += 3600*42;
  71.             else cookiesGained += 3600*4.2;
  72.         }
  73.  
  74.         lastEffect = gcEffect;
  75.     }
  76.  
  77.     public static void main(String[] args)
  78.     {
  79.         PledgeSimulation simulation = new PledgeSimulation(10);
  80.         for(int i=0; i<365*86400; i++)
  81.         {
  82.             simulation.idle();
  83.             if(i%95==0) simulation.simulate(simulation.getEffect(simulation.getLastEffect()));
  84.         }
  85.         System.out.print("Earned "+simulation.getCookiesGained()*1.05+" times base CPS.");
  86.     }
  87. }
  88.  
  89. -----------------------------------------------------------------------------------------------------------
  90.  
  91. import java.util.Random;
  92. import java.util.ArrayList;
  93.  
  94. public class OneMindSimulation
  95. {
  96.     private double cookiesGained;
  97.     private int clicksPerSecond;
  98.     private int time;
  99.     private double frenzyMult;
  100.     private int frenzyTime;
  101.     private String effect;
  102.     private String lastEffect;
  103.     private Random RNGesus;
  104.  
  105.     public OneMindSimulation(int clicksPerSecond)
  106.     {
  107.         this.clicksPerSecond = clicksPerSecond;
  108.         this.lastEffect = null;
  109.         this.frenzyMult = 1;
  110.         RNGesus = new Random();
  111.     }
  112.  
  113.     public String getEffect(String previousEffect)
  114.     {
  115.         ArrayList<String> possibleEffects = new ArrayList<String>();
  116.         if(Math.random()<0.66)
  117.         {
  118.             possibleEffects.add("lucky");
  119.             possibleEffects.add("frenzy");
  120.             if(Math.random()<0.15) possibleEffects.add("dragonflight");
  121.             if(Math.random()<0.1) possibleEffects.add("click frenzy");
  122.             if(Math.random()<0.03) possibleEffects.add("cookie chain");
  123.         }
  124.         else
  125.         {
  126.             possibleEffects.add("clot");
  127.             possibleEffects.add("ruin");
  128.             possibleEffects.add("lucky");
  129.             if(Math.random()<0.05) possibleEffects.add("dragonflight");
  130.             if(Math.random()<0.1) possibleEffects.add("click frenzy");
  131.             if(Math.random()<0.3)
  132.             {
  133.                 possibleEffects.add("elder frenzy");
  134.                 possibleEffects.add("cookie chain");
  135.             }
  136.         }
  137.         for(int i=0; i<possibleEffects.size(); i++)
  138.         {
  139.             if(possibleEffects.get(i).equals(previousEffect) && Math.random()<0.8) possibleEffects.remove(i);
  140.         }
  141.         String nextEffect = possibleEffects.get(RNGesus.nextInt(possibleEffects.size()));
  142.         effect = nextEffect;
  143.         return effect;
  144.     }
  145.  
  146.     public String getLastEffect()
  147.     {
  148.         return lastEffect;
  149.     }
  150.  
  151.     public double getCookiesGained()
  152.     {
  153.         return cookiesGained;
  154.     }
  155.  
  156.     public void idle()
  157.     {
  158.         cookiesGained += frenzyMult*9.1318;
  159.         if(frenzyTime>0) frenzyTime--;
  160.         if(frenzyTime==0) frenzyMult = 1;
  161.     }
  162.  
  163.     public void reindeer()
  164.     {
  165.         cookiesGained += 120*frenzyMult;
  166.     }
  167.  
  168.     public void simulate(String gcEffect)
  169.     {
  170.         if(gcEffect.equals("lucky")) cookiesGained += 900*frenzyMult;
  171.         if(gcEffect.equals("frenzy"))
  172.         {
  173.             frenzyMult = 7;
  174.             frenzyTime = 170;
  175.         }
  176.         if(gcEffect.equals("clot"))
  177.         {
  178.             frenzyMult = 0.5;
  179.             frenzyTime = 145;
  180.         }
  181.         if(gcEffect.equals("elder frenzy"))
  182.         {
  183.             frenzyMult = 666;
  184.             frenzyTime = 13;
  185.             cookiesGained += 666*0.09*1.1*1.1*1.1*13*clicksPerSecond;
  186.         }
  187.         if(gcEffect.equals("dragonflight")) cookiesGained += 1111*frenzyMult*0.09*1.1*1.1*1.1*22*clicksPerSecond;
  188.         if(gcEffect.equals("click frenzy")) cookiesGained += 777*frenzyMult*0.09*1.1*1.1*1.1*28.6*clicksPerSecond;
  189.         if(gcEffect.equals("cookie chain"))
  190.         {
  191.             if(frenzyMult==7) cookiesGained += 3600*42;
  192.             else cookiesGained += 3600*4.2;
  193.         }
  194.  
  195.         lastEffect = gcEffect;
  196.     }
  197.  
  198.     public static void main(String[] args)
  199.     {
  200.         OneMindSimulation simulation = new OneMindSimulation(250);
  201.         for(int i=0; i<365*86400; i++)
  202.         {
  203.             simulation.idle();
  204.             if(i%100==0) simulation.simulate(simulation.getEffect(simulation.getLastEffect()));
  205.             if(i%100==1) simulation.reindeer();
  206.         }
  207.         System.out.print("Earned "+simulation.getCookiesGained()+" times base CPS.");
  208.     }
  209. }
Advertisement
Add Comment
Please, Sign In to add comment