Fix the issues with the while loops running indefinitely. Remove
unnecessary statements.
Fix bug that caused an instant loss if the player held UP and pressed SPACE.

* Correct indentation according to Google's style guide.
* Reorganise method order.
* Make code more safe.
* Add option to restart to the pause menu.
Format code and indentations. Reorder methods.