src/ChessTrainerApp/Components/ChessBoardBase.cs
/// <summary>
/// Attempts to place a selected piece. This unselects any selected piece.
/// </summary>
/// <param name="file">The file to place the selected piece on.</param>
/// <param name="rank">The rank to place the selected piece on.</param>
/// <returns>True if the selected piece was successully and legally placed on the indicated rank and file. False if the move is illegal or if no piece is selected.</returns>
Attempts to place a selected piece. This unselects any selected piece.
Attempts to place a selected piece . This unselects any selected piece .
private bool PlacePiece(int file, int rank)
        {
            var move = LegalMovesForSelectedPiece.SingleOrDefault(m => m.FinalPosition.File == file && m.FinalPosition.Rank == rank);
            SelectedPiece = null;
            if (move != null)
            {
                Game.Move(move);
                return true;
            }
            else
            {
                return false;
            }
        }
private bool PlacePiece ( int file , int rank ) { var move = LegalMovesForSelectedPiece . SingleOrDefault ( m => m . FinalPosition . File == file && m . FinalPosition . Rank == rank ) ; SelectedPiece = null ; if ( move != null ) { Game . Move ( move ) ; return true ; } else { return false ; } }
Attempts to place a selected piece.
Attempts to place a selected piece .
// If the piece is placed in a legal move location, // move the piece.
True if the selected piece was successully and legally placed on the indicated rank and file. False if the move is illegal or if no piece is selected.
True if the selected piece was successully and legally placed on the indicated rank and file . False if the move is illegal or if no piece is selected .
file
int
The file to place the selected piece on.
The file to place the selected piece on .
rank
int
The rank to place the selected piece on.
The rank to place the selected piece on .