computeUpRightToDownFront method

int computeUpRightToDownFront()

Implementation

int computeUpRightToDownFront() {
  final edge = List.filled(6, Edge.upRight);
  var a = 0, x = 0, b = 0;

  // compute the index a < (12 choose 6) and the permutation array.
  for (var j = Edge.upRight.index; j <= Edge.bottomRight.index; j++) {
    if (_ep[j].index <= Edge.downFront.index) {
      a += _cnk(j, x + 1);
      edge[x++] = _ep[j];
    }
  }

  // compute the index b < 6! for the permutation.
  for (var j = 5; j > 0; j--) {
    var k = 0;

    while (edge[j].index != j) {
      _rotateLeft(edge, 0, j);
      k++;
    }

    b = (j + 1) * b + k;
  }

  return 720 * a + b;
}