print ("Establishing construction rules, please wait...") #Establishing Rounding rules at startup def roundHalfUp(f): return round(f + 0.00000000000001) #Establishing Tonnage rules at startup def limit(tonnage, minimum=10, maximum=200): return max(min(tonnage, maximum), minimum) def roundTonnage(x, base=5): return int(base * roundHalfUp(float(x)/base)) #Establishing Engine rules def limit(rating, minimum=10, maximum=500): return max(min(rating, maximum), minimum) def limit(cruise, minimum=1, maximum=50): return max(min(cruise, maximum), minimum) def roundEngine(x, base=5): return int(base * roundHalfUp(float(x)/base)) #Construction Rules verified print ("Construction Rules verified! Initializing interface.") print () #The actual program follows below print ("Welcome to MechEngine, an Engine Calculator for BattleTech, written in Python 3.6.5.") print ("Currently, only standard Fusion Engines and standard BattleMechs are available,") print ("and engine weight has also not yet been implemented.") print () tonnage = int(input("Please provide your 'Mech's Tonnage: ")) print ("Your 'Mech weighs", tonnage, "tons.") print () cruise = int(input("Please provide your desired Walk MP: ")) flank = int(roundHalfUp(cruise * 1.5)) print ("Your 'Mech has a Walk MP of", cruise, "hexes, and a Run MP of", flank, "hexes.") print ("Calculating Engine Rating...") rating = roundEngine(tonnage * cruise) print () print ("Your calculated Engine Rating is:", rating) print ("Your cruising/walking speed is", int(cruise * 3), "m/s") print ("Your maximum speed is", int(flank * 3), "m/s") print () print ("To find your engine weight, please look up your engine type and engine rating on") print ("the Master Engine Table, as shown on Page 49 of TechManual, and for") print ("XXL Engines, divide the mass of a standard engine by 3 and round to the next half-ton.") print () print ("Thank you for testing MechEngine. Please be sure to send feedback. More features coming soon!")