mizzajl sync

This commit is contained in:
2024-10-05 19:32:54 +02:00
parent 53e9822d01
commit 80b3ca8873
83 changed files with 3639 additions and 3234 deletions

View File

@@ -0,0 +1,28 @@
/** @param {NS} ns */
export async function main(ns) {
//args
const sTarget = ns.args[0]; // target server
ns.tail(ns.pid,"home",ns.args);
let nMoney = ns.getServerMoneyAvailable(sTarget);
const nMaxMoney = ns.getServerMaxMoney(sTarget);
const startValue = nMoney; // First argument: starting value
const target = nMaxMoney; // Second argument: target value
let result = startValue; // Initialize result with the starting value
let n = 1;
// For loop that continues until the result exceeds or matches the target
for (; result < target; n++) {
result += 1; // Add 1 before multiplication
result *= n; // Multiply by the current step value
ns.print("result = "+result.toLocaleString() + " / "+ nMaxMoney.toLocaleString());
ns.print("n = "+n);
}
let nGrowThreadsNeeded = n;
// * ns.growthAnalyze(sTarget, n, 1);
ns.print("nGrowThreadsNeeded = " + nGrowThreadsNeeded);
}