1.0.0 • Published 4 years ago
test1251 v1.0.0
Cardgame-template
A template for creating card games. Implemented by using TypeScript.
Contains boilerplate code for creating any type of card game you want. Bootstraped with the CRA template so that the user can add their own frontend
todo: publish to yarn/npm as package when done
Requirements
- Yarn or NPM
- TypeScript (v3.0.0+)
Installation
Yarn
$ yarn install cardgame-template
NPM
$ npm install cardgame-template
Usage
import {Deck} from "cardgame-template";
const game = new Deck(); // create instance of Deck class
game.createDeck(); // create the 52 cards with suits and values.
game.shuffleDeck(); // shuffle the deck.
game.selectPlayers(2); // specify the number of players.
game.dealCards(); // deal the cards equally to all players
API Documentation
Name | Type | Description |
---|---|---|
createDeck | void | Create the deck containing all 52 cards. |
shuffleDeck | void | Shuffle the deck. |
selectPlayers | number | Select amount of players by providing a number as argument. |
dealCards | void | Deal the cards. 52 cards / number of players. |
License
Source code in this repository is released under MIT license
1.0.0
4 years ago