///
///
class ShufflerDirection extends Shuffler {
private preferredGrowth : number;
private directionsArray : Array;
public runner : number = 0;
public constructor (array : Array, preferredGrowth : number, rng? : () => number) {
super(array, rng);
this.preferredGrowth = preferredGrowth;
let goodDirections = [];
let badDirections = [];
for (let direction = this.getOne(); direction != undefined; direction = this.getOne()) {
if (RoomRandomMap.isDirectionPreferred(direction, this.preferredGrowth)) {
goodDirections.push(direction);
} else {
badDirections.push(direction);
}
}
this.directionsArray = goodDirections.concat(badDirections);
}
public getDirection () {
return this.directionsArray[this.runner++];
}
}