A Monte Carlo Algorithm for Universally Optimal Bayesian Sequence Prediction and Planning