public int getOverDrones(EcState s) { int overDrones = ((s.productionTime() / 17) + s.usedDrones()) * overDroneEfficiency / 100; overDrones = Math.min(overDrones, maxOverDrones); return overDrones; }
/*Creates the equipment in all states to initiate the game */ private void fillStates(int sAvail, int sRent, int sShop) { int[] statesSizes = {sAvail, sRent, sShop}; int s = 1; for (int stateSize : statesSizes) { for (int t = 1; t <= TYPES; t++) { for (int i = 1; i <= stateSize; i++) { Equipment e = new Equipment(); e.state = s; e.type = t; int sMax = Math.max( s - 2, 0); /*formula to make sure identifiers resume counting and stay unique */ int sMin = Math.min( s - 1, 1); /*formula to make sure identifiers resume counting and stay unique */ e.ident = i + (sMin) * sAvail + (sMax) * sRent; e.c = equipColor(e.type); switch (s) { case 1: availEquipment.add(e); break; case 2: rentEquipment.add(e); break; case 3: shopEquipment.add(e); break; } } } s++; } computeInitialTimes(); assignShapes(); }
public static void main(String[] args) { double a = -191.635; double b = 43.74; int c = 16, d = 45; System.out.printf("The absolute value " + "of %.3f is %.3f%n", a, abs(a)); System.out.printf("The ceiling of " + "%.2f is %.0f%n", b, Math.ceil(b)); System.out.printf("The floor of " + "%.2f is %.0f%n", b, Math.floor(b)); System.out.printf("The rint of %.2f " + "is %.0f%n", b, Math.rint(b)); System.out.printf("The max of %d and " + "%d is %d%n", c, d, Math.max(c, d)); System.out.printf("The min of of %d " + "and %d is %d%n", c, d, Math.min(c, d)); }
public int getParityDrones(EcState s) { int optimalDrones = Math.min((s.bases() * 16) + (s.gasExtractors * 3), maxOverDrones); int parityDrones = Math.min(s.getOverDrones(s), optimalDrones); return parityDrones; }
public int supply() { return Math.min((overlords + overseers) * 8 + 2 * bases(), 200); }