Ejemplo n.º 1
0
        public Chess Move(string move)
        {
            FigureMoving figureMoving = new FigureMoving(move);

            if (!moves.IsCanMove(figureMoving))
            {
                Console.WriteLine("Данный ход не возможен!!");
                return(this);
            }
            if (board.IsChekAfterMove(figureMoving))
            {
                Console.WriteLine("Данный ход не возможен!!");
                return(this);
            }

            Board nextBoard = board.Move(figureMoving);
            Chess nextChess = new Chess(nextBoard);

            return(nextChess);
        }
Ejemplo n.º 2
0
        private bool CanEatKing()
        {
            bool myBool = false;

            Square enemyKing = FindEnemyKing();
            Moves  moves     = new Moves(this);

            foreach (FigureOnSquare figureOnSquare in YieldFigure())
            {
                FigureMoving figureMoving = new FigureMoving(figureOnSquare, enemyKing);

                if (moves.IsCanMove(figureMoving))
                {
                    myBool = true;
                }
            }

            return(myBool);
        }