This commit is contained in:
2024-10-13 13:35:50 +02:00
parent 1e7e42772b
commit 9d8d23cec8
2 changed files with 49 additions and 4 deletions

View File

@@ -1,14 +1,59 @@
/** @param {NS} ns */
export async function main(ns) {
ns.tail();
const sScript = ns.args[0]; // script
const nThreads = ns.args[1]; // threads
const sArgs = [...arguments];
const sTarget = ns.args[2]; // target server
const bRepeat = ns.args[3]; // should this script loop
const nMsecDelay = ns.args[4]; // MsecDelay
const sWeakenScript = "RMweaken.js";
const sGrowScript = "RMgrow.js";
const sHackScript = "RMhack.js";
const sListName = "serverList.txt";
const sWorkerList = "WorkerList.txt";
if (!ns.fileExists(sListName, "home")) { ns.print(`ERROR ${sListName} does not exist.`); return false; };
let sServerList = JSON.parse(ns.read(sListName));
ns.print(sScript);
ns.print(nThreads);
ns.print(sTarget);
const nScriptSize = ns.getScriptRam(sScript, "home");
const nTotalSize = nScriptSize * nThreads;
ns.print("nScriptSize = " + nScriptSize);
ns.print("nTotalSize = " + nTotalSize);
// get sorted list of most cores servers
// get total free RAM per number of cores
// calculate effect of cores on each server with cores > 1
// update nThreads
// run weaken/grow on core servers until cores = 1
// get sorted list of biggest RAM servers
// get total free RAM on core 1 servers
// run remaining weaken/grow
// run hack untill RAM on cores 1 servers run out
// run remaining hacks on smallest to biggest core servers
/*
for (i = 0; ; i++) {
let sHost = "";
ns.exec(sScript, sHost, nThreads);
ns.exec(sScript, sHost, nThreads, sTarget, bRepeat, nMsecDelay);
}
*/
}