public void Move(Square from, Square to) { if (GetType() == typeof(Pawn)) { if ((this as Pawn).firstMove) { (this as Pawn).firstMove = false; } if ((this as Pawn).queenRow == to.Row) { (this as Pawn).QueenAPawn(to); return; } } else if (GetType() == typeof(Rook)) { (this as Rook).HasMoved = true; } Grid.SetColumn(this, to.Col); Grid.SetRow(this, to.Row); from.PieceOnSquare = null; from.HasPieceOn = false; to.HasPieceOn = true; to.PieceOnSquare = this; Square = to; Board.UpdateMovesAndThreats(); Board.CheckIfKingIsChecked(); }