So I finished the game and got the computer. I started adding candies and lollies and so on, and I had Infinity candies and lollies. Whooo :D

But then I ate my infinity candies, and now it says I have NaN candies. Basically I have zero candies, permanently, and I can't even play that 10 candy game any more!

Any way I can change this?!

3 Answers 3


Try to add more candies with: add 10 candies. If that doesn't work, go into your savegame text file (after you click "Get the current game as text") and search gameCandiesCurrent=. In front of it there should be a number. Change that number to whatever you'd like, then copy all of the text and paste it into the loading part, and load the game.


Save the game as text and find this line

 number gameCandiesCurrent=

and add the number that you wish and select all the text and load it from the textarea in the game.


Once your number of candies becomes NaN, it's going to do some odd things to your game. You'll never get back to a proper number by subtracting, but if the Computer lets you set your candies to an exact number, that may be the way out.

The amount of candies you have is NaN which stands for Not a Number. It's a placeholder for 'infinity' and other situations where a math operation is otherwise undefined:

  • 1 ÷ 0 = NaN
  • 00 = NaN
  • ∞ - ∞ = NaN <-- This is what happened when you ate all the candies.

NaN behaves a bit oddly until you understand what's going on behind the scenes. Basically any logical test involving NaN is going to come out false:

  • NaN = 0 ? No.
  • NaN ≥ 1 ? No.
  • NaN < 1 ? Still no.

It's also 'contagious':

  • 10 + NaN = NaN
  • NaN - 10,000 = NaN

So depending on how the game is coded, NaN can be helpful or just annoying. In the case of the arcade machine, it's annoying because evidently when you press the '1000 candies' button, a check is performed to see if you have enough candy. But NaN is not greater than 1000 so the game considers you to not have enough candy to play. On the other hand, you might be able to buy anything you want...depending on how the game is programmed. If the purchase logic is to check whether your candies is greater than the price of what you want to buy, you'll never have 'enough' for anything. But if the game checks whether you would have negative candies after subtracting the price, then you can buy anything because that will never happen (NaN minus anything is NaN, which is not less than zero!).

Wikipedia has more details than you probably wanted to know about not-a-number. In terms of the math operations one might try to perform, NaN is a lot like NULL in SQL database programming.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .