One final note before I dive in: this algorithm is essentially large scale ticket swapping, which is obviously illegal and unethical. I don’t believe that it would be ethical to use this in the real world... and since Clipper cards are not cloneable, this work can’t be used to facilitate this large-scale theft.