Risk Bug ...

Jump to navigation Jump to search

Risk Bug ...

Hi mate. I was just looking at the code of BrokenSword and it looks like you have a little bug in your evalDestinationRisk(..) method:

 for (EnemyData enemy1 : enemiesCollection) {
      double distSq = enemy1.distanceSq(destination);
      int closer = 0;
      for (EnemyData enemy2 : enemiesCollection) {
        if (enemy1.distanceSq(enemy2) < distSq) {
          closer++;
        }
      }

To me it looks like, that you need a "enemy1 != enemy2" check in the second loop. Maybe you have fixed this already, in that case - never mind :).

Take Care

Wompi11:35, 16 July 2012