contracts.js: add --verbose and --check-delay options. README.md: update.

[?]
May 16, 2020, 11:36 PM
IFVY3INITLTHXUCAU5ZTYELKOD2CP45KVYP77ZT6BNKF34BNHROAC

Dependencies

  • [2] FCJA5EXS contracts.js: add. README.md: update.
  • [3] HSNSECD5 all: refactor. main.js: fix call to `void_kill_script_named_server_named`.
  • [4] SXEJJKPI executables: add `--help` flag. hacker.js: change scheduling logic. refactor. kill.js: allow handling more than one server or script at a time. cyclic_weaken.js: add. README.md: update.
  • [5] DJDWBCCQ add missing "nop.js". killall.js: rename to kill.js. add `--script` and `--server` options.
  • [6] FBAPT2WW executables: dynamically load help messages. lshw.js, main.js: add options to change score correction method and score factor multipliers. README.md: update.
  • [7] JGNALSUQ add "cyclic_weaken.js" feature. hacker.js, main.js, libs: refactor. README.md: update.
  • [8] 2BKHJI2S init
  • [9] VMXI7PS4 added action cap. improved scoring system. fixed parts of security and cash predictors. made lshw loopable.
  • [10] 2WOLGB42 README.md: update. kill.js: fix argument parser. lshw.js: add `-p` option. increase information given. main.js: fix error message. set saner defaults. hacker.js: split some functions into "lib_time.js" and "lib_score.js". ram.js: fix.

