Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 private bool _isMovablePiece(FrogsAndToadsPiece gamePiece)
 => gamePiece.Move != 0;
Ejemplo n.º 3
0
 private bool _targetIsJumpable(int target, FrogsAndToadsPiece piece)
 => _track[target] == piece.Converse;