Move filtering to after logging

This commit is contained in:
Isaac Shoebottom 2023-11-13 13:38:39 -04:00
parent e6aca2e998
commit 9b4042af40

View File

@ -8,10 +8,10 @@ export async function main(ns: NS) {
do { do {
if (Math.min(...levels) <= hackingLevel) { if (Math.min(...levels) <= hackingLevel) {
// remove the level from the list, so we don't try to hack it again
levels = levels.filter(level => level > hackingLevel)
ns.tprint(`Hacking level increased past ${Math.min(...levels)}}, is now ${hackingLevel}`) ns.tprint(`Hacking level increased past ${Math.min(...levels)}}, is now ${hackingLevel}`)
ns.tprint(`Remaining levels to hack: ${levels}`) ns.tprint(`Remaining levels to hack: ${levels}`)
// remove the level from the list, so we don't try to hack it again
levels = levels.filter(level => level > hackingLevel)
ns.run("killall.js") ns.run("killall.js")
await ns.sleep(1000) // 1 second await ns.sleep(1000) // 1 second
ns.run("hackallservers.js") ns.run("hackallservers.js")