Beispiel #1
0
 private Direction getRandomDirection() {
   Direction direction = Direction.any();
   while (!isFree(direction)) {
     direction = Direction.any();
   }
   return direction;
 }
Beispiel #2
0
 private boolean isUnableToMove() {
   for (Direction direction : Direction.values()) {
     if (isFree(direction)) {
       return false;
     }
   }
   return true;
 }