public string EnPassant(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn, string moves) { string possibleMoves = ""; int leng = moves.Length, tmp; if (leng > 0) { tmp = Convert.ToInt32(string.Concat(moves[leng - 2], moves[leng - 1])); } else { tmp = 0; } int enPassantPawnLet = tmp / 10, enPassantPawnNum = tmp % 10; if ((posLet + 1 < 8 || posLet - 1 >= 0) && board[enPassantPawnLet, enPassantPawnNum] == ChessBoard.blackPawnAfterOneMove && posNum == 4 && enPassantPawnNum == 4 && (posLet + 1 == enPassantPawnLet || posLet - 1 == enPassantPawnLet)) { possibleMoves = string.Concat(possibleMoves, (enPassantPawnLet).ToString(), (enPassantPawnNum + 1).ToString()); } if ((posLet + 1 < 8 || posLet - 1 >= 0) && board[enPassantPawnLet, enPassantPawnNum] == ChessBoard.whitePawnAfterOneMove && posNum == 3 && enPassantPawnNum == 3 && (posLet + 1 == enPassantPawnLet || posLet - 1 == enPassantPawnLet)) { possibleMoves = string.Concat(possibleMoves, (enPassantPawnLet).ToString(), (enPassantPawnNum - 1).ToString()); } return(possibleMoves); }
public string PawnAttack(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) { string possibleMoves = ""; int i; if (whoseTurn) { i = 1; } else { i = -1; } if (posLet + i >= 0 && posLet + i < 8 && posNum + 1 >= 0 && posNum + i < 8 && board[posLet, posNum] > board[posLet + i, posNum + i] && board[posLet + i, posNum + i] != 0 && whoseTurn) { possibleMoves = string.Concat(possibleMoves, (posLet + i).ToString(), (posNum + i).ToString()); } if (posLet - i >= 0 && posLet - i < 8 && posNum + 1 >= 0 && posNum + i < 8 && board[posLet, posNum] > board[posLet - i, posNum + i] && board[posLet - i, posNum + i] != 0 && whoseTurn) { possibleMoves = string.Concat(possibleMoves, (posLet - i).ToString(), (posNum + i).ToString()); } if (posLet + i >= 0 && posLet + i < 8 && posNum + 1 >= 0 && posNum + i < 8 && board[posLet, posNum] < board[posLet + i, posNum + i] && !whoseTurn && board[posLet + i, posNum + i] != 0) { possibleMoves = string.Concat(possibleMoves, (posLet + i).ToString(), (posNum + i).ToString()); } if (posLet - i >= 0 && posLet - i < 8 && posNum + 1 >= 0 && posNum + i < 8 && board[posLet, posNum] < board[posLet - i, posNum + i] && !whoseTurn && board[posLet - i, posNum + i] != 0) { possibleMoves = string.Concat(possibleMoves, (posLet - i).ToString(), (posNum + i).ToString()); } return(possibleMoves); }
public string PawnMove(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) { string possibleMoves = ""; int i; if (whoseTurn) { i = 1; } else { i = -1; } if (posNum + i < 8 && posNum + i >= 0 && posNum + i + i < 8 && posNum >= 0 && (board[posLet, posNum] == ChessBoard.whitePawnUnMoved || board[posLet, posNum] == ChessBoard.blackPawnUnMoved) && board[posLet, posNum + i] == ChessBoard.empty && board[posLet, posNum + i + i] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), (posNum + i + i).ToString()); } if (posNum + i >= 0 && posNum + i < 8 && board[posLet, posNum + i] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), (posNum + i).ToString()); } // Console.WriteLine("Pawn" + possibleMoves); return(possibleMoves); }
private void PawnMove(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece) { if (posLet == 1 || posLet == 8) { Coms.RenderComs(7); UserInput userinput = new UserInput(); string input = userinput.GetPromotionInput(); switch (input[0]) { case 'K': board[posLet, posNum] = (ChessBoard)((int)ChessBoard.whiteKnight * (int)board[letOfPiece, numOfPiece]); break; case 'B': board[posLet, posNum] = (ChessBoard)((int)ChessBoard.whiteBishop * (int)board[letOfPiece, numOfPiece]); break; case 'T': board[posLet, posNum] = (ChessBoard)((int)ChessBoard.whiteTower * (int)board[letOfPiece, numOfPiece]); break; case 'Q': board[posLet, posNum] = (ChessBoard)((int)ChessBoard.whiteQueen * (int)board[letOfPiece, numOfPiece]); break; } } else { board[posLet, posNum] = board[letOfPiece, numOfPiece]; } }
public string SearchForKing(ChessBoard[,] board, bool whoseTurn) { string kingPos = ""; if (whoseTurn) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (board[i, j] == ChessBoard.whiteKing || board[i, j] == ChessBoard.whiteKingUnMoved) { kingPos = string.Concat(i.ToString(), j.ToString()); } //, Console.WriteLine(attackedTiles); } } } else { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (board[i, j] == ChessBoard.blackKing || board[i, j] == ChessBoard.blackKingUnMoved) { kingPos = string.Concat(i.ToString(), j.ToString()); } //, Console.WriteLine(attackedTiles); } } } return(kingPos); }
public void CostumBoard(ChessBoard[,] board) //for debug { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { board[i, j] = ChessBoard.empty; } } board[2, 2] = ChessBoard.whitePawn; board[1, 3] = ChessBoard.blackPawnAfterOneMove; board[0, 7] = ChessBoard.blackTowerUnMoved; board[5, 7] = ChessBoard.whiteBishop; }
public string King(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) {//yeah this is lame, but it is still the fastest way to perfome this check so yeah //i think the fastest string possibleMoves = ""; if (posLet + 1 < 8 && (board[posLet + 1, posNum] == ChessBoard.empty || !pieces.IsPlayerPiece(board[posLet + 1, posNum], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet + 1).ToString(), (posNum).ToString()); } if (posNum + 1 < 8 && (board[posLet, posNum + 1] == ChessBoard.empty || !pieces.IsPlayerPiece(board[posLet, posNum + 1], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), (posNum + 1).ToString()); } if (posLet + 1 < 8 && posNum + 1 < 8 && (board[posLet + 1, posNum + 1] == ChessBoard.empty || posLet + 1 < 8 && posNum + 1 < 8 && !pieces.IsPlayerPiece(board[posLet + 1, posNum + 1], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet + 1).ToString(), (posNum + 1).ToString()); } if (posLet - 1 >= 0 && (board[posLet - 1, posNum] == ChessBoard.empty || (posLet - 1 >= 0 && !pieces.IsPlayerPiece(board[posLet - 1, posNum], whoseTurn)))) { possibleMoves = string.Concat(possibleMoves, (posLet - 1).ToString(), (posNum).ToString()); } if (posLet - 1 >= 0 && posNum - 1 >= 0 && (board[posLet - 1, posNum - 1] == ChessBoard.empty || posLet - 1 >= 0 && posNum - 1 >= 0 && !pieces.IsPlayerPiece(board[posLet - 1, posNum - 1], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet - 1).ToString(), (posNum - 1).ToString()); } if (posNum - 1 >= 0 && (board[posLet, posNum - 1] == ChessBoard.empty || posNum - 1 >= 0 && !pieces.IsPlayerPiece(board[posLet, posNum - 1], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), (posNum - 1).ToString()); } if (posLet - 1 >= 0 && posNum + 1 < 8 && (board[posLet - 1, posNum + 1] == ChessBoard.empty || posLet - 1 >= 0 && !pieces.IsPlayerPiece(board[posLet - 1, posNum + 1], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet - 1).ToString(), (posNum + 1).ToString()); } if (posLet + 1 < 8 && posNum - 1 >= 0 && (board[posLet + 1, posNum - 1] == ChessBoard.empty || posLet + 1 < 8 && !pieces.IsPlayerPiece(board[posLet + 1, posNum - 1], whoseTurn))) { possibleMoves = string.Concat(possibleMoves, (posLet + 1).ToString(), (posNum - 1).ToString()); } if (((board[posLet, posNum] == ChessBoard.whiteKingUnMoved && board[posLet + 3, posNum] == ChessBoard.whiteTowerUnMoved) || board[posLet, posNum] == ChessBoard.blackKingUnMoved && board[posLet + 3, posNum] == ChessBoard.blackTowerUnMoved) && board[posLet + 2, posNum] == ChessBoard.empty && board[posLet + 1, posNum] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, (posLet + 2).ToString(), (posNum).ToString()); } if (((board[posLet, posNum] == ChessBoard.whiteKingUnMoved && board[posLet - 4, posNum] == ChessBoard.whiteTowerUnMoved) || board[posLet, posNum] == ChessBoard.blackKingUnMoved && board[posLet - 4, posNum] == ChessBoard.blackTowerUnMoved) && board[posLet - 3, posNum] == ChessBoard.empty && board[posLet - 2, posNum] == ChessBoard.empty && board[posLet - 1, posNum] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, (posLet - 3).ToString(), (posNum).ToString()); } //have to perfom later addintonal check to deterine if one of the tiles that king is passing on isnt attacked return(possibleMoves); }
public string Controller(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece, bool whoseTurn, string movesInt) { //Console.WriteLine(Math.Abs((int)board[posLet, posNum])); switch (Math.Abs((int)board[letOfPiece, numOfPiece])) { case 1: //PAWN //Console.WriteLine("1"); return(string.Concat(possbilemoves.PawnMove(board, letOfPiece, numOfPiece, whoseTurn), possbilemoves.PawnAttack(board, letOfPiece, numOfPiece, whoseTurn), possbilemoves.EnPassant(board, letOfPiece, numOfPiece, whoseTurn, movesInt))); case 2: //PAWN unmoved // Console.WriteLine("2"); return(string.Concat(possbilemoves.PawnMove(board, letOfPiece, numOfPiece, whoseTurn), possbilemoves.PawnAttack(board, letOfPiece, numOfPiece, whoseTurn), possbilemoves.EnPassant(board, letOfPiece, numOfPiece, whoseTurn, movesInt))); case 20: //PAWN afeter one move // Console.WriteLine("20"); return(string.Concat(possbilemoves.PawnMove(board, letOfPiece, numOfPiece, whoseTurn), possbilemoves.PawnAttack(board, letOfPiece, numOfPiece, whoseTurn), possbilemoves.EnPassant(board, letOfPiece, numOfPiece, whoseTurn, movesInt))); case 3: //KNIGHT return(possbilemoves.Knight(board, letOfPiece, numOfPiece, whoseTurn)); case 4: //BISHOP return(possbilemoves.Bishop(board, letOfPiece, numOfPiece, whoseTurn)); case 5: //TOWER return(possbilemoves.Tower(board, letOfPiece, numOfPiece, whoseTurn)); case 50: //TOWER Un MOVED return(possbilemoves.Tower(board, letOfPiece, numOfPiece, whoseTurn)); case 9: //QUEEN return(possbilemoves.Queen(board, letOfPiece, numOfPiece, whoseTurn)); case 10: //KING return(possbilemoves.King(board, letOfPiece, numOfPiece, whoseTurn)); case 100: //KING UNMOVED return(possbilemoves.King(board, letOfPiece, numOfPiece, whoseTurn)); } return(""); }
public string ListAttackedTiles(ChessBoard[,] board, int letOfPiece, int numOfPiece, bool whoseTurn) { switch (Math.Abs((int)board[letOfPiece, numOfPiece])) { case 1: //PAWN //Console.WriteLine("1"); return(string.Concat(possbilemoves.PawnAttack(board, letOfPiece, numOfPiece, whoseTurn))); case 2: //PAWN unmoved // Console.WriteLine("2"); return(string.Concat(possbilemoves.PawnAttack(board, letOfPiece, numOfPiece, whoseTurn))); case 20: //PAWN afeter one move // Console.WriteLine("20"); return(string.Concat(possbilemoves.PawnAttack(board, letOfPiece, numOfPiece, whoseTurn))); case 3: //KNIGHT return(string.Concat(possbilemoves.Knight(board, letOfPiece, numOfPiece, whoseTurn))); case 4: //BISHOP return(string.Concat(possbilemoves.Bishop(board, letOfPiece, numOfPiece, whoseTurn))); case 5: //TOWER return(string.Concat(possbilemoves.Tower(board, letOfPiece, numOfPiece, whoseTurn))); case 50: //TOWER Un MOVED return(string.Concat(possbilemoves.Tower(board, letOfPiece, numOfPiece, whoseTurn))); case 9: //QUEEN return(string.Concat(possbilemoves.Queen(board, letOfPiece, numOfPiece, whoseTurn))); case 10: //KING return(string.Concat(possbilemoves.King(board, letOfPiece, numOfPiece, whoseTurn))); case 100: //KING UNMOVED return(string.Concat(possbilemoves.King(board, letOfPiece, numOfPiece, whoseTurn))); default: return(""); } }
private void KingUnMoved(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece, bool whoseTurn) { if (whoseTurn) { if (posLet == 6) { board[posLet, posNum] = ChessBoard.whiteKing; board[5, 0] = ChessBoard.whiteTower; board[7, 0] = 0; } else if (posLet == 1) { board[posLet, posNum] = ChessBoard.whiteKing; board[1, 0] = ChessBoard.whiteTower; board[0, 0] = 0; } else { board[posLet, posNum] = ChessBoard.whiteKing; } } else { if (posLet == 6) { board[posLet, posNum] = ChessBoard.blackKing; board[5, 7] = ChessBoard.blackTower; board[7, 7] = 0; } else if (posLet == 1) { board[posLet, posNum] = ChessBoard.blackKing; board[1, 7] = ChessBoard.blackTower; board[0, 7] = 0; } else { board[posLet, posNum] = ChessBoard.blackKing; } } }
public string Knight(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) {//this again seems to be lame, but there is no better way soooo yeahh string possibleMoves = ""; if (posLet + 2 < 8 && posNum + 1 < 8 && (board[posLet + 2, posNum + 1]) == ChessBoard.empty || posLet + 2 < 8 && posNum + 1 < 8 && !pieces.IsPlayerPiece(board[posLet + 2, posNum + 1], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet + 2).ToString(), (posNum + 1).ToString()); } if (posLet + 1 < 8 && posNum + 2 < 8 && (board[posLet + 1, posNum + 2]) == ChessBoard.empty || posLet + 1 < 8 && posNum + 2 < 8 && !pieces.IsPlayerPiece(board[posLet + 1, posNum + 2], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet + 1).ToString(), (posNum + 2).ToString()); } if ((posLet - 2 >= 0 && posNum - 1 >= 0) && (board[posLet - 2, posNum - 1]) == ChessBoard.empty || posLet - 2 >= 0 && posNum - 1 >= 0 && !pieces.IsPlayerPiece(board[posLet - 2, posNum - 1], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet - 2).ToString(), (posNum - 1).ToString()); } if (posLet - 1 >= 0 && posNum - 2 >= 0 && (board[posLet - 1, posNum - 2]) == ChessBoard.empty || posLet - 1 >= 0 && posNum - 2 >= 0 && !pieces.IsPlayerPiece(board[posLet - 1, posNum - 2], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet - 1).ToString(), (posNum - 2).ToString()); } if (posLet + 2 < 8 && posNum - 1 >= 0 && (board[posLet + 2, posNum - 1]) == ChessBoard.empty || posLet + 2 < 8 && posNum - 1 >= 0 && !pieces.IsPlayerPiece(board[posLet + 2, posNum - 1], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet + 2).ToString(), (posNum - 1).ToString()); } if (posLet - 2 >= 0 && posNum + 1 < 8 && (board[posLet - 2, posNum + 1]) == ChessBoard.empty || posLet - 2 >= 0 && posNum + 1 < 8 && !pieces.IsPlayerPiece(board[posLet - 2, posNum + 1], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet - 2).ToString(), (posNum + 1).ToString()); } if (posLet - 1 >= 0 && posNum + 2 < 8 && (board[posLet - 1, posNum + 2]) == ChessBoard.empty || posLet - 1 >= 0 && posNum + 2 < 8 && !pieces.IsPlayerPiece(board[posLet - 1, posNum + 2], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet - 1).ToString(), (posNum + 2).ToString()); } if (posLet + 1 < 8 && posNum - 2 >= 0 && (board[posLet + 1, posNum - 2]) == ChessBoard.empty || posLet + 1 < 8 && posNum - 2 >= 0 && !pieces.IsPlayerPiece(board[posLet + 1, posNum - 2], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet + 1).ToString(), (posNum - 2).ToString()); } return(possibleMoves); }
public RenderBoard(ChessBoard[,] board) { board[0, 0] = ChessBoard.whiteTowerUnMoved; board[1, 0] = ChessBoard.whiteKnight; board[2, 0] = ChessBoard.whiteBishop; board[3, 0] = ChessBoard.whiteQueen; board[4, 0] = ChessBoard.whiteKingUnMoved; board[5, 0] = ChessBoard.whiteBishop; board[6, 0] = ChessBoard.whiteKnight; board[7, 0] = ChessBoard.whiteTowerUnMoved; int j = 1; for (int i = 0; i < 8; i++) { board[i, j] = ChessBoard.whitePawnUnMoved; } for (int i = 0; i < 8; i++) { for (j = 2; j < 5; j++) { board[i, j] = ChessBoard.empty; } } j = 6; for (int i = 0; i < 8; i++) { board[i, j] = ChessBoard.blackPawnUnMoved; } board[0, 7] = ChessBoard.blackTowerUnMoved; board[1, 7] = ChessBoard.blackKnight; board[2, 7] = ChessBoard.blackBishop; board[3, 7] = ChessBoard.blackQueen; board[4, 7] = ChessBoard.blackKingUnMoved; board[5, 7] = ChessBoard.blackBishop; board[6, 7] = ChessBoard.blackKnight; board[7, 7] = ChessBoard.blackTowerUnMoved; }
public void ExecuteMove(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece, bool whoseTurn) { switch (Math.Abs((int)board[letOfPiece, numOfPiece])) { case 1: PawnMove(board, posLet, posNum, letOfPiece, numOfPiece); break; case 2: PawnUnMovedAndTowerUnMoved(board, posLet, posNum, letOfPiece, numOfPiece); break; case 20: PawnAfterOneMove(board, posLet, posNum, letOfPiece, numOfPiece); break; case 3: RestOfThePieces(board, posLet, posNum, letOfPiece, numOfPiece); break; case 4: RestOfThePieces(board, posLet, posNum, letOfPiece, numOfPiece); break; case 5: RestOfThePieces(board, posLet, posNum, letOfPiece, numOfPiece); break; case 9: RestOfThePieces(board, posLet, posNum, letOfPiece, numOfPiece); break; case 100: KingUnMoved(board, posLet, posNum, letOfPiece, numOfPiece, whoseTurn); break; } board[letOfPiece, numOfPiece] = 0; }
public void Render(ChessBoard[,] board) { for (int i = 0; i < 8; i++) { Console.Write((i + 1) + " |"); } Console.WriteLine(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 9; j++) { if (j < 8) { Console.Write(TransformPieceToTile(board[i, j]) + " "); } else { Console.Write((char)(65 + i) + ""); } } Console.WriteLine(); } }
public bool IsTaken(ChessBoard[,] board, int let, int num) { //determines if the positon where players wants to move is taken return(board[let, num] != ChessBoard.empty ? false : true); }
public string Queen(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) { return(string.Concat(Bishop(board, posLet, posNum, whoseTurn), Tower(board, posLet, posNum, whoseTurn))); }
public bool IsCheckMate(ChessBoard[,] board, bool whoseTurn) { return(true); }
public ChessBoard WhichPiece(ChessBoard[,] board, int posLet, int posNum) { return(board[(posLet), (posNum)]); // return the piece that was chosen by the player }
public string Tower(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) { string possibleMoves = ""; for (int i = posLet + 1; i < 8; i++) { if (board[i, posNum] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, i.ToString(), (posNum).ToString()); } else if (pieces.IsPlayerPiece(board[i, posNum], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[i, posNum], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, i.ToString(), (posNum).ToString()); break; } } for (int i = posLet - 1; i >= 0; i--) { if (board[i, posNum] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, i.ToString(), (posNum).ToString()); } else if (pieces.IsPlayerPiece(board[i, posNum], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[i, posNum], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, i.ToString(), (posNum).ToString()); break; } } for (int i = posNum + 1; i < 8; i++) { if (board[posLet, i] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), i.ToString()); } else if (pieces.IsPlayerPiece(board[posLet, i], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[posLet, i], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), i.ToString()); break; } } for (int i = posNum - 1; i >= 0; i--) { if (board[posLet, i] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), i.ToString()); } else if (pieces.IsPlayerPiece(board[posLet, i], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[posLet, i], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, (posLet).ToString(), i.ToString()); break; } } return(possibleMoves); }
private void PawnAfterOneMove(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece) { board[posLet, posNum] = (ChessBoard)((int)board[letOfPiece, numOfPiece] / 20); }
private void PawnUnMovedAndTowerUnMoved(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece) { board[posLet, posNum] = (ChessBoard)(10 * (int)board[letOfPiece, numOfPiece]); }
private void RestOfThePieces(ChessBoard[,] board, int posLet, int posNum, int letOfPiece, int numOfPiece) { board[posLet, posNum] = board[letOfPiece, numOfPiece]; }
public string Bishop(ChessBoard[,] board, int posLet, int posNum, bool whoseTurn) { Transform transform = new Transform(); string possibleMoves = ""; int i = posLet + 1; int j = posNum + 1; while (i < 8 && j < 8) { if (board[i, j] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); } else if (pieces.IsPlayerPiece(board[i, j], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[i, j], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); break; } i++; j++; } i = posLet - 1; j = posNum - 1; while (i >= 0 && j >= 0) { if (board[i, j] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); } else if (pieces.IsPlayerPiece(board[i, j], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[i, j], whoseTurn)) { Console.WriteLine("asdasd"); possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); break; } i--; j--; } i = posLet - 1; j = posNum + 1; while (i >= 0 && j < 8) { if (board[i, j] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); } else if (pieces.IsPlayerPiece(board[i, j], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[i, j], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); break; } i--; j++; } i = posLet + 1; j = posNum - 1; while (i < 8 && j >= 0) { if (board[i, j] == ChessBoard.empty) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); } else if (pieces.IsPlayerPiece(board[i, j], whoseTurn)) { break; } else if (!pieces.IsPlayerPiece(board[i, j], whoseTurn)) { possibleMoves = string.Concat(possibleMoves, i.ToString(), j.ToString()); break; } i++; j--; } Console.WriteLine("Ruchy Bishopp "); transform.test(possibleMoves); return(possibleMoves); }