Skip to content

Instantly share code, notes, and snippets.

import { Scheduler } from "scheduler.js";
function computeCounts(ns, target, hackThreads, hackFraction) {
let hackTime = ns.getHackTime(target);
let growTime = ns.getGrowTime(target);
let weakenTime = ns.getWeakenTime(target);
let growThreads = Math.ceil(ns.growthAnalyze(target, 1.06) * growTime / hackTime);
// Note: weaken weakens the security level by 0.05, so we have to multiply the rate of
// security increases by 20 to get the desired number of threads.