⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 probabilitycalculator.java

📁 Snunuiot are flying as far as you send them... and then they die ha ha ha
💻 JAVA
字号:

public class ProbabilityCalculator {
	
	public static void europeanWinProb(int dist, int cocoDist, int cocoWeight, int afWeight, int afEfficiency, 
			int afConcentration, int afBeauty, int euWeight, int euEfficiency, int euConcentration, int euBeauty){
		
		double afTime, euTime, euWinProb, euCocoDropProb, afCocoDropProb;
		
		euCocoDropProb = 0.5 - (double) euConcentration / 200;
		afCocoDropProb = 0.5 - (double) afConcentration / 200;
		
		if (euBeauty > afBeauty) euWinProb = afCocoDropProb;
		else euWinProb = afCocoDropProb * (1 - euCocoDropProb);
		
		afTime = flightTime(cocoDist, afWeight, 0) + flightTime(dist - cocoDist, afWeight, cocoWeight) - afEfficiency; 
		euTime = flightTime(cocoDist, euWeight, 0) + flightTime(dist - cocoDist, euWeight, cocoWeight) - euEfficiency;
		
		if (euTime < afTime) euWinProb += (1 - euCocoDropProb) * (1 - afCocoDropProb);
		
		System.out.println("The winning probability of the European swallow is: " + euWinProb);

	}
	
	private static double flightTime (int dist, int weight, int cargoWeight){
		return dist * (weight + (double) cargoWeight/8) / (10 * (weight + 10));
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -