예제 #1
0
 private void rotate() {
   final Coordinate c = randomNormal();
   final Piece piece = pieces[c.getY()][c.getX()];
   if (piece.getType() == PieceType.NORMAL) {
     piece.rotate((int) GaUtil.random(1, 3));
   }
 }
예제 #2
0
 private Direction randomDirection() {
   final int ordinal = (int) GaUtil.random(0, 3);
   for (final Direction direction : Direction.values()) {
     if (direction.ordinal() == ordinal) {
       return direction;
     }
   }
   throw new IllegalStateException();
 }
예제 #3
0
 private Coordinate randomBorder() {
   final int number = (int) GaUtil.random(1, boardSize - 2);
   return directionCoordinate(number, randomDirection());
 }
예제 #4
0
 private Coordinate randomNormal() {
   final int x = (int) GaUtil.random(1, boardSize - 2);
   final int y = (int) GaUtil.random(1, boardSize - 2);
   return Coordinate.from(x, y);
 }