Program: 164248
Project: 164248
Buggy source:
private static void generateItems(){
  itemsToSpawn=new ArrayList<Item>();
switch (Dungeon.depth) {
case 6:
    itemsToSpawn.add((Random.Int(2) == 0 ? new Quarterstaff() : new Spear()).identify());
  itemsToSpawn.add(Random.Int(2) == 0 ? new IncendiaryDart().quantity(Random.NormalIntRange(2,4)) : new CurareDart().quantity(Random.NormalIntRange(1,3)));
itemsToSpawn.add(new LeatherArmor().identify());
break;
case 11:
itemsToSpawn.add((Random.Int(2) == 0 ? new Sword() : new Mace()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new CurareDart().quantity(Random.NormalIntRange(2,5)) : new Shuriken().quantity(Random.NormalIntRange(3,6)));
itemsToSpawn.add(new MailArmor().identify());
break;
case 16:
itemsToSpawn.add((Random.Int(2) == 0 ? new Longsword() : new BattleAxe()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new Shuriken().quantity(Random.NormalIntRange(4,7)) : new Javelin().quantity(Random.NormalIntRange(3,6)));
itemsToSpawn.add(new ScaleArmor().identify());
break;
case 21:
itemsToSpawn.add(Random.Int(2) == 0 ? new Glaive().identify() : new WarHammer().identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new Javelin().quantity(Random.NormalIntRange(4,7)) : new Tamahawk().quantity(Random.NormalIntRange(4,7)));
itemsToSpawn.add(new PlateArmor().identify());
itemsToSpawn.add(new Torch());
itemsToSpawn.add(new Torch());
break;
}
itemsToSpawn.add(new MerchantsBeacon());
ChooseBag(Dungeon.hero.belongings);
itemsToSpawn.add(new PotionOfHealing());
for (int i=0; i < 3; i++) itemsToSpawn.add(Generator.random(Generator.Category.POTION));
itemsToSpawn.add(new ScrollOfIdentify());
itemsToSpawn.add(new ScrollOfRemoveCurse());
itemsToSpawn.add(new ScrollOfMagicMapping());
itemsToSpawn.add(Generator.random(Generator.Category.SCROLL));
for (int i=0; i < 2; i++) itemsToSpawn.add(Random.Int(2) == 0 ? Generator.random(Generator.Category.POTION) : Generator.random(Generator.Category.SCROLL));
itemsToSpawn.add(new OverpricedRation());
itemsToSpawn.add(new OverpricedRation());
itemsToSpawn.add(new Bomb().random());
switch (Random.Int(5)) {
case 1:
itemsToSpawn.add(new Bomb());
break;
case 2:
itemsToSpawn.add(new Bomb().random());
break;
case 3:
case 4:
itemsToSpawn.add(new Honeypot());
break;
}
if (Dungeon.depth == 6) {
itemsToSpawn.add(new Ankh());
itemsToSpawn.add(new Weightstone());
}
 else {
itemsToSpawn.add(Random.Int(2) == 0 ? new Ankh() : new Weightstone());
}
TimekeepersHourglass hourglass=Dungeon.hero.belongings.getItem(TimekeepersHourglass.class);
if (hourglass != null) {
int bags=0;
switch (Dungeon.depth) {
case 6:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.20f);
break;
case 11:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.25f);
break;
case 16:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.50f);
break;
case 21:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.80f);
break;
}
for (int i=1; i <= bags; i++) {
itemsToSpawn.add(new TimekeepersHourglass.sandBag());
hourglass.sandBags++;
}
}
Item rare;
switch (Random.Int(10)) {
case 0:
rare=Generator.random(Generator.Category.WAND);
rare.level=0;
break;
case 1:
rare=Generator.random(Generator.Category.RING);
rare.level=1;
break;
case 2:
rare=Generator.random(Generator.Category.ARTIFACT).identify();
break;
default :
rare=new Stylus();
}
rare.cursed=rare.cursedKnown=false;
itemsToSpawn.add(rare);
if (itemsToSpawn.size() > 39) throw new RuntimeException("String_Node_Str");
Collections.shuffle(itemsToSpawn);
}

