diff --git a/README.md b/README.md index 92afd45..d55342d 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,5 @@ collection of python scripts for calculations in the UBoat game Wolfpack ![Screenshot aob](doc/img/aob_calc.png) ![Screenshot speed](doc/img/spd_calc.png) + +![Screenshot attackplan](doc/img/attackplan.png) \ No newline at end of file diff --git a/attackplan/attackplan.py b/attackplan/attackplan.py new file mode 100644 index 0000000..9817e0b --- /dev/null +++ b/attackplan/attackplan.py @@ -0,0 +1,52 @@ + +print("Humorhenker Attackplan script") +print("---------------------------") + +def stohms(sectime): + seconds = sectime % (24 * 3600) + hours = seconds // 3600 + seconds %= 3600 + minutes = seconds // 60 + seconds %= 60 + return "{hours:02d}:{minutes:02d}:{seconds:02d}".format(hours=hours,minutes=minutes, seconds=seconds) +def stoms(sectime): + minutes = sectime // 60 + sectime %= 60 + return "{minutes:02d}:{seconds:02d}".format(minutes=minutes, seconds=sectime) + + seconds = seconds % (24 * 3600) + hour = seconds // 3600 + seconds %= 3600 + minutes = seconds // 60 + seconds %= 60 + +print("Enter TOI (format Hours:Minutes):") +toi = input().split(":") +toi = int(toi[0])*60*60 + int(toi[1])*60 + +print("-------------") +eels = [] +print("Enter an identifier and a TTI for each shot") +print("-------------") + +while (True): + print("Name:") + name = input() + if (name == ""): + break + print("-------------") + print("TTI (format Minutes:Seconds):") + tti = input().split(":") + tti = int(tti[0])*60 + int(tti[1]) + eels.append({"name": name, "tti": tti}) + print("-----------------") + +print("---------------------------") +eels.sort(key=lambda eel: eel["tti"], reverse=True) + +print("Attackplan:") +print("{name:<15} {cut:<15} {cdt:<22} {rt:<15}".format(name="Name", cut="count up time", cdt="count down time", rt="realtime")) +print("") +for eel in eels: + print("{name:<15} {cut:<15} {cdt:<22} {rt:<15}".format(name=eel["name"], cut=stoms(eels[0]["tti"] - eel["tti"]), cdt=stoms(eel["tti"]), rt=stohms(toi-eel["tti"]))) + print("") \ No newline at end of file diff --git a/doc/img/attackplan.png b/doc/img/attackplan.png new file mode 100644 index 0000000..8495dbc Binary files /dev/null and b/doc/img/attackplan.png differ