Skip to content

Commit

Permalink
fixed testsDone being increased through internal checks
Browse files Browse the repository at this point in the history
  • Loading branch information
G4mingJon4s committed May 27, 2024
1 parent e582055 commit eaf1adb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/NetscriptFunctions/Worm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function NetscriptWorm(): InternalAPI<IWorm> {
const session = getSession(ctx, sessionIdentifier);
const input = helpers.string(ctx, "input", _input);
return helpers.netscriptDelay(ctx, wormTestingTime(ctx.workerScript.scriptRef.threads)).then(() => {
const finalState = session.evaluate(input);
const finalState = session.evaluate(input, true);
return Promise.resolve(finalState);
});
},
Expand Down
6 changes: 3 additions & 3 deletions src/Worm/WormSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ export class WormSession {
this.testsDone = 0;
}

evaluate(input: string) {
this.testsDone += 1;
evaluate(input: string, userInput: boolean) {
if (userInput) this.testsDone += 1;
return evaluateInput(this.graph, input);
}

isPathCorrect() {
return (
this.guess.path.length === this.graph.properties.pathLength &&
this.evaluate(this.guess.path) === this.graph.targetState
this.evaluate(this.guess.path, false) === this.graph.targetState
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Worm/ui/WormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function WormInput() {

function handleTest() {
const session = getWormUISession();
const result = session.evaluate(input);
const result = session.evaluate(input, true);
setState(result);
}

Expand Down

0 comments on commit eaf1adb

Please sign in to comment.