Filter instead of remove
This commit is contained in:
parent
c320b31ac3
commit
df2d550eb6
@ -9,7 +9,7 @@ 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
|
// 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(`Hacking level increased to ${hackingLevel}`)
|
||||||
ns.tprint(`Remaining levels to hack: ${levels}`)
|
ns.tprint(`Remaining levels to hack: ${levels}`)
|
||||||
ns.run("killall.js")
|
ns.run("killall.js")
|
||||||
|
Loading…
Reference in New Issue
Block a user