Learning to stay on the right side of the law