コード例 #1
0
        public Chess Move(string move)  //Pe2e4 Pe7e8Q
        {
            FigureMoving fm = new FigureMoving(move);

            if (!moves.CanMove(fm) || board.IsCheckAfterMove(fm))
            {
                return(this);
            }
            Board nextBoard = board.Move(fm);
            Chess nextChess = new Chess(nextBoard);

            return(nextChess);
        }
コード例 #2
0
        public Chess Move(string move) //Pe2e4. P - пешка. e2 - начальная позиция. е4 - конечная.
        {
            FigureMoving fm = new FigureMoving(move);

            if (!moves.CanMove(fm))
            {
                return(this);
            }
            Board nextBoard = board.Move(fm);
            Chess nextChess = new Chess(nextBoard);

            return(nextChess);
        }
コード例 #3
0
        public Chess Move(string move)
        {
            FigureMoving fm = new FigureMoving(move);

            if (!moves.CanMove(fm))
            {
                return(this);
            }
            Board nextBoard = board.Move(fm);
            Chess nextChess = new Chess(nextBoard);

            return(nextChess);
        }
コード例 #4
0
ファイル: Chess.cs プロジェクト: ssauew/game_chess
        /*******************/

        //делается ход фигуры
        public Chess Move(string move)                // Pe2e4   Pe7e8Q
        {
            FigureMoving fm = new FigureMoving(move); //figure from to promotion

            if (!moves.CanMove(fm))
            {
                return(this);
            }
            if (board.IsCheckAfterMove(fm))//
            {
                return(this);
            }
            Board nextBoard = board.Move(fm);       //реализация самого хода фигуры
            Chess nextChess = new Chess(nextBoard); //инфа о параметрах и реализации хода

            return(nextChess);
        }
コード例 #5
0
ファイル: Chess.cs プロジェクト: VladSerdiuk750/Chess-Game
        public Chess Move(string move) // Pe2e4         Pe7e8Q
        {
            var fm = new FigureMoving(move);

            if (_moves.CanMove(fm) == false)
            {
                return(this);
            }
            if (_board.IsCheckAfterMove(fm) == true)
            {
                return(this);
            }
            Board nextBoard = _board.Move(fm);
            var   nextChess = new Chess(nextBoard);

            return(nextChess);
        }
コード例 #6
0
        public Chess Move(string move)
        {
            FigureMoving fm = new FigureMoving(move);

            if (!moves.CanMove(fm))
            {
                return(this);
            }
            if (!board.IsCheckAfterMove(fm))
            {
                return(this);
            }

            Board nextBoard = board.Move(fm);

            return(new Chess(nextBoard));
        }
コード例 #7
0
ファイル: Chess.cs プロジェクト: aalcatelz/ChessEngine
        public Chess Move(string move)
        {
            var fm = new FigureMoving(move);

            if (!Moves.CanMove(fm))
            {
                return(this);
            }
            if (Board.IsCheckAfterMove(fm))
            {
                return(this);
            }
            var nextBoard = Board.Move(fm);
            var nextChess = new Chess(nextBoard);

            return(nextChess);
        }
コード例 #8
0
        private bool CanEatKing(Square whereIsCheckedKing)
        {
            Moves moves = new Moves(this);

            foreach (FigureOnSquare fs in YieldFigures())
            {
                FigureMoving fm = new FigureMoving(fs, whereIsCheckedKing);
                if (moves.CanMove(fm))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #9
0
        bool CanEatKing()
        {
            Square badKing = FindBadKing();
            Moves  moves   = new Moves(this);

            foreach (FigureOnSquare fs in YieldFigures())
            {
                FigureMoving fm = new FigureMoving(fs, badKing);
                if (moves.CanMove(fm))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #10
0
        bool CanKingGo(Square fl, Board board)
        {
            Moves          moves = new Moves(board);
            FigureOnSquare fs    = new FigureOnSquare(moveColor == Color.white ? Figure.whiteKing : Figure.blackKing, fl);

            foreach (Square to in Square.YieldSquares())
            {
                FigureMoving fm = new FigureMoving(fs, to);
                if (moves.CanMove(fm))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #11
0
ファイル: Board.cs プロジェクト: ssauew/game_chess
        bool CanEatKing()
        {
            Square badKing = FindBadKing();               //найти короля
            Moves  moves   = new Moves(this);             //найти доступные ходы

            foreach (FigureOnSquare fs in YieldFigures()) //перебор фигур
            {
                FigureMoving fm = new FigureMoving(fs, badKing);
                if (moves.CanMove(fm))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #12
0
        private bool CanEatKing()
        {
            var badKing = FindBadKing();
            var moves   = new Moves(this);

            foreach (var fs in YieldFigures())
            {
                var fm = new FigureMoving(fs, badKing);
                if (moves.CanMove(fm))
                {
                    return(true);
                }
            }

            return(false);
        }