created endGame method