Program: 24622
Project: 24622
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 (    Enemy e : enemies) {
      AgentBehaviour ai=e.AI;
      for (      AgentRule rule : aiRules) {
        if (rule.matches(ai.type,ai.currentGoal)) {
        }
      }
    }
    for (    Player p : tmpPlayers) {
      if (locationFacts.size() == 0) {
        locationFacts.put(new Point(p.getX(),p.getY()),0.1f);
      }
      p.move();
      p.xSpeed=0;
      p.ySpeed=0;
      Skill[] skills=p.getSkills();
      for (      Skill sk : skills) {
        if (sk.active) {
          if (sk.getCurrentCooldown() > 0) {
            sk.reduceCurrentCooldown(0.05f);
          }
        }
 else {
          if (sk.getLevel() > 0)           sk.use(p,null);
        }
      }
      p.updateEffects();
      for (      Enemy e : enemies) {
        if (e.AI.currentGoal == AgentGoal.GUARD_CHEST && p.getX() == e.AI.currentTarget.getX() && p.getY() == e.AI.currentTarget.getY()) {
          e.AI.setGoal(AgentGoal.KILL_PLAYER);
          e.AI.setTarget(p);
        }
        if (e.AI.currentGoal == AgentGoal.FIND_PLAYER && e.canSee(p)) {
          locationFacts.put(new Point(p.getX(),p.getY()),1.0f);
          e.AI.currentTarget=p;
        }
        if (e.AI.currentGoal == AgentGoal.KILL_PLAYER && e.AI.currentTarget == null && locationFacts.size() > 0) {
          e.AI.currentTarget=getLastKnownLocation();
        }
      }
    }
    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.005));
      if (pairs.getValue() < 0)       iter.remove();
    }
    for (    Player p : tmpPlayers) {
      for (      Chest c : chests) {
        if (!c.isOpened() && p.getX() == c.x && p.getY() == c.y) {
          c.open();
          for (          GameItem item : c.getItems())           p.getInventory().addItem(item);
          p.incMoney(c.money);
        }
      }
    }
    for (Iterator<Chest> it=chests.iterator(); it.hasNext(); ) {
      if (it.next().isOpened()) {
        it.remove();
      }
    }
    for (Iterator<Enemy> it=enemies.iterator(); it.hasNext(); ) {
      if (!it.next().isAlive()) {
        it.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));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    try {
      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 (    Enemy e : enemies) {
      AgentBehaviour ai=e.AI;
      for (      AgentRule rule : aiRules) {
        if (rule.matches(ai.type,ai.currentGoal)) {
          rule.execute(e,ai.currentTarget);
        }
      }
    }
    for (    Player p : tmpPlayers) {
      if (locationFacts.size() == 0) {
        locationFacts.put(new Point(p.getX(),p.getY()),0.1f);
      }
      p.move();
      p.xSpeed=0;
      p.ySpeed=0;
      Skill[] skills=p.getSkills();
      for (      Skill sk : skills) {
        if (sk.active) {
          if (sk.getCurrentCooldown() > 0) {
            sk.reduceCurrentCooldown(0.05f);
          }
        }
 else {
          if (sk.getLevel() > 0)           sk.use(p,null);
        }
      }
      p.updateEffects();
      for (      Enemy e : enemies) {
        if (e.AI.currentGoal == AgentGoal.GUARD_CHEST && p.getX() == e.AI.currentTarget.getX() && p.getY() == e.AI.currentTarget.getY()) {
          e.AI.setGoal(AgentGoal.KILL_PLAYER);
          e.AI.setTarget(p);
        }
        if (e.AI.currentGoal == AgentGoal.FIND_PLAYER && e.canSee(p)) {
          locationFacts.put(new Point(p.getX(),p.getY()),1.0f);
          e.AI.currentTarget=p;
        }
        if (e.AI.currentGoal == AgentGoal.KILL_PLAYER && e.AI.currentTarget == null && locationFacts.size() > 0) {
          e.AI.currentTarget=getLastKnownLocation();
        }
      }
    }
    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.005));
      if (pairs.getValue() < 0)       iter.remove();
    }
    for (    Player p : tmpPlayers) {
      for (      Chest c : chests) {
        if (!c.isOpened() && p.getX() == c.x && p.getY() == c.y) {
          c.open();
          for (          GameItem item : c.getItems())           p.getInventory().addItem(item);
          p.incMoney(c.money);
        }
      }
    }
    for (Iterator<Chest> it=chests.iterator(); it.hasNext(); ) {
      if (it.next().isOpened()) {
        it.remove();
      }
    }
    for (Iterator<Enemy> it=enemies.iterator(); it.hasNext(); ) {
      if (!it.next().isAlive()) {
        it.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));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    try {
      Thread.sleep(20);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}