upRightFrontToDownLeftBottom method

Cube upRightFrontToDownLeftBottom(
  1. int index
)

Implementation

Cube upRightFrontToDownLeftBottom(int index) {
  final cp = List.of(_cp);
  final perm = List.of(Corner.values);

  for (var j = 1; j < 8; j++) {
    var k = index % (j + 1);
    index ~/= j + 1;

    while (k-- > 0) {
      _rotateRight(perm, 0, j);
    }
  }

  var x = 7;

  for (var j = 7; j >= 0; j--) {
    cp[j] = perm[x--];
  }

  return Cube._(cp: cp, co: _co, ep: _ep, eo: _eo);
}