Cards Against Humanity and Apples to Apples

This commit is contained in:
Dragon Fire
2021-03-13 13:10:47 -05:00
parent d796ef01b4
commit cebe468390
8 changed files with 31903 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
const { shuffle } = require('../util/Util');
module.exports = class Deck {
constructor(cards) {
this.cards = cards;
this.deck = shuffle(cards);
}
draw() {
if (!this.deck.length) this.reset();
const card = this.deck[0];
this.deck.shift();
return card;
}
reset() {
this.deck = shuffle(this.cards);
return this.deck;
}
};