Skip to content

Commit

Permalink
Reorganizing prints
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiagoRRamos committed Dec 2, 2013
1 parent 71823fa commit 1b2170d
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions my-bot/MyBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ public void doTurn() {
int numberOfAnts = sortingAnts.size();
int numberofMyHills = ants.getMyHills().size();

for(Tile ma : ants.getMyAnts()){
for (Tile ma : ants.getMyAnts()) {
spacingAnts.addElement(ma, -200, 2, -1);
}

for (Tile foodLoc : ants.getFoodTiles()) {
foodMap.addElement(foodLoc, 2000, 3, 1);
}
Expand All @@ -175,7 +175,7 @@ public void doTurn() {
}

for (Tile enemyAnt : ants.getEnemyAnts()) {
enemyHillMap.addElement(enemyAnt, -9, 2, -1);
enemyHillMap.addElement(enemyAnt, -20, 2, -1);
}
// attack hills
Set<Tile> eliminatedHills = new HashSet<Tile>();
Expand All @@ -202,72 +202,67 @@ public void doTurn() {
for (Tile or : res.keySet()) {
doMoveLocationIDontCare(or, res.get(or));
}
// for (Aim direction : Aim.values()) {
// if (doMoveDirection(myHill, direction)) {
// break;
// }
// }
}
}
count = 0;
int countGoForFood = 0;
Collections.sort(sortingAnts, foodMap.getComparator());
for (Tile antLoc : sortingAnts) {
if (!orders.containsValue(antLoc)) {
if (count > (numberOfAnts + 1) / 2)
if (countGoForFood > (numberOfAnts + 1) / 2)
break;
Aim direction = foodMap.getBestDirection(antLoc);
if (direction != null) {
if (doMoveDirection(antLoc, direction)) {
count++;
System.err.println("Formiga indo atras de comida");
countGoForFood++;
}
}
}
}
count = 0;
int countGoForEnemyHill = 0;
for (Tile antLoc : sortingAnts) {
if (!orders.containsValue(antLoc)) {
if (count > numberOfAnts / 2)
if (countGoForEnemyHill > numberOfAnts / 3)
break;
Aim direction = enemyHillMap.getBestDirection(antLoc);
if (direction != null) {
if (doMoveDirection(antLoc, direction)) {
count++;
System.err
.println("Formiga indo atras de hill inimigo");
countGoForEnemyHill++;
}
}
}
}
count = 0;
int countGoForSpace = 0;
for (Tile antLoc : sortingAnts) {
if (count > numberOfAnts / 3)
if (countGoForSpace > numberOfAnts / 3)
break;
if (!orders.containsValue(antLoc)) {
Aim direction = spacingAnts.getBestDirection(antLoc);
if (direction != null) {
if (doMoveDirection(antLoc, direction)) {
count++;//a
System.err.println("Formiga explorando");
countGoForSpace++;// a
}
}

}
}
count = 0;
int countGoForMyHill = 0;
for (Tile antLoc : sortingAnts) {
if (!orders.containsValue(antLoc)) {
if (count > numberOfAnts / 6 || count > 10 * numberofMyHills)
if (countGoForMyHill > numberOfAnts / 6
|| countGoForMyHill > 10 * numberofMyHills)
break;
Aim direction = myHillMap.getBestDirection(antLoc);
if (direction != null) {
if (doMoveDirection(antLoc, direction)) {
count++;// a
System.err
.println("Formiga indo atras de hill proprio");
countGoForMyHill++;// a
}
}
}
}
System.err.println("My hill: " + countGoForMyHill);
System.err.println("Enemy hill: " + countGoForEnemyHill);
System.err.println("Food : " + countGoForFood);
System.err.println("Space: " + countGoForSpace);

}
}

0 comments on commit 1b2170d

Please sign in to comment.