Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
Divran committed Nov 1, 2023
1 parent b24141a commit 7849591
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,9 @@ <h4 class="card-title">
<label class='mb-0 ml-2' for='gt-overclock-batch'>Enable batch mode</label>
</div>
<div class="col">
<div>
<input type='checkbox' id='gt-overclock-newbatch' value='1' checked />
<label class='mb-0 ml-2' for='gt-overclock-newbatch'>Use new 2.3.7+ batch mode</label>
<div style="white-space:nowrap;">
<input type='checkbox' id='gt-overclock-newbatch' class="align-middle" value='1' checked />
<label class='mb-0 ml-2 align-middle' style="white-space:normal;" for='gt-overclock-newbatch'>New Math <small>(Use new 2.3.7+ batch mode and sub onetick math)</small></label>
</div>
</div>
</div>
Expand Down
36 changes: 31 additions & 5 deletions js/greginator/overclock-calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ onVersionChanged(function(version) {
function calcOC(_target_tier, _tier, _energy, _time, _parallel, _amps, isPA) {
var overclocks, speed, energy, totalEnergy, time, parallel;

var maxParallelBeforeBatchMode = _parallel > 0 ? _parallel : 1;
var maxParallel = maxParallelBeforeBatchMode;
var originalMaxParallel = _parallel > 0 ? _parallel : 1;
var maxParallel = originalMaxParallel;

if (_parallel == 0 || isPA) {
overclocks = _target_tier - _tier;
Expand Down Expand Up @@ -418,11 +418,36 @@ onVersionChanged(function(version) {
time /= speed;
}

// begin sub onetick math
if (time < 1) {
maxParallel = Math.floor(maxParallel / time);

// copy pasted and translated from calculateEUtConsumptionUnderOneTick in overclockcalculator.java
/*
// THIS DOESN'T WORK
// And then after this how do you calculate the parallel? this only supposedly gives you the new energy cost (except it doesn't because it doesn't work)
// but it doesn't tell you how much additional parallel it gets
console.log("EUT",totalEnergy, "parallel", maxParallel, "originalMaxParallel", originalMaxParallel);
var parallelMultiplierFromOverclocks = maxParallel / originalMaxParallel;
console.log("paralellMultiplierFromOverclocks",parallelMultiplierFromOverclocks);
var amountOfParallelOverclocks = Math.log(parallelMultiplierFromOverclocks) / Math.log(SPEED_PER_TIER);
console.log("amountOfParallelOverclocks",amountOfParallelOverclocks);
var newTotalEnergy = Math.ceil(
_energy * Math.pow(ENERGY_PER_TIER, amountOfParallelOverclocks) *
Math.pow(ENERGY_PER_TIER, overclocks - amountOfParallelOverclocks) *
originalMaxParallel
)
console.log("NEW EUT",newTotalEnergy);
totalEnergy = newTotalEnergy;
*/
}
// end sub onetick math

if (batch_mode) {
if (new_batch_mode) {
if (time < 1) {
maxParallel = Math.floor(maxParallel / time);
}
// begin new batch mode math

// static variables taken from gtnh source code
var MAX_BATCH_MODE_TICK_TIME = 128;
var batchModifier = 128;
Expand All @@ -443,6 +468,7 @@ onVersionChanged(function(version) {
parallel += extraParallels;
time = time * durationMultiplier;
}
// end new batch mode math

} else {
// OLD batch mode
Expand Down

0 comments on commit 7849591

Please sign in to comment.