mizzajl some random comment
This commit is contained in:
28
Mizzajl/home/backup/maxGrow.js
Normal file
28
Mizzajl/home/backup/maxGrow.js
Normal 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);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user