Filter instead of remove

This commit is contained in:
Isaac Shoebottom 2023-11-13 13:32:57 -04:00
parent c320b31ac3
commit df2d550eb6

View File

@ -9,7 +9,7 @@ export async function main(ns: NS) {
do {
if (Math.min(...levels) <= hackingLevel) {
// remove the level from the list, so we don't try to hack it again
levels.splice(levels.indexOf(hackingLevel), 1)
levels = levels.filter(level => level > hackingLevel)
ns.tprint(`Hacking level increased to ${hackingLevel}`)
ns.tprint(`Remaining levels to hack: ${levels}`)
ns.run("killall.js")