public bool CanMove(string move) { //pt ce piesa se aplica mutarea var startX = Int32.Parse(move[1].ToString()) - 1; //Console.WriteLine("startx board: " + startX); var startY = move[0] - 'a'; //Console.WriteLine("starty board: " + startY); var endY = move[3] - 'a'; //Console.WriteLine("Endy board: " + endY); var endX = Int32.Parse(move[4].ToString()) - 1; //Console.WriteLine("Endx board: " + endX); if (TablaSah[startX, startY] == null) { //Console.WriteLine("Nu exista piesa pe aceasta pozitie"); return(false); } else { if (TablaSah[startX, startY].Name == "K") { Piece king = new King(); return(king.Move(TablaSah, move)); } if (TablaSah[startX, startY].Name == "Q") { Piece queen = new Queen(); if (queen.Move(TablaSah, move) == true && queen.CheckIfMove(TablaSah, move) == false) { return(true); } else { return(false); } } if (TablaSah[startX, startY].Name == "B") { Piece bishop = new Bishop(); if (bishop.Move(TablaSah, move) == true && bishop.CheckIfMove(TablaSah, move) == false) { return(true); } else { return(false); } } if (TablaSah[startX, startY].Name == "N") { Piece knight = new Knight(); if (knight.Move(TablaSah, move) == true && knight.CheckIfMove(TablaSah, move) == false) { return(true); } else { return(false); } } if (TablaSah[startX, startY].Name == "P") { Piece pawn = new Pawn(); if (pawn.Move(TablaSah, move) == true && pawn.CheckIfMove(TablaSah, move) == false) { return(true); } else { return(false); } } if (TablaSah[startX, startY].Name == "R") { Piece rook = new Rook(); if (rook.Move(TablaSah, move) == true && rook.CheckIfMove(TablaSah, move) == false) { return(true); } else { return(false); } } } return(false); }