mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 02:32:55 +02:00
Merge pull request #3581 from stalefishies/compression-contract-fix
BUGFIX: Handle edge case in LZ compression code and fix docs
This commit is contained in:
@@ -105,6 +105,13 @@ export function comprLZEncode(plain: string): string {
|
||||
|
||||
// start new literal
|
||||
set(new_state, 0, 1, string + length + offset);
|
||||
|
||||
// end current backreference and start new backreference
|
||||
for (let new_offset = 1; new_offset <= Math.min(9, i); ++new_offset) {
|
||||
if (plain[i - new_offset] === c) {
|
||||
set(new_state, new_offset, 1, string + length + offset + "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user