Ejemplo n.º 1
0
 public bool EGEnemyBlocked(GameBoard gameBoard, Player playerOnTurn)
 {
     for (int row = 0; row < gameBoard.GetLength(1); row++)
     {
         for (int col = 0; col < gameBoard.GetLength(0); col++)
         {
             if (!gameBoard.IsEmpty(row, col))
             {
                 if (playerOnTurn.PlayerColor == (int)GameConstants.PlayerColor.Black)
                 {
                     if (gameBoard.IsWhite(row, col) && PosibleMoves(row, col, gameBoard).Any())
                     {
                         //if (board.PosibleMoves(row, col).Any())
                         return(false);
                     }
                     continue;
                 }
                 if (playerOnTurn.PlayerColor == (int)GameConstants.PlayerColor.White)
                 {
                     if (gameBoard.IsBlack(row, col) && PosibleMoves(row, col, gameBoard).Any())
                     {
                         //if (board.PosibleMoves(row, col).Any())
                         return(false);
                     }
                     continue;
                 }
             }
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
 public bool Owner(int row, int col, GameBoard board)    // kontroluje vlastnictví figurek
 {
     if (PlayerColor == (int)GameConstants.PlayerColor.Black && board.IsBlack(row, col))
     {
         return(true);
     }
     if (PlayerColor == (int)GameConstants.PlayerColor.White && board.IsWhite(row, col))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
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);
        }