Add descriptions for the following contracts:
* HammingCodes: Integer to Encoded Binary
* HammingCodes: Encoded Binary to Integer
* Proper 2-Coloring of a Graph
Add three new contracts:
* Compression I: RLE Encoding
* Compression II: LZ Decoding
* Compression III: LZ Encoding
as well as associated utility functions
Fix#2256 by using the correct formula to calculate the hashrate increase.
Slightly revamp tooltip to display both theoric and effective increase.
Add a discreet tooltip to the Production line which display details about hashrate and ram usage.
Tested by running two script by intermittence on a loop on the hacknet server.
Value displayed stay coherent all along.
Previously, edge order would stay constant while vertex order was
shuffled. This way, there is even less opportunity for a player to
reverse-engineer the initial bipartite graph.
Implemented a greedy 2-coloring algorithm to check whether a given
graph is 2-colorable. The algorithm is only used if the player
provides "[]" as their answer; other answers will be checked using
the previously implemented validation code.
Implemented the case for the 2-coloring solver to validate that
entered colorings are proper. Still needs a case for when no
solution exists.
Also, changed the data from type [number, number][] to
[number, [number, number][]], so that the number of vertices in
the graph can be the first parameter.
Implemented the generator for a new contract type. For now, has
a description and solution checker designed only for testing. The
generator creates a bipartite graph with random edges, then
attempts to add one additional edge without regard for the partite
sets. It then randomizes the vertices of the graph to make reverse-
engineering the original partite sets impossible.
The shuffling algorithm is adapted from stack overflow code, but
really, what isn't?
depcheck is useful here. Has some false reports, but there are some
unused packages and some missing ones. Also I moved types to dev-
dependencies because we don't use them at runtime.
Added a check to stanek.acceptGift for aug status. It's not
particularly elegant, but I copied the checks from the ui. Also
changed the way CotMG status is checked to be more robust.
Added a new ns function stanek.acceptGift to the game, with a ram
cost of 2gb. The function attempts to join the CotMG and install
the gift, then returns true iff the player is in the CotMG and has
the gift installed.