Exemple #1
0
        public MoveList Clone()
        {
            var ml = new MoveList();

            foreach (var move in this)
            {
                ml.Add(move);
            }

            return(ml);
        }
        /// <summary>
        /// Applies all of the moves in <tt>moves</tt>.
        /// </summary>
        /// <param name="moves">The list of moves to apply.</param>
        /// <returns>True if all of the moves could be applied. False if not.</returns>
        public Boolean ApplyMoveList(MoveList moves)
        {
            var allMovesApplied = true;

            foreach (var move in moves)
            {
                allMovesApplied = DoMove(move);
                if (!allMovesApplied)
                {
                    break;
                }
            }
            return(allMovesApplied);
        }
Exemple #3
0
        public static MoveList ParseMoveList(String s)
        {
            var ml          = new MoveList();
            var splitString = s.Split('|');
            var stringMoves = splitString[1].Split(';');

            foreach (var stringMove in stringMoves)
            {
                var move = Move.FromString(stringMove);
                ml.Add(move);
            }
            ml.Score = Convert.ToInt32(splitString[0]);
            return(ml);
        }
Exemple #4
0
        public int CompareTo(MoveList other)
        {
            var areEqual = true;

            for (var i = 0; i < Count; i++)
            {
                var myCoordinate    = this[i].Coordinate;
                var otherCoordinate = other[i].Coordinate;
                areEqual &= myCoordinate.Equals(otherCoordinate);
            }

            if (areEqual)
            {
                return(0);
            }

            return(-1);
        }