Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tangedyn.manglesim;
- import ec.util.MersenneTwisterFast;
- public class MangleSim {
- private static int MAXTIME = 1000 * 24 * 60 * 60 * 10;
- private static int REACTION = 5;
- private MersenneTwisterFast mRandom = new MersenneTwisterFast(System.nanoTime());
- private int nextGCD = -1;
- private int mangleReady = -1;
- private int nextLacerateTick = -1;
- private int nextThrashTick = -1;
- private int lacerateTicksRemaining = 0;
- private int thrashTicksRemaining = 0;
- private int lacerateReady = -1;
- private int time = 0;
- private int mangles = 0;
- private int swipes = 0;
- private int thrashes = 0;
- private int lacerates = 0;
- public void run() {
- for (time = 0; time < MAXTIME; time += 5) {
- // Check Lacerate Tick
- if (time == nextLacerateTick) {
- if (mRandom.nextBoolean(.12)) mangleReady = Math.min(time + REACTION, mangleReady);
- if (--lacerateTicksRemaining > 0) nextLacerateTick += 30;
- }
- // Check Thrash Tick
- if (time == nextThrashTick) {
- if (mRandom.nextBoolean(.12)) mangleReady = Math.min(time + REACTION, mangleReady);
- if (--thrashTicksRemaining > 0) nextThrashTick += 20;
- }
- // Check if GCD is ready
- if (time < nextGCD) continue;
- // Check for Mangle
- if (time >= mangleReady) {
- mangles++;
- mangleReady = time + 60;
- nextGCD = time + 15;
- continue;
- }
- // Check for Thrash
- if (thrashTicksRemaining <= 1) {
- thrashes++;
- if (nextThrashTick <= time) nextThrashTick = time + 20;
- thrashTicksRemaining += 8;
- nextGCD = time + 15;
- continue; }
- // Check for Lacerate
- if (time >= lacerateReady) {
- lacerates++;
- lacerateReady = time + 30;
- nextGCD = time + 15;
- lacerateTicksRemaining = 5;
- if (nextLacerateTick <= time) nextLacerateTick = time + 30;
- continue;
- }
- // Swipe
- swipes++;
- nextGCD = time + 15;
- }
- double hertz = 10.0 / time;
- System.out.println("Mangles per second: " + (mangles * hertz));
- System.out.println("Thrashes per second: " + (thrashes * hertz));
- System.out.println("Lacerates per second: " + (lacerates * hertz));
- System.out.println("Swipes per second: " + (swipes * hertz));
- System.out.println("Actions per second: " + ((swipes + thrashes + lacerates + mangles) * hertz));
- }
- public static void main(String args[]) {
- new MangleSim().run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement