Skip to content

Commit f8ebb82

Browse files
committed
make cat bfs produce more efficient routes by checking cardinal directions first in bfs
1 parent 5aca2bd commit f8ebb82

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

engine/src/main/battlecode/world/GameWorld.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public void bfsFromTarget(MapLocation target, int chirality){
235235
MapLocation nextLoc = queue.poll();
236236

237237
// check neighbors
238-
for (Direction d : Direction.allDirections()){
238+
for (Direction d : new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTHEAST, Direction.SOUTHEAST, Direction.SOUTHWEST, Direction.NORTHWEST}){
239239
if (d == Direction.CENTER)
240240
continue;
241241

0 commit comments

Comments
 (0)