diff --git a/dist/tetrion.js b/dist/tetrion.js index 57de204..3ced0e7 100644 --- a/dist/tetrion.js +++ b/dist/tetrion.js @@ -2641,13 +2641,8 @@ function getRandomInt(max) { var RandomGenerator = { returnBag: [], getTetrimino() { - if(this.returnBag.length < 7) this.returnBag.push.apply(this.returnBag, this.generateNewBag()); - - - console.log("return bag: " + this.returnBag); - return parseInt(this.returnBag.shift()); }, onlyUnique(value, index, self) { @@ -2665,10 +2660,12 @@ var RandomGenerator = { newBag.push(minoes[mino]); newBag = newBag.filter(this.onlyUnique); } + return newBag; }, reset() { - returnBag = 0; + if(this.returnBag != undefined) + this.returnBag.splice(0, returnBag.length); } }; diff --git a/src/shapes.js b/src/shapes.js index 9085df1..9fc0d71 100644 --- a/src/shapes.js +++ b/src/shapes.js @@ -840,13 +840,8 @@ function getRandomInt(max) { var RandomGenerator = { returnBag: [], getTetrimino() { - if(this.returnBag.length < 7) this.returnBag.push.apply(this.returnBag, this.generateNewBag()); - - - console.log("return bag: " + this.returnBag); - return parseInt(this.returnBag.shift()); }, onlyUnique(value, index, self) { @@ -864,10 +859,12 @@ var RandomGenerator = { newBag.push(minoes[mino]); newBag = newBag.filter(this.onlyUnique); } + return newBag; }, reset() { - returnBag = 0; + if(this.returnBag != undefined) + this.returnBag.splice(0, returnBag.length); } };