Board = new CardButton[BoardSize][BoardSize];
LinkedList<CardButton> Pool = new LinkedList<CardButton>();
LinkedList<Integer> Considered = new LinkedList<Integer>();
// Every board should have two creepers :)
Pool.add(new CardButton(Card.getByID(Card.CREEPER)));
Pool.add(new CardButton(Card.getByID(Card.CREEPER)));
Considered.add(Card.CREEPER);
// If the board is big, add Herobrine ;)
if (BoardSize > Options.toInt(GameSize.C6)) {
Considered.add(Card.HEROBRINE);
Pool.add(new CardButton(Card.getByID(Card.HEROBRINE)));
// If the board is bigger, add another Herobrine ;)
if (BoardSize == Options.toInt(GameSize.C8)) {
Pool.add(new CardButton(Card.getByID(Card.HEROBRINE)));
}
}
// Fill the rest of the pool randomly
Random rand = new Random(); int randInt;
while (Pool.size() < Math.pow(BoardSize, 2)) {
// Randomized range of size-1 because this doesn't include Herobrine
// Helps limit excess loops, even if just a little :)
randInt = rand.nextInt(Card.Collection.size() - 1);
if (!Considered.contains(randInt)) {
Pool.add(new CardButton(Card.getByID(randInt)));
Pool.add(new CardButton(Card.getByID(randInt)));
Considered.add(randInt);
}
}
// Shuffle the pool in