* MISC: Refactor coding contracts for type safety
This refactor does three things without any behavior changes:
* Adds type safety by introducing generic type parameters to the coding
contract definitions, so they can use concrete types instead of
"unknown". This also eliminates a bunch of boilerplate casts.
* Removes the unneeded CodingContractType class. We can use the metadata
type directly.
* Introduces a new hidden state to coding contracts. Instead of
generating and storing the data (which is what is shown to the user as
the problem's input), the state is stored instead. This allows
problems to (for instance) generate the answer up-front, and check the
solution directly against the answer, instead of needing to embed a
solver in the problem (which can then easily be ripped from the source
code).
For compatibility, state == data by default. I plan to make use of this
feature in a followup, but it is unused currently.
This changes the way percantage-based population estimates work, so that
they have a similar mechanism to grow(). This allows natural recovery
from 0, and also falling to 0 in finite steps.
This also changes the formula for reducing estimates to est / (1 + p)
instead of est * (1 - p). The latter becomes overpowered at large p,
we've seen this formula issue elsewhere (such as BN modifiers).
* added utility info
* moved info to running script
* fix for RAM cost
* description changes
Co-authored-by: David Walker <d0sboots@gmail.com>
* fixed wrong formatting
* Added parent to ignored fields
---------
Co-authored-by: David Walker <d0sboots@gmail.com>
Commit d82247a4 was a lazy update, this finishes putting all the entries
in the changelog. The "last updated" date is not changed, since it is
only including changes up to the old date.
Reverts the html-ification introduced in the last changelog update.
Fixed ns.singularity.donateToFaction bug
Fixed a bug within singularity.donateToFaction where you could use it to donate to Shadows Of Anarchy
Also updated the Node version in package-lock.json to 18
findRunningScriptByPid needlessly took a "server" argument. This caused
there to be a "getRunningScriptByPid" version that did *not*, and it was
looping through all servers in order to function, which is needlessly
inefficient.
By removing the parameter and the needless inefficient helper method,
the following changes:
- Many Netscript functions such as isRunning() and getScript() become faster.
- The terminal "tail" command now works by pid regardless of the current
server. Note that "kill" already worked this way.
I also improved the docs around "tail", since the pid argument wasn't
in the help.
The current implementation was naive; disableLog("ALL") was storing a
key for every function, and iterating over a different object to do it
(when iterating over objects is quite slow).
The common cases of Bitburner (and especially batching, where efficiency
matters most) are either never disabling anything, or disabling "ALL".
This optimizes for these two cases, at the expense of slightly more
complicated code to deal with the less-common edge cases.