main game logic.