Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 1.24 KB

README.md

File metadata and controls

23 lines (18 loc) · 1.24 KB

Deck of cards implementation

This library implements a deck of cards with the ace as high (valued greater than King). The Ace class can be instantiated as low or high. The PokerDeckBuilder creates a deck with the ace as high.

Project Layout

Design

My hope was to make the library extensible to allow other types of decks to easily be created. For example if the ace needs to be low, a different PokerDeckBuilder function could be added to support that.

I decided not to unit test the randomness of shuffle but instead that it swaps cards as expected. For better testability, the StandardDeck class takes a NumberGenerator to allow shuffle's functionality to be predictable.

The shuffle and dealOneCard methods are implemented in StandardDeck.

To Use

I used Intellij IDE to develop the project and was able to include it in another project by adding it as a module.