Added a method to check for end of game.