Faro Shuffle Simulator

I have written a simple faro shuffle simulator which you can access here: https://robertjwallace.com///faro

It supports some common stacks and I will be adding more as time permits. Instructions are below.

  • It is pretty self explanatory. Click the “In Faro” and “Out Faro” buttons to do a shuffle.
  • The “select stack” button lets you change your stack. Included in the menu is a “Riffle Shuffle”. This does one riffle shuffle. The code actually simulates cutting the deck into two halves of approximately equal sizes (not necessarily 26/26) and shuffling them with randomness in the number of cards released by each “thumb”. When selecting this stack the reset button will do another riffle shuffle each time it is clicked.
  • Rev. In and Rev. Out do reverse Faros (as if you up jogged every other card and stripped them out)
  • The “reset” button returns you to your last selected stack.
  • The “undo” button undoes the last shuffle, cut or move of a card. You can click the undo multiple times to undo more than just your last action.
  • You can use the tool to practice memorizing your stack by turning the cards face down with the checkbox labeled “show backs”. When checked the cards will be turned face down, when unchecked they will turn face up. When face down clicking on a card will reveal it. When checkbox is not checked clicking on a card will display a sub-menu (see below for more details on the submenu.)
  • Dragging a card will move it. As you move it over other cards they will turn “grey”, dropping on a greyed card puts the dragged card to the left of the grey card.
If dropped, the ten will go to the left of the jack.
  • When a card is moused over (in an up-jogged position) you can use shortcut keys instead of clicking to bring up the sub menu. The short cut keys are: “c” to cut the card to the top; “i” to do an off center in shuffle; “o” to do an off center out shuffle; “r” to run single cards to the card you are over (the out jogged card will end on top); and “s” to do a random riffle shuffle.
  • Clicking on a card will bring up a sub menu for cutting the deck. Cutting will put the card you clicked on at the top of the deck. You can also do an off-center faro using this menu. Note that the card currently on top will stay on top if you do an out shuffle. You can run single cards from the top to the bottom. Also, you can mark a card (which simply makes it grey) which lets you follow the card thru shuffles.
  • The sequence of in and out shuffles needed to move the top card of the deck to that location is also displayed when a card is clicked. The pattern of shuffles is displayed in binary notation with “I” indicating an In shuffle and “O” indicating an out shuffle. Alex Elmsley discovered that this pattern of ones and zeros is the binary notation for the number of locations down that the card shifts.
  • Persi Diaconis and Ron Graham took Elmsley’s discovery further and discovered the formulas for calculating the in and out shuffles to bring a card from position n to the top of the deck. Clicking on a card shows this pattern of in and out shuffles. Their paper can be found at https://statweb.stanford.edu/~cgates/PERSI/papers/pre-elmsley.pdf. The formula doesn’t give the shortest sequence for all the cards. When you click on a card I show the sequence as calculated by Diaconis unless there is a shorter one. The ones calculated from Diaconis’ paper are marked “Diaconis”.
  • Their paper also gives the formula for finding the sequence to move from location p, to location q. Note that these formulas are not necessarily the shortest sequence. For example to move the card at location 26 to location 0 only takes one in shuffle. But the “Show Pat” will show IOOOOO. When moving to location 0, the trailing O’s are not necessary as described in the paper. Another pattern shown to move 26 to 0 is the pattern OIOIOI, which is obviously longer than I.
The main menu “Show Pat” will display the In and Out shuffle pattern for moving a card from a position to another position. In this example, from position 6 to position 2. Clicking on the pattern will run the sequence of shuffles.

Leave a Reply

Your email address will not be published. Required fields are marked *