A simple clojure module that is meant to simulate the action of shuffling a collection as if it were a deck of cards.
All shuffle types support an optional second parameter to perform the shuffle multiple times.
Predictable behaviours that make a human riffle shuffle imperfect
- Once a deck of cards is divided to each hand, the amount of cards in each hand is not (likely) equal.
- As each thumb releases from it's half of the deck, sometimes more than one card drops from a single hand at a time.
(riffle coll times)
Predictable behaviours that make a human overhand shuffle imperfect
- Random amounts of cards (chunks) are taken from the top and placed placed in the opposite hand in reverse order (retaining the order within each chunk)
(overhand coll times)
A very predictable shuffle, alternating placing the top card on the bottom/top of the new deck
unit tests included
(mongean coll times)
Predictable shuffle, dealing items into N piles and then rejoining the piles
unit tests included
; `piles` is how many piles to use
(pile coll piles times)
This project usees leinigen 2.x for development, you can install it via hombrew with
brew install leiningen
Once you have leiningen 2 installed
git clone [email protected]:jondavidjohn/clojure-card-shuffle.git
cd clojure-card-shuffle
lein install
lein test