Make alterReality harder

This commit is contained in:
Olivier Gagnon 2021-11-12 19:27:03 -05:00
parent f5d6132dfc
commit c417e76541
3 changed files with 11 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -36,8 +36,15 @@ export function NetscriptExtra(player: IPlayer, workerScript: WorkerScript): INe
real_document.completely_unused_field = undefined; real_document.completely_unused_field = undefined;
}, },
alterReality: function (): void { alterReality: function (): void {
// eval so the code doesn't get optimized away. // We need to trick webpack into not optimizing a variable that is guaranteed to be false (and doesn't use prototypes)
const x = eval("false"); let x = false;
const recur = function (depth: number): void {
if (depth === 0) return;
x = !x;
recur(depth - 1);
};
recur(2);
console.log(x);
console.warn("I am sure that this variable is false."); console.warn("I am sure that this variable is false.");
if (x !== false) { if (x !== false) {
console.warn("Reality has been altered!"); console.warn("Reality has been altered!");