From c1a681eb7f55f6fcef8f072229e32ca22849e317 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 23 Mar 2021 15:26:07 +0900 Subject: [PATCH] MuniMuniMuniMuniMuni --- parkingcalc.html | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/parkingcalc.html b/parkingcalc.html index ae719b1..ceb397d 100644 --- a/parkingcalc.html +++ b/parkingcalc.html @@ -139,7 +139,18 @@ } } - function TryRehearsal() { + function TryMatchingRehearsal(tbonus) { + //document.getElementById("console").value+=(Math.round(tbonus*10))+10 + if (end-start==(Math.round(tbonus*10))+10) { + var gain=(Math.round(tbonus*10))+10 + start+=gain + document.getElementById("console").value+="Step "+(step++)+") Use Rehearsal w/"+Math.round(tbonus*100)+"% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n" + return false + } + return true + } + + function TryRehearsal(tbonus) { if (end==start) { return false } @@ -147,10 +158,11 @@ if ((end-start)%2!==0) { return undefined } - if (end-start>(10+Math.round(bonus*10))+10) { - var gain=(10+Math.round(bonus*10)) + + if (end-start>(10+Math.round(tbonus*10))+10) { + var gain=(10+Math.round(tbonus*10)) start+=gain - document.getElementById("console").value+="Step "+(step++)+") Use Rehearsal w/"+(bonus*100)+"% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n" + document.getElementById("console").value+="Step "+(step++)+") Use Rehearsal w/"+(tbonus*100)+"% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n" return true } else if (end-start>=20) { @@ -239,9 +251,31 @@ } } } - do { - result = TryRehearsal() - } while (result); + for (var j=bonus;j>=0;j-=0.2) { + result = TryMatchingRehearsal(j) + if (!result) { + break; + } + } + if (result) { + for (var j=1.6;j>=0;j-=0.2) { + result = TryMatchingRehearsal(j) + if (!result) { + break; + } + } + } + if (result) { + do { + if (flexible) { + for (var j=bonus;j>=0;j-=0.2) { + result = TryRehearsal(j) + } + } else { + result = TryRehearsal(bonus) + } + } while (result); + } if (flexible) {