attempt() Netscript Function

attempt(answer, fn[, hostname/ip=current ip, opts={}])
Arguments:
  • answer – Solution for the contract
  • fn (string) – Filename of the contract
  • hostname/ip (string) – Hostname or IP of the server containing the contract. Optional. Defaults to current server if not provided
  • opts (object) –

    Optional parameters for configuring function behavior. Properties:

    • returnReward (boolean) If truthy, then the function will return a string that states the contract’s reward when it is successfully solved.

Attempts to solve the Coding Contract with the provided solution.

Returns:Boolean indicating whether the solution was correct. If the returnReward option is configured, then the function will instead return a string. If the contract is successfully solved, the string will contain a description of the contract’s reward. Otherwise, it will be an empty string.