Written main game loop