MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / isRight

Method isRight

code/main/EnigmaAnswerCandies.ts:15–29  ·  view source on GitHub ↗
(answer: string)

Source from the content-addressed store, hash-verified

13
14 // Public methods
15 public isRight(answer: string): boolean{
16 // If the answer is the current number of candies we possess
17 if(Algo.simplifyString(answer) == this.game.getCandies().getCurrent().toString() ||
18 Algo.simplifyString(answer) == (this.game.getCandies().getCurrent()+1).toString() ||
19 Algo.simplifyString(answer) == (this.game.getCandies().getCurrent()+2).toString() ||
20 Algo.simplifyString(answer) == (this.game.getCandies().getCurrent()+3).toString() ||
21 Algo.simplifyString(answer) == (this.game.getCandies().getCurrent()-1).toString() ||
22 Algo.simplifyString(answer) == (this.game.getCandies().getCurrent()-2).toString() ||
23 Algo.simplifyString(answer) == (this.game.getCandies().getCurrent()-3).toString()
24 )
25 return true;
26
27 // The answer isn't correct
28 return false;
29 }
30}

Callers

nothing calls this directly

Calls 2

getCurrentMethod · 0.80
getCandiesMethod · 0.45

Tested by

no test coverage detected