{"id":15509874,"url":"https://github.com/svyatov/card_dealer","last_synced_at":"2025-04-24T04:39:43.920Z","repository":{"id":147936550,"uuid":"619252382","full_name":"svyatov/card_dealer","owner":"svyatov","description":"A delightful card dealing companion for your digital table.","archived":false,"fork":false,"pushed_at":"2024-09-30T22:46:01.000Z","size":867,"stargazers_count":2,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T07:25:11.866Z","etag":null,"topics":["card-games","deckofcards","playing-cards","poker","poker-cards"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svyatov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-26T17:54:19.000Z","updated_at":"2024-07-07T13:49:27.000Z","dependencies_parsed_at":"2025-03-07T08:42:08.086Z","dependency_job_id":null,"html_url":"https://github.com/svyatov/card_dealer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svyatov%2Fcard_dealer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svyatov%2Fcard_dealer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svyatov%2Fcard_dealer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svyatov%2Fcard_dealer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svyatov","download_url":"https://codeload.github.com/svyatov/card_dealer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250422351,"owners_count":21427934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["card-games","deckofcards","playing-cards","poker","poker-cards"],"created_at":"2024-10-02T09:44:38.128Z","updated_at":"2025-04-24T04:39:43.881Z","avatar_url":"https://github.com/svyatov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CardDealer\n[![Gem Version](https://badge.fury.io/rb/card_dealer.svg)](https://badge.fury.io/rb/card_dealer)\n[![Maintainability](https://api.codeclimate.com/v1/badges/a5266ef126fbbe754ff8/maintainability)](https://codeclimate.com/github/svyatov/card_dealer/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/a5266ef126fbbe754ff8/test_coverage)](https://codeclimate.com/github/svyatov/card_dealer/test_coverage)\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.txt)\n\nCardDealer is your go-to gem for creating, shuffling, and dealing decks of cards\nwith ease. Whether you're building a poker night app or a virtual bridge club,\nCardDealer has got you covered. Enjoy customizable deck options, smooth\nshuffling algorithms, and simple yet powerful deck manipulation tools that bring\nthe classic card game experience to life.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add card_dealer\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install card_dealer\n\n## Usage\n\n### Creating a standard 52-card deck\n\nTo create a standard 52-card deck, use the `CardDealer::BuildDeck.standard52` method:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard52\nputs deck.cards\n```\n\n### Creating a standard 36-card deck\n\nTo create a standard 36-card deck, use the `CardDealer::BuildDeck.standard36` method:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard36\nputs deck.cards\n```\n\n### Creating a custom deck of cards\n\nTo create a custom deck of cards, use the `CardDealer::BuildDeck.custom` method.\nYou can specify the number of decks, cards per suit, ranks, and suits:\n\n```ruby\ndeck = CardDealer::BuildDeck.custom(\n  decks: 2,\n  cards_per_suit: 5,\n  ranks: :highest,\n  suits: %w[c d]\n)\nputs deck.cards\n```\n\n### Shuffling and dealing cards\n\nThe `CardDealer::Deck` class provides methods for shuffling and dealing cards:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard52\ndeck.shuffle\nhand = deck.deal(5)\nputs hand\n```\n\nYou can also burn cards before dealing:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard52\ndeck.shuffle\nhand = deck.deal(3, burn: 1)\nputs hand\n```\n\nTo burn cards without dealing, just pass `0` as the number of cards to deal:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard52\ndeck.shuffle\nhand = deck.deal(0, burn: 1)\nputs hand\n```\n\nBurned cards are stored within the deck and can be accessed via `burned_cards` method:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard52\ndeck.shuffle\ndeck.deal(0, burn: 10)\nputs deck.burned_cards\n```\n\n### Encoding a deck of cards as a binary string\n\nTo encode a deck of cards as a binary string, use the `CardDealer::BinaryDeck.encode` method.\nThis is useful if you'd like to store a deck of cards in a database, cache, or a file:\n\n```ruby\ndeck = CardDealer::BuildDeck.standard52\nencoded_deck = CardDealer::BinaryDeck.encode(deck)\n# - or -\nencoded_deck = deck.to_binary_s\nputs encoded_deck\n```\n\n### Decoding a binary string into a deck of cards\n\nTo decode a binary string into a deck of cards, use the `CardDealer::BinaryDeck.decode` method:\n\n```ruby\nencoded_deck = \"\\x02\\xCDP\" # binary string\ndecoded_deck = CardDealer::BinaryDeck.decode(encoded_deck)\n# - or -\ndecoded_deck = CardDealer::Deck.from_binary(encoded_deck)\nputs decoded_deck.cards\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push\ngit commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/svyatov/card_dealer.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvyatov%2Fcard_dealer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvyatov%2Fcard_dealer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvyatov%2Fcard_dealer/lists"}