Пример #1
0
 private void DrawVisualHints(Graphics g)
 {
     if (ShowVisualHints && DragDropOperation.Origin != null)
     {
         List <ChessMove> legalMoves = ChessEngine.GetLegalMoves(DragDropOperation.Origin);
         foreach (ChessMove chessMove in legalMoves)
         {
             g.FillEllipse(new SolidBrush(Color.FromArgb(150, 92, 214, 92)),
                           BoardDirection == BoardDirection.BlackOnTop ?
                           GetHintRectangle((int)chessMove.To.File, 7 - (int)chessMove.To.Rank) :
                           GetHintRectangle(7 - (int)chessMove.To.File, (int)chessMove.To.Rank));
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Returns all legal moves for the current position for the given square.
 /// </summary>
 /// <param name="square">Square for which to compute legal moves.</param>
 /// <returns></returns>
 /// <exception cref="ArgumentNullException">Thrown when the <paramref name="square"/> is null.</exception>
 /// <exception cref="ArgumentException">Thrown when the <paramref name="square"/> is empty.</exception>
 public List <ChessMove> GetLegalMoves(ChessSquare square)
 {
     return(ChessEngine.GetLegalMoves(square));
 }
Пример #3
0
 /// <summary>
 /// Returns all legal moves for the current position.
 /// </summary>
 /// <returns></returns>
 public List <ChessMove> GetLegalMoves()
 {
     return(ChessEngine.GetLegalMoves());
 }