Program: 24605
Project: 24605
Buggy source:
@Override public void run(){
  List<Player> tmpPlayers=new ArrayList<Player>();
  while (true) {
    tmpPlayers=new ArrayList<Player>(players);
    for (Iterator<Animation> it=animations.iterator(); it.hasNext(); ) {
      Animation a=it.next();
      a.duration-=20.0f / 1000.0f;
      if (a.duration <= 0)       it.remove();
    }
    for (Iterator<Enemy> it=enemies.iterator(); it.hasNext(); ) {
      Enemy e=it.next();
      if (e.isAlive()) {
        AgentBehaviour ai=e.AI;
        for (        AgentRule rule : aiRules) {
          if (rule.matches(ai.type,ai.currentGoal,ai.currentMode)) {
          }
        }
        e.update();
      }
 else {
        it.remove();
      }
    }
    for (    Player p : tmpPlayers) {
      if (locationFacts.size() == 0) {
        locationFacts.put(new Point(p.getX(),p.getY()),0.1f);
      }
      p.update();
      for (Iterator<Chest> it=chests.iterator(); it.hasNext(); ) {
        Chest c=it.next();
        if (c.isOpened()) {
          it.remove();
        }
 else {
          if (distanceBetween(p,c) < 1) {
            c.open();
            for (            GameItem item : c.getItems())             p.getInventory().addItem(item);
            p.incMoney(c.money);
          }
        }
      }
    }
    Iterator<Entry<Point,Float>> iter=locationFacts.entrySet().iterator();
    while (iter.hasNext()) {
      Map.Entry<Point,Float> pairs=(Map.Entry<Point,Float>)iter.next();
      pairs.setValue((float)(pairs.getValue() - 0.01));
      if (pairs.getValue() < 0)       iter.remove();
    }
    Player[] toSend=new Player[tmpPlayers.size()];
    for (int i=0; i < tmpPlayers.size(); i++)     toSend[i]=tmpPlayers.get(i);
    Chest[] chestsToSend=new Chest[chests.size()];
    for (int i=0; i < chests.size(); i++)     chestsToSend[i]=chests.get(i);
    Enemy[] eneToSend=new Enemy[enemies.size()];
    for (int i=0; i < enemies.size(); i++)     eneToSend[i]=enemies.get(i);
    Animation[] animsToSend=new Animation[animations.size()];
    for (int i=0; i < animations.size(); i++)     animsToSend[i]=animations.get(i);
    try {
      server.send(new DataPacket(toSend));
      server.send(new DataPacket(chestsToSend));
      server.send(new DataPacket(eneToSend));
      server.send(new DataPacket(animsToSend));
      Thread.sleep(20);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  List<Player> tmpPlayers=new ArrayList<Player>();
  while (true) {
    tmpPlayers=new ArrayList<Player>(players);
    for (Iterator<Animation> it=animations.iterator(); it.hasNext(); ) {
      Animation a=it.next();
      a.duration-=20.0f / 1000.0f;
      if (a.duration <= 0)       it.remove();
    }
    for (Iterator<Enemy> it=enemies.iterator(); it.hasNext(); ) {
      Enemy e=it.next();
      if (e.isAlive()) {
        AgentBehaviour ai=e.AI;
        for (        AgentRule rule : aiRules) {
          if (rule.matches(ai.type,ai.currentGoal,ai.currentMode)) {
          }
        }
        e.update();
      }
 else {
        it.remove();
      }
    }
    for (    Player p : tmpPlayers) {
      if (locationFacts.size() == 0) {
        locationFacts.put(new Point(p.getX(),p.getY()),0.1f);
      }
      p.update();
      for (Iterator<Chest> it=chests.iterator(); it.hasNext(); ) {
        Chest c=it.next();
        if (c.isOpened()) {
          it.remove();
        }
 else {
          if (distanceBetween(p,c) < 1) {
            if (p.getInventory().getSize() + c.getItems().size() <= Inventory.MAX_SIZE) {
              c.open();
              for (              GameItem item : c.getItems())               p.getInventory().addItem(item);
              p.incMoney(c.money);
            }
          }
        }
      }
    }
    Iterator<Entry<Point,Float>> iter=locationFacts.entrySet().iterator();
    while (iter.hasNext()) {
      Map.Entry<Point,Float> pairs=(Map.Entry<Point,Float>)iter.next();
      pairs.setValue((float)(pairs.getValue() - 0.01));
      if (pairs.getValue() < 0)       iter.remove();
    }
    Player[] toSend=new Player[tmpPlayers.size()];
    for (int i=0; i < tmpPlayers.size(); i++)     toSend[i]=tmpPlayers.get(i);
    Chest[] chestsToSend=new Chest[chests.size()];
    for (int i=0; i < chests.size(); i++)     chestsToSend[i]=chests.get(i);
    Enemy[] eneToSend=new Enemy[enemies.size()];
    for (int i=0; i < enemies.size(); i++)     eneToSend[i]=enemies.get(i);
    Animation[] animsToSend=new Animation[animations.size()];
    for (int i=0; i < animations.size(); i++)     animsToSend[i]=animations.get(i);
    try {
      server.send(new DataPacket(toSend));
      server.send(new DataPacket(chestsToSend));
      server.send(new DataPacket(eneToSend));
      server.send(new DataPacket(animsToSend));
      Thread.sleep(20);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}