Program: 164361
Project: 164361
Buggy source:
@Override protected boolean build(){
  feeling=Feeling.CHASM;
  initRooms();
  int distance;
  int retry=0;
  int minDistance=(int)Math.sqrt(rooms.size());
  do {
    int innerRetry=0;
    do {
      if (innerRetry++ > 10) {
        return false;
      }
      roomEntrance=Random.element(rooms);
    }
 while (roomEntrance.width() < 4 || roomEntrance.height() < 4);
    innerRetry=0;
    do {
      if (innerRetry++ > 10) {
        return false;
      }
      roomExit=Random.element(rooms);
    }
 while (roomExit == roomEntrance || roomExit.width() < 6 || roomExit.height() < 6 || roomExit.top == 0);
    Graph.buildDistanceMap(rooms,roomExit);
    distance=Graph.buildPath(rooms,roomEntrance,roomExit).size();
    if (retry++ > 10) {
      return false;
    }
  }
 while (distance < minDistance);
  roomEntrance.type=Type.ENTRANCE;
  roomExit.type=Type.EXIT;
  Graph.buildDistanceMap(rooms,roomExit);
  List<Room> path=Graph.buildPath(rooms,roomEntrance,roomExit);
  Graph.setPrice(path,roomEntrance.distance);
  Graph.buildDistanceMap(rooms,roomExit);
  path=Graph.buildPath(rooms,roomEntrance,roomExit);
  Room room=roomEntrance;
  for (  Room next : path) {
    room.connect(next);
    room=next;
  }
  Room roomShop=null;
  int shopSquare=0;
  for (  Room r : rooms) {
    if (r.type == Type.NULL && r.connected.size() > 0) {
      r.type=Type.PASSAGE;
      if (r.square() > shopSquare) {
        roomShop=r;
        shopSquare=r.square();
      }
    }
  }
  if (roomShop == null || shopSquare < 30 || ((roomShop.width() - 1) * (roomShop.height() - 1) < ShopPainter.spaceNeeded())) {
    return false;
  }
 else {
    roomShop.type=Imp.Quest.isCompleted() ? Room.Type.SHOP : Room.Type.STANDARD;
  }
  paint();
  paintWater();
  paintGrass();
  return true;
}

Fixed version (ground truth):
@Override protected boolean build(){
  feeling=Feeling.CHASM;
  viewDistance=4;
  initRooms();
  int distance;
  int retry=0;
  int minDistance=(int)Math.sqrt(rooms.size());
  do {
    int innerRetry=0;
    do {
      if (innerRetry++ > 10) {
        return false;
      }
      roomEntrance=Random.element(rooms);
    }
 while (roomEntrance.width() < 4 || roomEntrance.height() < 4);
    innerRetry=0;
    do {
      if (innerRetry++ > 10) {
        return false;
      }
      roomExit=Random.element(rooms);
    }
 while (roomExit == roomEntrance || roomExit.width() < 6 || roomExit.height() < 6 || roomExit.top == 0);
    Graph.buildDistanceMap(rooms,roomExit);
    distance=Graph.buildPath(rooms,roomEntrance,roomExit).size();
    if (retry++ > 10) {
      return false;
    }
  }
 while (distance < minDistance);
  roomEntrance.type=Type.ENTRANCE;
  roomExit.type=Type.EXIT;
  Graph.buildDistanceMap(rooms,roomExit);
  List<Room> path=Graph.buildPath(rooms,roomEntrance,roomExit);
  Graph.setPrice(path,roomEntrance.distance);
  Graph.buildDistanceMap(rooms,roomExit);
  path=Graph.buildPath(rooms,roomEntrance,roomExit);
  Room room=roomEntrance;
  for (  Room next : path) {
    room.connect(next);
    room=next;
  }
  Room roomShop=null;
  int shopSquare=0;
  for (  Room r : rooms) {
    if (r.type == Type.NULL && r.connected.size() > 0) {
      r.type=Type.PASSAGE;
      if (r.square() > shopSquare) {
        roomShop=r;
        shopSquare=r.square();
      }
    }
  }
  if (roomShop == null || shopSquare < 54) {
    return false;
  }
 else {
    roomShop.type=Imp.Quest.isCompleted() ? Room.Type.SHOP : Room.Type.STANDARD;
  }
  paint();
  paintWater();
  paintGrass();
  return true;
}