Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
コード例 #1
0
        protected virtual List <Position> GetAmbiguities(Move move, Piece movingPiece)
        {
            if (movingPiece == null)
            {
                return(new List <Position>());
            }
            List <Position> ambiguities = new List <Position>();

            foreach (File f in Enum.GetValues(typeof(File)))
            {
                if (f == File.None)
                {
                    continue;
                }
                for (int r = 1; r <= 8; r++)
                {
                    Position pos = new Position(f, r);
                    if (!move.OriginalPosition.Equals(pos))
                    {
                        Piece p = GetPieceAt(f, r);
                        if (p != null && p.Equals(movingPiece) && p.IsValidMove(new Move(pos, move.NewPosition, move.Player), this))
                        {
                            ambiguities.Add(pos);
                        }
                    }
                }
            }
            return(ambiguities);
        }