finish the game main logic