solve random logic puzzle