add end game logic