reset rng array
This commit is contained in:
parent
f6180db2fb
commit
3a48117175
9
dist/tetrion.js
vendored
9
dist/tetrion.js
vendored
@ -2641,13 +2641,8 @@ function getRandomInt(max) {
|
|||||||
var RandomGenerator = {
|
var RandomGenerator = {
|
||||||
returnBag: [],
|
returnBag: [],
|
||||||
getTetrimino() {
|
getTetrimino() {
|
||||||
|
|
||||||
if(this.returnBag.length < 7)
|
if(this.returnBag.length < 7)
|
||||||
this.returnBag.push.apply(this.returnBag, this.generateNewBag());
|
this.returnBag.push.apply(this.returnBag, this.generateNewBag());
|
||||||
|
|
||||||
|
|
||||||
console.log("return bag: " + this.returnBag);
|
|
||||||
|
|
||||||
return parseInt(this.returnBag.shift());
|
return parseInt(this.returnBag.shift());
|
||||||
},
|
},
|
||||||
onlyUnique(value, index, self) {
|
onlyUnique(value, index, self) {
|
||||||
@ -2665,10 +2660,12 @@ var RandomGenerator = {
|
|||||||
newBag.push(minoes[mino]);
|
newBag.push(minoes[mino]);
|
||||||
newBag = newBag.filter(this.onlyUnique);
|
newBag = newBag.filter(this.onlyUnique);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newBag;
|
return newBag;
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
returnBag = 0;
|
if(this.returnBag != undefined)
|
||||||
|
this.returnBag.splice(0, returnBag.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -840,13 +840,8 @@ function getRandomInt(max) {
|
|||||||
var RandomGenerator = {
|
var RandomGenerator = {
|
||||||
returnBag: [],
|
returnBag: [],
|
||||||
getTetrimino() {
|
getTetrimino() {
|
||||||
|
|
||||||
if(this.returnBag.length < 7)
|
if(this.returnBag.length < 7)
|
||||||
this.returnBag.push.apply(this.returnBag, this.generateNewBag());
|
this.returnBag.push.apply(this.returnBag, this.generateNewBag());
|
||||||
|
|
||||||
|
|
||||||
console.log("return bag: " + this.returnBag);
|
|
||||||
|
|
||||||
return parseInt(this.returnBag.shift());
|
return parseInt(this.returnBag.shift());
|
||||||
},
|
},
|
||||||
onlyUnique(value, index, self) {
|
onlyUnique(value, index, self) {
|
||||||
@ -864,10 +859,12 @@ var RandomGenerator = {
|
|||||||
newBag.push(minoes[mino]);
|
newBag.push(minoes[mino]);
|
||||||
newBag = newBag.filter(this.onlyUnique);
|
newBag = newBag.filter(this.onlyUnique);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newBag;
|
return newBag;
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
returnBag = 0;
|
if(this.returnBag != undefined)
|
||||||
|
this.returnBag.splice(0, returnBag.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user