Example #1
0
        /// <summary>
        /// Compares two moves to each other.
        /// </summary>
        /// <param name="obj">Move to compare tho this move.</param>
        /// <returns>True if the moves are equal. False otherwise.</returns>
        public override bool Equals(object obj)
        {
            PawnPromotionMove move = obj as PawnPromotionMove;

            if (move != null)
            {
                return(base.Equals(obj) && this.m_promotionPiece == move.m_promotionPiece);
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Finds the move matching the MoveLookupKey.
        /// </summary>
        /// <param name="match">MoveLookupKey to find corrosponding move for.</param>
        /// <returns>The matching move. Null if a move matching 'match' dosn't exist.</returns>
        public Move Find(MoveLookupKey match)
        {
            foreach (Move move in m_moves)
            {
                if (move.From == match.From && move.To == match.To)
                {
                    PawnPromotionMove promotionMove = move as PawnPromotionMove;

                    if (promotionMove != null)
                    {
                        if (promotionMove.PromotedPiece == match.PawnPromotePiece)
                        {
                            return(promotionMove);
                        }
                    }
                    else
                    {
                        return(move);
                    }
                }
            }

            return(null);
        }