Пример #1
0
        public int BoardScoreSum(GameBoard gameBoard, int playerColor)
        {
            int[,] board = gameBoard.Board;

            int sum = 0;

            for (int i = 1; i < board.GetLength(0) - 1; i++)
            {
                for (int j = 1; j < board.GetLength(1) - 1; j++)
                {
                    if (!gameBoard.Frozen(i, j))
                    {
                        sum += board[i, j];
                    }

                    if (gameBoard.IsWhiteKing(i, j))
                    {
                        sum -= 15;

                        sum += CheckKingSiege(gameBoard, i, j);
                        sum -= CheckKingMarch(i, playerColor);
                    }
                    if (gameBoard.IsWhite(i, j) && !gameBoard.IsWhiteKing(i, j))
                    {
                        sum -= 10;
                        sum -= KingHunting(gameBoard, i, j);
                    }

                    if (gameBoard.IsBlackKing(i, j))
                    {
                        sum += 15;
                        sum -= CheckKingSiege(gameBoard, i, j);
                        sum += CheckKingMarch(i, playerColor);
                    }
                    if (gameBoard.IsBlack(i, j) && !gameBoard.IsBlackKing(i, j))
                    {
                        sum += 10;
                        sum += KingHunting(gameBoard, i, j);
                    }
                }
            }
            return(sum);
        }
Пример #2
0
        public bool EGRoyalLine(GameBoard gameBoard)
        {
            for (int col = 0; col < gameBoard.GetLength(0); col++)
            {
                if (gameBoard.IsBlackKing(1, col))
                {
                    return(true);
                }
            }

            for (int col = 0; col < gameBoard.GetLength(0); col++)
            {
                if (gameBoard.IsWhiteKing(6, col))
                {
                    return(true);
                }
            }

            return(false);
        }