UNPKG

pokie

Version:

A server-side video slot game logic framework for JavaScript and TypeScript.

34 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SymbolsCombination = void 0; class SymbolsCombination { constructor() { this.combination = []; } getSymbols(reelId) { return this.combination[reelId]; } fromMatrix(value, transposed = false) { this.combination = JSON.parse(JSON.stringify(transposed ? this.transposeArray(value) : value)); return this; } toMatrix(transposed = false) { return JSON.parse(JSON.stringify(transposed ? this.transposeArray(this.combination) : this.combination)); } transposeArray(source) { const r = []; let i; let j; for (i = 0; i < source.length; i++) { for (j = 0; j < source[i].length; j++) { if (r[j] === undefined) { r[j] = []; } r[j][i] = source[i][j]; } } return r; } } exports.SymbolsCombination = SymbolsCombination; //# sourceMappingURL=SymbolsCombination.js.map