예제 #1
0
 /// <summary>
 /// Эта клетка была выделена?
 /// </summary>
 /// <param name="pos"></param>
 /// <returns></returns>
 public bool isCorrectMove(Position pos)
 {
     if (!isHighlighted())
     {
         return(false);
     }
     if (moves.Contains(pos) || attacks.Contains(pos))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
파일: Player.cs 프로젝트: peleccom/chess
        public void KillFigureHandler(object source, EventArgs args)
        {
            Figure fig = (Figure)source;

            if (alivefigures.Contains(fig))
            {
                alivefigures.Remove(fig);
                deadfigures.Add(fig);
            }
        }
예제 #3
0
        public MyList <Position> GetMoves(Figure fig, MyList <Position> attacks)
        {
            MyList <Position> lmoves = new MyList <Position>();
            MyList <Position> moves  = new MyList <Position>();

            lmoves = fig.GetMoves();
            foreach (Position move in lmoves)
            {
                if (!attacks.Contains(move) && Field.GetFigureAt(move) == null)
                {
                    moves.Add(move);
                }
            }
            return(moves);
        }