User:ParadiseAdi/Simulator

Note that there is a field called. For negative values, it lowers the probability of breaking buildings. It is implemented as a bonus you can get (like the Oracle and Totem), but I found no way to get this bonus. Maybe it is possible to get it online?

class Simulator implements BuildingRepair { private int collects; private int repairs; static public void main(String[] args) { (new Simulator).run(Integer.parseInt(args[0])); } 	void run(int max) { int printmask = max/20 & ~0x7ffff; if (printmask == 0) printmask = max/5 & ~0xffff; if (printmask == 0) printmask = -1; int printmask_step = printmask; Building b = new Building(this); for (int i=0; i<max; i++) { b.click; if ((i&printmask) == printmask) { System.out.println(String.format("%.0f%%", (float)i/max*100)); printmask += printmask_step; } 		} 		System.out.println("collects="+collects+", repairs="+repairs+", probability="+((float)repairs/(collects+repairs))+", ratio="+((float)repairs/collects)); } 	public void needRepair(Building b, int counter) { this.collects += counter; this.repairs++; } } interface BuildingRepair {public void needRepair(Building b, int counter);} class Building { static public float global_breakage_probability = 0; private int counter; private BuildingRepair context; public Building(BuildingRepair b) {context = b;} // original function public void click { counter++; float random = rand(rand(7, 14), 23); if ((counter * (100.0 + global_breakage_probability) / 100.0) > random) { needRepair; counter = 0; } 	} 	// original function static public int rand(int a, int b) { int i = b - a; 		return (int) (a + Math.random * i); } 	private void needRepair { context.needRepair(this, counter); } }