Exemplo n.º 1
0
        public int CheckKingSiege(GameBoard board, int row, int col)
        {
            int sieged = 0;
            List <List <int> > adjacted = GameRules.Adjacted(row, col, board);

            foreach (List <int> position in adjacted)
            {
                if (board.Enemy(row, col, position[0], position[1]) && !board.IsKing(position[0], position[1]))
                {
                    sieged = 20;
                }
            }
            return(sieged);
        }
Exemplo n.º 2
0
        public int KingHunting(GameBoard board, int row, int col)
        {
            int hunt = 0;
            List <List <int> > adjacted = GameRules.Adjacted(row, col, board);

            foreach (List <int> position in adjacted)
            {
                if (board.Enemy(row, col, position[0], position[1]) && board.IsKing(position[0], position[1]))
                {
                    hunt += 2;
                }
            }
            return(hunt);
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
 // Metoda pro rozhodnutí zda-li je tah v souladu s pravidly
 public bool ValidMove(int row, int col, int newRow, int newCol, GameBoard board)
 {
     if (ValidPosition(row, col) && ValidPosition(newRow, newCol))
     {
         //Console.WriteLine("Valid position, Valid new position");
         if (ValidDistance(row, col, newRow, newCol))
         {
             if (board.Occupied(row, col) && !board.Frozen(row, col) && !board.Frozen(newRow, newCol))
             {
                 if (board.IsKing(row, col) && board.Occupied(newRow, newCol))
                 {
                     return(false);
                 }
                 else if (board.Occupied(newRow, newCol) && !board.Enemy(row, col, newRow, newCol))
                 {
                     return(false);
                 }
                 else
                 {
                     return(true);
                 }
             }
             else
             {
                 return(false); //Console.WriteLine("Empty or frozen field.");
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false); //Console.WriteLine("Not valid position.");
     }
 }