internal King(PiecesKeys pieceKey, Color pieceColor, string castling) : base(pieceKey, pieceColor) { if (pieceColor == Color.black) { if (castling[2] == (char)blackKing) { shortCastling = true; } if (castling[3] == (char)blackQueen) { longCastling = true; } } if (pieceColor == Color.white) { if (castling[0] == (char)whiteKing) { shortCastling = true; } if (castling[1] == (char)whiteQueen) { longCastling = true; } } }
//Получить клетку на которой стоит король internal Square FindKing(Color inGameColor) { PiecesKeys kingKey = inGameColor == Color.black ? blackKing : whiteKing; foreach (Square square in deskSquares) { if (square.ownedPiece.pieceKey == kingKey) { return(square); } } return(Square.none); }
private void InitMove(string move) { if (move != "0-0-0" && move != " 0-0 ") { pieceKey = (PiecesKeys)move[0]; from = move.Substring(1, 2); to = move.Substring(3, 2); if (name.Length == 6) { promotion = true; promotionCharKey = move[5]; } } else { if (move == "0-0-0" && inGameColor == Color.white) { castling = "White-Long"; fromK = "e1"; toK = "c1"; fromR = "a1"; toR = "d1"; } if (move == "0-0-0" && inGameColor == Color.black) { castling = "Black-Long"; fromK = "e8"; toK = "c8"; fromR = "a8"; toR = "d8"; } if (move == " 0-0 " && inGameColor == Color.white) { castling = "White-Short"; fromK = "e1"; toK = "g1"; fromR = "h1"; toR = "f1"; } if (move == " 0-0 " && inGameColor == Color.black) { castling = "Black-Short"; fromK = "e8"; toK = "g8"; fromR = "h8"; toR = "f8"; } } }
internal Queen(PiecesKeys pieceKey, Color pieceColor) : base(pieceKey, pieceColor) { }
internal Bishop(PiecesKeys pieceKey, Color pieceColor) : base(pieceKey, pieceColor) { }
internal Pawn(PiecesKeys pieceKey, Color pieceColor) : base(pieceKey, pieceColor) { stepY = pieceColor == Color.white ? 1 : -1; }
internal Piece(PiecesKeys pieceKey, Color pieceColor) { this.pieceKey = pieceKey; this.pieceColor = pieceColor; }
internal NullPiece(PiecesKeys pieceKey, Color pieceColor) : base(pieceKey, pieceColor) { }
internal Rook(PiecesKeys pieceKey, Color pieceColor) : base(pieceKey, pieceColor) { }
internal Night(PiecesKeys pieceKey, Color pieceColor) : base(pieceKey, pieceColor) { }