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)); } }
private void rotateBorder(final Piece piece, final Direction... directions) { if (borderSum(piece, directions) == 0) { return; } for (int i = 0; i < 3; i++) { piece.rotate(1); if (borderSum(piece, directions) == 0) { return; } } throw new IllegalStateException("NO BORDER OR CORNER!!"); }
public void Rotate() { grid = current.rotate(grid); repaint(); }