Пример #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);
 }
Пример #2
0
 // Metody pro ověření konce hry (EG)
 public bool EGFrozenKings(GameBoard gameBoard)
 {
     for (int row = 0; row < gameBoard.GetLength(1); row++)
     {
         for (int col = 0; col < gameBoard.GetLength(0); col++)
         {
             if (gameBoard.IsKing(row, col))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #3
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);
        }