Cube MoveColumn(Face face, int columnIndex, YMovement rotation) { if (size % 2 == 1 && columnIndex == size / 2) { throw new ArgumentException("ColumnIndex cannot be central if cube is uneven sized"); } int next = rotation == YMovement.Up ? up : down; int previous = 5 - next; if (columnIndex == 0) { if (rotation == YMovement.Down) { faces[left].RotateClockwise(); } else { faces[left].RotateCounterClockwise(); } } if (columnIndex == size - 1) { if (rotation == YMovement.Down) { faces[right].RotateCounterClockwise(); } else { faces[right].RotateClockwise(); } } Element[] temp = new Element[size]; SwapColumn(face, columnIndex, faces[next]); SwapColumn(faces[opposite], columnIndex, faces[previous]); SwapColumn(face, columnIndex, faces[opposite]); return(this); }
public Cube MoveColumn(int columnIndex, YMovement rotation) => MoveColumn(faces[0], columnIndex, rotation);