twist method

Cube twist(
  1. int value
)

Implementation

Cube twist(int value) {
  final co = List.of(_co);
  var twistParity = 0;

  for (var i = Corner.downRightBottom.index - 1; i >= Corner.upRightFront.index; i--) {
    co[i] = value % 3;
    twistParity += co[i];
    value ~/= 3;
  }

  co[Corner.downRightBottom.index] = (3 - twistParity % 3) % 3;

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