Code for the end game. All it is needed is to change the currentGameState variable to END when ever the game needs to be ended.