Fixed version (ground truth):
private static void generateItems(){
  itemsToSpawn=new ArrayList<Item>();
switch (Dungeon.depth) {
case 6:
    itemsToSpawn.add((Random.Int(2) == 0 ? new Quarterstaff() : new Spear()).identify());
  itemsToSpawn.add(Random.Int(2) == 0 ? new IncendiaryDart().quantity(Random.NormalIntRange(2,4)) : new CurareDart().quantity(Random.NormalIntRange(1,3)));
itemsToSpawn.add(new LeatherArmor().identify());
break;
case 11:
itemsToSpawn.add((Random.Int(2) == 0 ? new Sword() : new Mace()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new CurareDart().quantity(Random.NormalIntRange(2,5)) : new Shuriken().quantity(Random.NormalIntRange(3,6)));
itemsToSpawn.add(new MailArmor().identify());
break;
case 16:
itemsToSpawn.add((Random.Int(2) == 0 ? new Longsword() : new BattleAxe()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new Shuriken().quantity(Random.NormalIntRange(4,7)) : new Javelin().quantity(Random.NormalIntRange(3,6)));
itemsToSpawn.add(new ScaleArmor().identify());
break;
case 21:
itemsToSpawn.add(Random.Int(2) == 0 ? new Glaive().identify() : new WarHammer().identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new Javelin().quantity(Random.NormalIntRange(4,7)) : new Tamahawk().quantity(Random.NormalIntRange(4,7)));
itemsToSpawn.add(new PlateArmor().identify());
itemsToSpawn.add(new Torch());
itemsToSpawn.add(new Torch());
break;
}
itemsToSpawn.add(new MerchantsBeacon());
ChooseBag(Dungeon.hero.belongings);
itemsToSpawn.add(new PotionOfHealing());
for (int i=0; i < 3; i++) itemsToSpawn.add(Generator.random(Generator.Category.POTION));
itemsToSpawn.add(new ScrollOfIdentify());
itemsToSpawn.add(new ScrollOfRemoveCurse());
itemsToSpawn.add(new ScrollOfMagicMapping());
itemsToSpawn.add(Generator.random(Generator.Category.SCROLL));
for (int i=0; i < 2; i++) itemsToSpawn.add(Random.Int(2) == 0 ? Generator.random(Generator.Category.POTION) : Generator.random(Generator.Category.SCROLL));
itemsToSpawn.add(new OverpricedRation());
itemsToSpawn.add(new OverpricedRation());
itemsToSpawn.add(new Bomb().random());
switch (Random.Int(5)) {
case 1:
itemsToSpawn.add(new Bomb());
break;
case 2:
itemsToSpawn.add(new Bomb().random());
break;
case 3:
case 4:
itemsToSpawn.add(new Honeypot());
break;
}
if (Dungeon.depth == 6) {
itemsToSpawn.add(new Ankh());
itemsToSpawn.add(new Weightstone());
}
 else {
itemsToSpawn.add(Random.Int(2) == 0 ? new Ankh() : new Weightstone());
}
TimekeepersHourglass hourglass=Dungeon.hero.belongings.getItem(TimekeepersHourglass.class);
if (hourglass != null) {
int bags=0;
switch (Dungeon.depth) {
case 6:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.20f);
break;
case 11:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.25f);
break;
case 16:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.50f);
break;
case 21:
bags=(int)Math.ceil((5 - hourglass.sandBags) * 0.80f);
break;
}
for (int i=1; i <= bags; i++) {
itemsToSpawn.add(new TimekeepersHourglass.sandBag());
hourglass.sandBags++;
}
}
Item rare;
switch (Random.Int(10)) {
case 0:
rare=Generator.random(Generator.Category.WAND);
if (rare.level > 0) rare.degrade(rare.level);
break;
case 1:
rare=Generator.random(Generator.Category.RING);
rare.level=1;
break;
case 2:
rare=Generator.random(Generator.Category.ARTIFACT).identify();
break;
default :
rare=new Stylus();
}
rare.cursed=rare.cursedKnown=false;
itemsToSpawn.add(rare);
if (itemsToSpawn.size() > 39) throw new RuntimeException("String_Node_Str");
Collections.shuffle(itemsToSpawn);
}