Change contents

  • edit in bin/main.js at line 59
    [3.9119]
    [3.9119]
    // whether to display help and exit
    boolean_print_help = !1
  • replacement in bin/main.js at line 202
    [3.13184][3.13184:13253]()
    // whether to display help and exit
    boolean_print_help = !1;
    [3.13184]
    [3.13253]
    boolean_print_help = object_defaults.boolean_print_help;
  • replacement in bin/main.js at line 457
    [3.22951][3.22951:23144]()
    SECONDS = The duration of delay between each main loop used in helper scripts, in seconds. Should be a floating-point number > 0. Defaults to ${object_defaults.float_period_check_seconds}.
    [3.22951]
    [3.23144]
    SECONDS = The duration of delay between each repeat of the helper scripts' main loops, in seconds. Should be a floating-point number > 0. Defaults to ${object_defaults.float_period_check_seconds}.
  • replacement in bin/lshw.js at line 31
    [3.3937][3.3937:3968]()
    float_sleep_duration: 0,
    [3.3937]
    [3.3968]
    // time period used for checking the time in seconds
    float_sleep_duration_seconds: 0,
  • edit in bin/lshw.js at line 76
    [3.9975][3.4765:4830]()
    // multiplier for skill factor used in server scoring system
  • edit in bin/lshw.js at line 77
    [3.4913][3.4913:4981]()
    // multiplier for max cash factor used in server scoring system
  • edit in bin/lshw.js at line 78
    [3.5070][3.5070:5136]()
    // multiplier for growth factor used in server scoring system
  • edit in bin/lshw.js at line 79
    [3.5221][3.5221:5319]()
    // correction method for factors used in server scoring system. can be "standard" or "normal"
  • replacement in bin/lshw.js at line 80
    [3.5404][3.5404:5469]()
    float_sleep_duration = object_defaults.float_sleep_duration,
    [3.5404]
    [3.5469]
    float_sleep_duration_seconds = object_defaults.float_sleep_duration_seconds,
  • edit in bin/lshw.js at line 82
    [3.5528]
    [3.10006]
    // initial state of the servers array
  • edit in bin/lshw.js at line 84
    [3.10030]
    [3.10030]
    // whether to display help and exit
  • replacement in bin/lshw.js at line 95
    [3.5625][3.3030:3085](),[3.3030][3.3030:3085]()
    float_sleep_duration = 1e3 * argument_value;
    [3.5625]
    [3.3085]
    float_sleep_duration_seconds = argument_value;
  • replacement in bin/lshw.js at line 160
    [3.18910][3.18910:18993]()
    if (float_sleep_duration < 1) break;
    await ns.sleep(float_sleep_duration);
    [3.18910]
    [3.18993]
    if (float_sleep_duration_seconds < 1) break;
    await ns.sleep(1e3 * float_sleep_duration_seconds);
  • replacement in bin/lshw.js at line 186
    [3.7475][3.10799:11009](),[3.10799][3.10799:11009]()
    SECONDS = The duration of delay between update, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.
    [3.7475]
    [3.11009]
    SECONDS = The duration of delay between updates, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.
  • edit in bin/contracts.js at line 2
    [3.3805231][3.3805231:3805289]()
    * make messages optional
    * add an option to loop forever?
  • edit in bin/contracts.js at line 14
    [3.3805562][3.3805562:3805608]()
    // variables
    let boolean_print_help = !1;
  • replacement in bin/contracts.js at line 16
    [3.3805638][3.3805638:3805768]()
    object_argument_names = object_get_constants().object_argument_names,
    object_arguments = object_parse_arguments(ns.args);
    [3.3805638]
    [3.3805768]
    object_constants = object_get_constants(),
    // defaults
    object_defaults = object_constants.object_defaults,
    // argument names
    object_argument_names = object_constants.object_argument_names;
    let
    float_period_check_seconds = object_defaults.float_period_check_seconds,
    boolean_verbose = object_defaults.boolean_verbose,
    boolean_print_help = object_defaults.boolean_print_help;
    const object_arguments = object_parse_arguments(ns.args);
  • edit in bin/contracts.js at line 30
    [3.3805975]
    [3.3805975]
    case object_argument_names.check_delay.short:
    // fall-through
    case object_argument_names.check_delay.long:
    float_period_check_seconds = argument_value;
    break;
    case object_argument_names.verbose.short:
    // fall-through
    case object_argument_names.verbose.long:
    boolean_verbose = argument_value;
    break;
  • replacement in bin/contracts.js at line 52
    [3.3806410][3.3806410:3806423]()
    // main
    [3.3806410]
    [3.3806423]
  • replacement in bin/contracts.js at line 55
    [3.3806481][3.3806481:3806510]()
    void_contracts_solver(ns);
    [3.3806481]
    [3.3806510]
    if (float_period_check_seconds > 0) {
    const float_period_check = 1e3 * float_period_check_seconds;
    for (;;)
    void_contracts_solver(ns, float_period_check_seconds, boolean_verbose),
    await ns.sleep(float_period_check);
    }
    else void_contracts_solver(ns, float_period_check_seconds, boolean_verbose);
  • edit in bin/contracts.js at line 64
    [3.3806514]
    [3.3806514]
    // functions
  • replacement in bin/contracts.js at line 67
    [3.3806557][3.3806557:3806586]()
    const object_solvers = {};
    [3.3806557]
    [3.3806586]
    const
    object_argument_names = {
    check_delay: {
    short: "c",
    long: "check-delay",
    },
    help: {
    short: "h",
    long: "help",
    },
    verbose: {
    short: "v",
    long: "verbose",
    },
    },
    object_defaults = {
    // time period used for checking the time in seconds
    float_period_check_seconds: 0,
    // whether to display notification messages or not
    boolean_verbose: !1,
    // whether to display help and exit
    boolean_print_help: !1,
    },
    object_solvers = {};
  • replacement in bin/contracts.js at line 402
    [3.3816278][3.3816278:3816378]()
    object_argument_names: {
    help: {
    short: "h",
    long: "help",
    },
    }
    [3.3816278]
    [3.3816378]
    object_defaults,
    object_argument_names,
  • replacement in bin/contracts.js at line 412
    [3.3816552][3.3816552:3816668]()
    Attempts to solve existing coding contracts in the network. Displays whether or not any attempts were successful.
    [3.3816552]
    [3.3816668]
    Attempts to solve existing coding contracts in the network.
  • replacement in bin/contracts.js at line 415
    [3.3816675][3.3816675:3816715]()
    run ${ns.getScriptName()} [FLAGS ...]
    [3.3816675]
    [3.3816715]
    run ${ns.getScriptName()} [FLAGS ...] [OPTIONS]
  • replacement in bin/contracts.js at line 419
    [3.3816799][3.3816799:3816838]()
    Displays this message then exits.`
    [3.3816799]
    [3.3816838]
    Displays this message then exits.
    -${object_argument_names.verbose.short}, --${object_argument_names.verbose.long}
    If set, displays messages regarding succesful attempts (in addition to standard failed attempt messages).
    OPTIONS
    -${object_argument_names.check_delay.short}, --${object_argument_names.check_delay.long} <SECONDS>
    SECONDS = The duration of delay between each network-wide contract search and solve attempts, in seconds. Should be a floating-point number >= 0.001. By default, the script will only search for and attempt to solve contracts once, unless this option is manually set.`
  • replacement in bin/contracts.js at line 468
    [3.3818042][3.3818042:3818081]()
    solve: function (answer) {
    [3.3818042]
    [3.3818081]
    solve: function (answer, boolean_verbose) {
  • replacement in bin/contracts.js at line 474
    [3.3818235][3.3818235:3818271]()
    returnReward: !0,
    [3.3818235]
    [3.3818271]
    returnReward: boolean_verbose,
  • replacement in bin/contracts.js at line 485
    [3.3818384][3.3818384:3818430]()
    const void_contracts_solver = function (ns) {
    [3.3818384]
    [3.3818430]
    const void_contracts_solver = function (
    ns,
    boolean_verbose
    ) {
  • replacement in bin/contracts.js at line 500
    [3.3818827][3.3818827:3818940]()
    string_output = object_contract.solve(answer);
    "" === object_contract.solve(answer)
    ? ns.tprint(
    [3.3818827]
    [3.3818940]
    output = object_contract.solve(answer, boolean_verbose);
    switch (output) {
    case "":
    // fall-through
    case !1:
    ns.tprint(
  • edit in bin/contracts.js at line 511
    [3.3819018][3.3819018:3819067]()
    )
    : ns.tprint(
    `
    ${string_output}`
  • edit in bin/contracts.js at line 512
    [3.3819076]
    [3.3819076]
    break;
    case !0:
    break;
    default:
    ns.tprint(
    `
    ${output}`
    );
    break;
    }
  • replacement in README.md at line 65
    [3.9937][3.15897:16047]()
    * SECONDS = The duration of delay between each main loop used in helper scripts, in seconds. Should be a floating-point number > 0. Defaults to 10.
    [3.9937]
    [3.9981]
    * SECONDS = The duration of delay between each repeat of the helper scripts' main loops, in seconds. Should be a floating-point number > 0. Defaults to 10.
  • edit in README.md at line 170
    [2.2412][2.2412:2470]()
    * Displays whether or not any attempts were successful.
  • replacement in README.md at line 172
    [2.2482][2.2482:2515]()
    `run contracts.js [FLAGS ...]`
    [2.2482]
    [2.2515]
    `run contracts.js [FLAGS ...] [OPTIONS]`
  • edit in README.md at line 178
    [2.2583]
    [3.15498]
    `-v, --verbose`
    * If set, displays messages regarding succesful attempts (in addition to standard failed attempt messages).
    #### OPTIONS
    `-c, --check-delay`
    * The duration of delay between each network-wide contract search and solve attempts, in seconds. Should be a floating-point number >= 0.001. By default, the script will only search for and attempt to solve contracts once, unless this option is manually set.
  • replacement in README.md at line 207
    [3.15887][3.15887:16097]()
    * SECONDS = The duration of delay between update, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.
    [3.15887]
    [3.16097]
    * SECONDS = The duration of delay between updates, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.