示例#1
0
        private static void GetDiagonalBlackAttackers(ChessBoard board, List <Square> result, Square current, int multfile, int multrank)
        {
            char file = current.file;
            int  rank = current.rank;

            for (int i = 1; i < 8; i++)
            {
                Square tempsquare = new Square((char)(file + multfile * i), rank + multrank * i);
                if (!tempsquare.IsOK())
                {
                    break;
                }
                else if (board[tempsquare] > 0)
                {
                    break;
                }
                else if (board[tempsquare] < 0 && board[tempsquare] != (sbyte)DefaultPieces.BlackBishop && board[tempsquare] != (sbyte)DefaultPieces.BlackQueen)
                {
                    break;
                }
                else if (board[tempsquare] == (sbyte)DefaultPieces.BlackBishop || board[tempsquare] == (sbyte)DefaultPieces.BlackQueen)
                {
                    result.Add(new Square((char)(file + multfile * i), rank + multrank * i));
                    break;
                }
            }
        }
示例#2
0
        public static void GetDiagonalDestinations(ChessBoard board, ref List <Square> moves, Square current, int multfile, int multrank)
        {
            char file = current.file;
            int  rank = current.rank;

            for (int i = 1; i < 8; i++)
            {
                Square tempsquare = new Square((char)(file + multfile * i), rank + multrank * i);
                if (!tempsquare.IsOK())
                {
                    break;
                }
                else if (board[tempsquare] > 0)
                {
                    break;
                }
                else if (board[tempsquare] < 0)
                {
                    moves.Add(tempsquare);
                    break;
                }
                else
                {
                    moves.Add(tempsquare);
                }
            }
        }