Program: 164128
Project: 164128
Buggy source:
public void progress(){
switch (state) {
case START:
    seal();
  set(5 + 25 * 32,Terrain.LOCKED_DOOR);
GameScene.updateMap(5 + 25 * 32);
tengu.state=tengu.HUNTING;
tengu.pos=5 + 28 * 32;
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_START;
break;
case FIGHT_START:
changeMap(MAP_MAZE);
clearEntities((Room)new Room().set(0,5,8,32));
Actor.remove(tengu);
mobs.remove(tengu);
HealthIndicator.instance.target(null);
tengu.sprite.kill();
Room maze=new Room();
maze.set(10,1,31,29);
maze.connected.put(null,new Room.Door(10,2));
maze.connected.put(maze,new Room.Door(20,29));
MazePainter.paint(this,maze);
GameScene.resetMap();
buildFlagMaps();
cleanWalls();
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
state=State.MAZE;
break;
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos+=9 + 3 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
clearEntities(null);
tengu.state=tengu.HUNTING;
do {
tengu.pos=Random.Int(length());
}
 while (solid[tengu.pos] || distance(tengu.pos,Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_ARENA;
break;
case FIGHT_ARENA:
unseal();
CustomTileVisual vis=new exitVisual();
vis.pos(7,7);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos=5 + 27 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
tengu.pos=5 + 28 * 32;
tengu.sprite.place(5 + 28 * 32);
changeMap(MAP_END);
clearEntities(null);
tengu.die(Dungeon.hero);
for (Item item : storedItems) drop(item,randomPrisonCell());
state=State.WON;
break;
}
}

Fixed version (ground truth):
public void progress(){
switch (state) {
case START:
    seal();
  set(5 + 25 * 32,Terrain.LOCKED_DOOR);
GameScene.updateMap(5 + 25 * 32);
tengu.state=tengu.HUNTING;
tengu.pos=5 + 28 * 32;
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_START;
break;
case FIGHT_START:
changeMap(MAP_MAZE);
clearEntities((Room)new Room().set(0,5,8,32));
Actor.remove(tengu);
mobs.remove(tengu);
HealthIndicator.instance.target(null);
tengu.sprite.kill();
Room maze=new Room();
maze.set(10,1,31,29);
maze.connected.put(null,new Room.Door(10,2));
maze.connected.put(maze,new Room.Door(20,29));
MazePainter.paint(this,maze);
buildFlagMaps();
cleanWalls();
GameScene.resetMap();
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
state=State.MAZE;
break;
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos+=9 + 3 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
clearEntities(null);
tengu.state=tengu.HUNTING;
do {
tengu.pos=Random.Int(length());
}
 while (solid[tengu.pos] || distance(tengu.pos,Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_ARENA;
break;
case FIGHT_ARENA:
unseal();
CustomTileVisual vis=new exitVisual();
vis.pos(7,7);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos=5 + 27 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
tengu.pos=5 + 28 * 32;
tengu.sprite.place(5 + 28 * 32);
changeMap(MAP_END);
clearEntities(null);
tengu.die(Dungeon.hero);
for (Item item : storedItems) drop(item,randomPrisonCell());
state=State.WON;
break;
}
}