@acidicnic/cards 中文文档教程
Cards.js
纸牌
Install
npm i @acidicnic/cards
Usage & Examples
// Import the package
const { Cards } = require('@acidicnic/cards');
// Creates new ordered deck
let cardDeck = new Cards();
// Shuffle deck
cardDeck.shuffle();
// View cards in deck
console.log(cardDeck._cards);
// Selects random card from deck
cardDeck.pickRandomCard();
// Draws card at the top of the deck and removes it form the deck.
cardDeck.drawTopCard();
Cards.js
A deck of cards
Install
npm i @acidicnic/cards
Usage & Examples
// Import the package
const { Cards } = require('@acidicnic/cards');
// Creates new ordered deck
let cardDeck = new Cards();
// Shuffle deck
cardDeck.shuffle();
// View cards in deck
console.log(cardDeck._cards);
// Selects random card from deck
cardDeck.pickRandomCard();
// Draws card at the top of the deck and removes it form the deck.
cardDeck.drawTopCard();