Thanks for the code. I also tried this: if (this.pos.x == 49) {this.move(LEFT);}if (this.pos.x == 0 ) {this.move(RIGHT);}if (this.pos.y == 49) {this.move(TOP);}if (this.pos.y == 0 ) {this.move(BOTTOM);} And it also seems to work. My problem was made worse when I skipped all creeps with fatigue > 0. But creeps with 0 < fatigue < 1 seem to be able to move so now I only skip creeps with fatigue >=1.