remove redundant preparation steps in "hacker.js".

[?]
Apr 27, 2020, 9:16 AM
V4DMWF25DAT3WBCJTC6Q4I54FYPGBQR4NVZI6RUZFY3T67TQTTZAC

Dependencies

  • [2] AXGQ7FML split and refactor hacking logic to "hacker.js" and argument parsing and script execution logic to "main.js". update "README.md".
  • [3] 44JNP7VZ fix schedule making and running logic.
  • [4] 2BKHJI2S init
  • [5] NQ22FUSW add more options to `main.js`. update `README.md`.
  • [6] HLC2L3NJ add "tor.js" and "programs.js". use `minimist` for "main.js" argument parsing.

Change contents

  • edit in sbin/hacker.js at line 424
    [3.36913][3.36913:37263]()
    }
    };
    const string_job_decider_prepare = function(ns, string_server_target, float_server_target_security, float_server_target_cash) {
    if (float_server_target_security > ns.getServerMinSecurityLevel(string_server_target)) {
    return "weaken";
    }
    if (float_server_target_cash < ns.getServerMaxMoney(string_server_target)) {
    return "grow";
  • edit in sbin/hacker.js at line 425
    [3.37267][3.37267:37280]()
    return "";
  • edit in sbin/hacker.js at line 537
    [3.42352][3.42352:42448]()
    case "": {
    boolean_end_loop_array_servers = true;
    break;
    }
  • edit in sbin/hacker.js at line 719
    [3.51109]
    let integer_time_start = Date.now();
    let string_server_target = string_server_target_argument;
    if (string_server_target_argument === "") {
    string_server_target = string_get_server_rooted_hackable_with_score_biggest(ns);
    }
    const array_schedule = array_make_schedule(ns, integer_job_cap, float_precision, float_steal_cap, float_padding_seconds, string_server_target, string_job_decider);
    await void_schedule_runner(ns, array_schedule);
    return ((array_schedule[array_schedule.length - 1].integer_time_job_finishes_seconds + float_padding_seconds) * 1000) - integer_time_start + Date.now();
    };
  • replacement in README.md at line 19
    [2.3025][2.3025:3444]()
    * Make and execute a "preparation" schedule containing information about when, where and how many threads (among other information) the "weaken.js" and "grow.js" worker scripts should be executed with.
    * Make and execute a "hacking" schedule containing information about when, where and how many threads (among other information) the "weaken.js", "grow.js" and "hack.js" worker scripts should be executed with.
    [2.3025]
    [2.3444]
    * Make and execute a schedule containing information about when, where and how many threads (among other information) the "weaken.js", "grow.js" and "hack.js" worker scripts should be executed with.