complete code for pure baysian bandit client-side sim