Here’s the science behind A perfect Casino