handle check for end of game