Add checkForEndOfGame()function.