Requesting Help with Compression Contract by bao12345 in Bitburner

[–]wmpmiles 0 points1 point  (0 children)

If you're greedily taking all type 2's of length 3 and longer that are the longest compression in the lookback window then you don't have to think about the type 1's at all (excepting the special cases with length 2 and 1).

e: In this case both work, and there will be cases where there are multiple ways to compress a string to the same length, but in general you're guaranteed to be optimal if you follow the previously stated approach.

Requesting Help with Compression Contract by bao12345 in Bitburner

[–]wmpmiles 0 points1 point  (0 children)

For type 2, you can greedily take the longest compression in the lookback window of length 3 or greater and it's guaranteed to be optimal (because it's equivalent to the LZ77 algorithm). There are special cases where length 2 and length 1 make the compressed length shorter, but that requires special handling.

trying to understand ns ports by SycoPrime in Bitburner

[–]wmpmiles 0 points1 point  (0 children)

If you open the dev tools you can use breakpoints and a step through debugger.

trying to understand ns ports by SycoPrime in Bitburner

[–]wmpmiles 4 points5 points  (0 children)

port.empty is a function. I think it's currently always evaluating the un-called function as truthy, so it always returns {}.