This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Solve for number of growth threads required to get from money_lo to money_hi | |
| function solveGrow(base, money_lo, money_hi) { | |
| if (money_lo >= money_hi) { return 0; } | |
| let threads = 1000; | |
| let prev = threads; | |
| for (let i = 0; i < 30; ++i) { | |
| let factor = money_hi / Math.min(money_lo + threads, money_hi - 1); | |
| threads = Math.log(factor) / Math.log(base); | |
| if (Math.ceil(threads) == Math.ceil(prev)) { break; } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const names = ["Hardware", "Robots", "AI Cores", "Real Estate"]; | |
| const size = [0.06, 0.5, 0.1, 0.005]; | |
| const permutations = [ | |
| [1, 1, 1, 1], | |
| [0, 1, 1, 1], | |
| [1, 0, 1, 1], | |
| [1, 1, 0, 1], | |
| [1, 1, 1, 0], | |
| [0, 0, 1, 1], | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** @arg {NS} ns **/ | |
| export async function main(ns) { | |
| ns.disableLog("ALL"); | |
| const scripts = ["/bin/hack.js", "/bin/weak.js", "/bin/grow.js", "/bin/weak.js"]; | |
| const killAllScripts = function(ns, pids) { | |
| for (let index = 0; index < pids.length; ++index) { | |
| for (let i = 0; i < 4; ++i) { ns.kill(pids[index][i]); } | |
| } | |
| } |