completed simple game loop