upRightToBottomRight method

Cube upRightToBottomRight(
  1. int index
)

Implementation

Cube upRightToBottomRight(int index) {
  final ep = List.of(_ep);
  final perm = List.of(Edge.values);

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

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

  var x = 11;

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

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