File tree Expand file tree Collapse file tree
engine/src/main/battlecode/world Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ public class InternalRobot implements Comparable<InternalRobot> {
5656 // the number of messages this robot/tower has sent this turn
5757 private int sentMessagesCount ;
5858
59+ public static Random rand = new Random (1092 );
60+
5961 private int chirality ;
6062 private int sleepTimeRemaining ;
6163
@@ -1179,11 +1181,15 @@ else if (this.type == UnitType.CAT) {
11791181 if (this .catTurnsStuck >= 4 ){
11801182 // cat has been unable to move or dig or attack for 4+ turns
11811183 // start turning and then trying to dig or attack again
1184+ Direction [] directions = Direction .values ();
1185+ Direction random = directions [rand .nextInt (directions .length )];
1186+
11821187 if (this .controller .canTurn ()) {
1183- try {
1184- if (this .chirality == 0 ) this .controller .turn (this .dir .rotateRight ());
1185- else this .controller .turn (this .dir .rotateLeft ());
1186- } catch (GameActionException e ) {}
1188+ try {
1189+ this .controller .turn (random );
1190+ }
1191+ catch (GameActionException e ){}
1192+
11871193 }
11881194 }
11891195 else {
You can’t perform that action at this time.
0 commit comments