internal FrogsAndToadsPosition SubPosition(int leftIndex, int rightIndex) { if (_locationIsInvalid(leftIndex)) { throw new IndexOutOfRangeException("leftIndex"); } if (_locationIsInvalid(rightIndex)) { throw new IndexOutOfRangeException("rightIndex"); } if (leftIndex > rightIndex) { throw new InvalidOperationException("leftIndex bigger than rightIndex"); } int length = rightIndex - leftIndex + 1; FrogsAndToadsPiece[] result = new FrogsAndToadsPiece[length]; Array.Copy(_track, leftIndex, result, 0, length); return(new FrogsAndToadsPosition(result)); }
private bool _isMovablePiece(FrogsAndToadsPiece gamePiece) => gamePiece.Move != 0;
private bool _targetIsJumpable(int target, FrogsAndToadsPiece piece) => _track[target] == piece.Converse;