finish the main game logic