Implemented Coding Contracts

This commit is contained in:
danielyxie
2018-09-22 19:25:48 -05:00
parent e714f1e6cd
commit f78f0ec1a7
17 changed files with 413 additions and 80 deletions
+47
View File
@@ -0,0 +1,47 @@
.. _codingcontracts:
Coding Contracts
================
Coding Contracts are a mechanic that lets players earn rewards in
exchange for solving programming problems.
Coding Contracts are files with the ".cct" extensions. They can
be accessed through the :ref:`terminal` or through scripts using
the :ref:`netscriptcodingcontractapi`
Each contract has a limited number of attempts. If you
provide the wrong answer too many times and exceed the
number of attempts, the contract will self destruct (delete itself)
Currently, Coding Contracts are randomly generated and
spawned over time. They can appear on any server (including your
home computer), except for your purchased servers.
Running in Terminal
^^^^^^^^^^^^^^^^^^^
To run a Coding Contract in the Terminal, simply use the
:ref:`run_terminal_command` command::
$ run some-contract.cct
Doing this will bring up a popup. The popup will display
the contract's problem, the number of attempts remaining, and
an area to provide an answer.
Interacting through Scripts
^^^^^^^^^^^^^^^^^^^^^^^^^^^
See :ref:`netscriptcodingcontractapi`.
Rewards
^^^^^^^
There are currently four possible rewards for solving a Coding Contract:
* Faction Reputation for a specific Faction
* Faction Reputation for all Factions that you are a member of
* Company reputation for a specific Company
* Money
The 'amount' of reward varies based on the difficulty of the problem
posed by the Coding Contract. There is no way to know what a
Coding Contract's exact reward will be until it is solved.
+1
View File
@@ -21,6 +21,7 @@ secrets that you've been searching for.
Netscript <netscript>
Terminal <terminal>
Coding Contracts <codingcontracts>
Keyboard Shortcuts <shortcuts>
Changelog <changelog>
+1
View File
@@ -25,4 +25,5 @@ to reach out to the developer!
Trade Information eXchange (TIX) API <netscriptixapi>
Singularity Functions <netscriptsingularityfunctions>
Bladeburner API <netscriptbladeburnerapi>
Coding Contract API <netscriptcodingcontractapi>
Miscellaneous <netscriptmisc>
+3 -4
View File
@@ -1,9 +1,8 @@
Netscript Bladeburner API
=========================
Netscript provides the following API for interacting with the game's Bladeburner mechanic.
The Bladeburner API is **not** immediately available to the palyer and must be unlocked
The Bladeburner API is **not** immediately available to the player and must be unlocked
later in the game
**WARNING: This page contains spoilers for the game**
@@ -12,9 +11,9 @@ The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
automatically gain access to this API. Otherwise, you must have Source-File 7 in
order to use this API in other BitNodes
**Bladeburner API functions must be accessed through the bladeburner namespace**
**Bladeburner API functions must be accessed through the 'bladeburner' namespace**
In Netscript 1.0::
In :ref:`netscript1`::
bladeburner.getContractNames();
bladeburner.startAction("general", "Training");
+74
View File
@@ -0,0 +1,74 @@
.. _netscriptcodingcontractapi:
Netscript Coding Contract API
=============================
Netscript provides the following API for interacting with
:ref:`codingcontracts`.
**The Coding Contract API must be accessed through the 'codingcontract' namespace**
In :ref:`netscript1`::
codingcontract.getDescription("foo.cct", "home");
codingcontract.attempt(1, "foo.cct", "foodnstuff");
In :ref:`netscriptjs`::
ns.codingcontract.getDescription("foo.cct", "home");
ns.codingcontract.attempt(1, "foo.cct", "foodnstuff");
attempt
-------
.. js:function:: attempt(answer, fn[, hostname/ip=current ip])
:param answer: Solution for the contract
:param string fn: Filename of the contract
:param string hostname/ip: Hostname or IP of the server containing the contract.
Optional. Defaults to current server if not provided
Attempts to solve the Coding Contract with the provided solution.
:returns: Boolean indicating whether the solution was correct
getDescription
--------------
.. js:function:: getDescription(fn[, hostname/ip=current ip])
:param string fn: Filename of the contract
:param string hostname/ip: Hostname or IP of the server containing the contract.
Optional. Defaults to current server if not provided
Get the full text description for the problem posed by the Coding Contract
:returns: A string with the contract's text description
getData
-------
.. js:function:: getData(fn[, hostname/ip=current ip])
:param string fn: Filename of the contract
:param string hostname/ip: Hostname or IP of the server containing the contract.
Optional. Defaults to current server if not provided
Get the data associated with the specific Coding Contract. Note that this is
not the same as the contract's description. This is just the data that
the contract wants you to act on in order to solve
:returns: The specified contract's data
getNumTriesRemaining
--------------------
.. js:function:: getNumTriesRemaining(fn[, hostname/ip=current ip])
:param string fn: Filename of the contract
:param string hostname/ip: Hostname or IP of the server containing the contract.
Optional. Defaults to current server if not provided
Get the number of tries remaining on the contract before it
self-destructs.
:returns: Number indicating how many attempts are remaining
+1 -1
View File
@@ -154,7 +154,7 @@ getScriptLogs
scan
^^^^
.. js:function:: scan(hostname/ip[, hostnames=true])
.. js:function:: scan(hostname/ip=current ip[, hostnames=true])
:param string hostname/ip: IP or hostname of the server to scan
:param boolean: Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false)
+11 -4
View File
@@ -285,12 +285,15 @@ except literature files (.lit).
**WARNING: This is permanent and cannot be undone**
.. _run_terminal_command:
run
^^^
$ run [file name] [-t] [num threads] [args...]
Execute a program or a script.
Execute a program, script, or :ref:`codingcontracts`.
The '[-t]', '[num threads]', and '[args...]' arguments are only valid when
running a script. The '-t' flag is used to indicate that the script should
@@ -305,13 +308,17 @@ argument must be separated by a space.
**Examples**
Run a program:
Run a program::
run BruteSSH.exe
$ run BruteSSH.exe
Run *foo.script* with 50 threads and the arguments [1e3, 0.5, foodnstuff]::
run foo.script -t 50 1e3 0.5 foodnstuff
$ run foo.script -t 50 1e3 0.5 foodnstuff
Run a Coding Contract::
$ run foo-contract.cct
scan
^^^^