Change filtering logic
This commit is contained in:
parent
7de44a3c2f
commit
2ca91f574f
@ -11,10 +11,10 @@ export function recursiveScan(ns: NS) {
|
|||||||
// Add all servers to the list
|
// Add all servers to the list
|
||||||
let allServers: string[] = []
|
let allServers: string[] = []
|
||||||
while (servers.length > 0) {
|
while (servers.length > 0) {
|
||||||
let server = servers.shift()
|
let server = servers.pop()
|
||||||
if (server) {
|
if (server) {
|
||||||
let newServers = ns.scan(server)
|
let newServers = ns.scan(server)
|
||||||
for (let newServer of newServers) {
|
for (const newServer of newServers) {
|
||||||
if (!allServers.includes(newServer)) {
|
if (!allServers.includes(newServer)) {
|
||||||
allServers.push(newServer)
|
allServers.push(newServer)
|
||||||
servers.push(newServer)
|
servers.push(newServer)
|
||||||
@ -23,7 +23,7 @@ export function recursiveScan(ns: NS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove the home server from the list
|
// Remove the home server from the list
|
||||||
return allServers.splice(allServers.indexOf("home"), 1).sort()
|
return allServers.filter(server => server !== "home").sort()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user