/// <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); }
/// <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; }