2019-03-03 04:08:54 +01:00
|
|
|
attempt() Netscript Function
|
|
|
|
============================
|
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. js:function:: attempt(answer, filename[, hostname=current hostname[, opts={}]])
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
:RAM cost: 10 GB
|
2019-03-03 04:08:54 +01:00
|
|
|
:param answer: Solution for the contract
|
2021-03-12 08:51:56 +01:00
|
|
|
:param string filename: Filename of the contract
|
|
|
|
:param string hostname: Hostname of the server containing the contract.
|
2019-03-03 04:08:54 +01:00
|
|
|
Optional. Defaults to current server if not provided
|
2019-05-14 10:35:37 +02:00
|
|
|
:param object opts: 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.
|
2021-03-12 08:51:56 +01:00
|
|
|
:returns: ``true`` if the solution was correct. If the :code:`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.
|
2019-03-03 04:08:54 +01:00
|
|
|
|
|
|
|
Attempts to solve the Coding Contract with the provided solution.
|
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
Example:
|
2021-03-07 10:13:37 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. code-block:: javascript
|
|
|
|
|
|
|
|
codingcontract.attempt("myanswer!", "contract-123.cct", "home");
|