//Imports const uno = require("./uno"); const Card = require("./cards/Card"); const ChooseColor = require("./cards/special/ChooseColor"); const Skip = require("./cards/special/Skip"); const PlusAmount = require("./cards/special/PlusAmount"); const Reverse = require("./cards/special/Reverse"); class Game { constructor(playerAmount, rules) { this._playerAmount = playerAmount; this._rules = rules; this.initGame(); } initGame(){ this._cardPool = this.generatePool(); } generatePool(){ let pool = []; for (let k = 0; k < 2; k++) { for (let j = 1; j < (uno.CARD_COLORS.length); j++) { pool.push(new Reverse("R", uno.CARD_COLORS[j])); pool.push(new PlusAmount("+2", uno.CARD_COLORS[j])); pool.push(new Skip("S", uno.CARD_COLORS[j])); if (k === 0) { pool.push(new ChooseColor("CC")); pool.push(new PlusAmount("+4", uno.CARD_COLORS[0])); } for (let i = 0; i <= 9; i++) { if (k === 1 && i === 0) continue; pool.push(new Card(i, uno.CARD_COLORS[j])); } } } return pool; } get cardPool(){ return this._cardPool; } } module.exports = Game;