grow helpers improvement

This commit is contained in:
2023-09-05 00:58:08 +02:00
parent 673abd49b2
commit 7b14e98658
25 changed files with 359 additions and 136 deletions
+4 -8
View File
@@ -11,13 +11,9 @@ export async function main(ns) {
let nextServer = availableServers[i];
if (nextServer != currentServer && nextServer != previousServer) {
if (ns.scriptRunning('simple-hack.js', nextServer)) {
let maxMoney = ns.getServerMaxMoney(nextServer);
let currentMoney = ns.getServerMoneyAvailable(nextServer);
if (currentMoney < 0.2 * maxMoney) {
await ns.grow(nextServer);
}
let currentMoney = ns.getServerMoneyAvailable(nextServer);
if (ns.hasRootAccess(nextServer) && currentMoney > 0) {
await ns.grow(nextServer);
}
await scanServer(nextServer, currentServer);
}
@@ -27,6 +23,6 @@ export async function main(ns) {
while (true) {
ns.print(`Running scan`);
await scanServer('home');
ns.sleep(50);
await ns.sleep(1000);
}
}