boolean hasRed = false;
CardList buildHeapList()
{
CardHeap heap = new CardHeap("AllInHeap", true);
CardList list = heap.getCardList();
// hard heap reduction
if (!jCheckBoxPortal.isSelected())
list = list.removeSet("Portal");
if (!jCheckBoxII.isSelected())
list = list.removeSet("Portal Second Age");
if (!jCheckBoxIII.isSelected())
list = list.removeSet("Portal Three Kingdoms");
if (!jCheckBox1999.isSelected())
list = list.removeSet("Starter 1999");
if (!jCheckBox2000.isSelected())
list = list.removeSet("Starter 2000");
list = list.removeSet("Fifth Edition");
hasWhite = false;
hasGreen = false;
hasBlue = false;
hasBlack = false;
hasRed = false;
if (jCheckBoxRandom1.isSelected())
{
// 2 colors random
CardList copy = list.copyList();
String color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
}
if (jCheckBoxRandom2.isSelected())
{
// 2 colors random
CardList copy = list.copyList();
String color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
}
else if (jCheckBoxRandom3.isSelected())
{
// 3 colors random
CardList copy = list.copyList();
String color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
}
else if (jCheckBoxRandom4.isSelected())
{
// 4 colors random
CardList copy = list.copyList();
String color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;
copy = copy.removeColors(color);
color = getRandomColor(copy);
if (color.length()==0) return new CardList();
if (color.equals("W")) hasWhite=true;
if (color.equals("R")) hasRed=true;
if (color.equals("B")) hasBlack=true;
if (color.equals("U")) hasBlue=true;
if (color.equals("G")) hasGreen=true;