Playing cards in Crystal.
Add this to your application's shard.yml
:
dependencies:
playing-cards:
github: jefffederman/playing-cards
require "playing-cards"
To create a new 52 card deck, just use:
deck = PlayingCards::Deck.new
To shuffle the deck, use:
deck.shuffle!
Most of the time, you'll want to start with a shuffled deck, so you can use:
deck = PlayingCards::Deck.shuffle!
To deal cards, use:
player_1_cards = deck.deal(3)
There are no development dependencies other than Crystal. Feel free to make pull requests!
- Fork it (https://github.com/your-github-user/playing_cards/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- jefffederman Jeff Federman - creator, maintainer