The interval functions seems to only be invoked when the tab of the game is active. This has the drawback that the game doesn't progress if the game is alt-tabbed. Instead of blindly relying on interval, making use of time elapsed will help to circumvent this limitation.