1.0.0 • Published 4 years ago

test1251 v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

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

NameTypeDescription
createDeckvoidCreate the deck containing all 52 cards.
shuffleDeckvoidShuffle the deck.
selectPlayersnumberSelect amount of players by providing a number as argument.
dealCardsvoidDeal the cards. 52 cards / number of players.

License

Source code in this repository is released under MIT license