Skip to content

Commit

Permalink
Prevent infinite increase of maxTargets
Browse files Browse the repository at this point in the history
  • Loading branch information
alainbryden committed Oct 17, 2024
1 parent 915a373 commit 3cf7c7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ async function doTargetingLoop(ns) {
let intervalsPerTargetCycle = targeting.length == 0 ? 120 :
Math.ceil((targeting.reduce((max, t) => Math.max(max, t.timeToWeaken()), 0) + cycleTimingDelay) / loopInterval);
//log(ns, `intervalsPerTargetCycle: ${intervalsPerTargetCycle} lowUtilizationIterations: ${lowUtilizationIterations} loopInterval: ${loopInterval}`);
if (lowUtilizationIterations > intervalsPerTargetCycle && skipped.length > 0) {
if (lowUtilizationIterations > intervalsPerTargetCycle && skipped.length > 0 && maxTargets < (targetingOrder.length - noMoney.length)) {
maxTargets++;
log(ns, `Increased max targets to ${maxTargets} since utilization (${formatNumber(utilizationPercent * 100, 3)}%) has been quite low for ${lowUtilizationIterations} iterations.`);
lowUtilizationIterations = 0; // Reset the counter of low-utilization iterations
Expand Down

0 comments on commit 3cf7c7b

Please sign in to comment.