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