crobertsbmw / deckofcards

An API to simulate a deck of cards
MIT License
1.34k stars 335 forks source link

Separate shuffling from deck creation (allow un-shuffled decks) and support for shuffle strategies #13

Closed Gooseus closed 9 years ago

Gooseus commented 9 years ago

Should allow creation of an un-shuffled deck in a "standard" order. I actually think wrapped decks have a particular ordering which has Hearts/Clubs in reverse order and to the Spades/Diamonds. Other ordering might follow Spades->Diamonds->Clubs->Hearts hierarchy ordered either 2->A, or A-K... not sure if this is different in different regions.

Also there could be different shuffling strategies which could be useful (or not) to a game utilizing the tool.

Solitaire Game example:

Kind of weak, but I just thought of it as I was typing and could be valid.

Another version would be a Blackjack game that actually encourages (or teaches) card counting and uses some observed shuffling strategies (usually something to do with a separator in the shoe which tells them to shuffle everything again) to make it as realistic as possible.

crobertsbmw commented 9 years ago

I read Ben Mezrich's book "Bringing Down the House" (the movie 21 was based on this book) several years ago which inspired me to write a java program that would count the cards that were dealt based on MIT's card counting algorithm.

Anyway, I am hoping the API may inspire some cool apps such as a card counting app.

crobertsbmw commented 9 years ago

I have pushed an update so that you can now open an unshuffled deck. However I don't know if I addressed your issue of various shuffling strategies. If I didn't address the issue properly, please open a new.