deckshoes
Version:
Various implementations of playing cards for the many game vaieties including alternative decks for games like 500.
126 lines (92 loc) • 3.45 kB
Markdown
<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://bitbucket.org/simpleprogramming1/playing-cards">
<img src="logo.svg" alt="Logo" width="160" height="160">
</a>
<h3 align="center">Deck Shoes</h3>
<p align="center">
A simple implementation of playing cards, decks and shoes.
<br />
<a href="https://bitbucket.org/simpleprogramming1/playing-cards/src/master/documentation/"><strong>Explore the docs »</strong></a>
</p>
</p>
<!-- TABLE OF CONTENTS -->
<details open="open">
<summary><h2 style="display: inline-block">Table of Contents</h2></summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li>
<a href="#usage">Usage</a>
<ul>
<li><a href="#create-a-playing-card">Create a Playing Card</a></li>
<li><a href="#create-a-deck-of-cards">Create a Deck of Cards</a></li>
<li><a href="#create-a-multi-deck-shoe">Create a multi-deck Shoe</a></li>
</ul>
</li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## About The Project
Deck Shoes is a simple implementation for playing cards suitable for various games. It includes custom deck implementation for games like 500 as well as stripped decks like the Spanish deck and the Piquet deck.
<!-- GETTING STARTED -->
## Getting Started
### Installation
```sh
npm install deckshoes@latest
```
<!-- USAGE EXAMPLES -->
## Usage
### Create a Playing Card
```ts
import { PlayingCard, Suit } from 'deckshoes';
const cardFromConstructor = new PlayingCard("A", Suit.spades);
//or
const cardFromString = PlayingCard.parseString("AS");
```
### Create a Deck of Cards
```ts
import { PlayingCard, Deck } from 'deckshoes';
//Deck creation
const emptyDeck = new Deck();
const standardDeck = Deck.generateStandardDeck();
//Draw a random card from the deck
const card = standardDeck.drawCard();
```
### Create a multi-deck Shoe
```ts
import { PlayingCard, Deck, Shoe } from 'deckshoes';
//Start with an empty deck
const emptyShoe = new Shoe();
//or start with a set number of standard 52-card decks
const prefilledShoe = new Shoe(6);
//Draw a random card from the shoe
const card = prefilledShoe.drawCard();
```
_For more examples, please refer to the [Documentation](https://bitbucket.org/simpleprogramming1/playing-cards/src/master/documentation/)_
<!-- CONTRIBUTING -->
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
<!-- LICENSE -->
## License
Distributed under the MIT License. See `LICENSE` for more information.
<!-- CONTACT -->
## Contact
Simple Programming - [@samjanda](https://twitter.com/samjanda) - hi@simpleprogramming.com.au
Project Link: [https://bitbucket.org/simpleprogramming1/playing-cards](https://bitbucket.org/simpleprogramming1/playing-cards)