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