예제 #1
0
        public Chess Move(string move)  // Figure_name + start position + end position
        {
            FigureMoving fm = new FigureMoving(move);

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

            return(nextChess);
        }
예제 #2
0
파일: Board.cs 프로젝트: P3ndalf/DemoChess
        bool CanEatKing()
        {
            Square enemyKing = FindEnemyKing();
            Moves  moves     = new Moves(this);

            foreach (FigureOnSquare fs in YieldFigures())
            {
                FigureMoving fm = new FigureMoving(fs, enemyKing);
                if (moves.canMove(fm))
                {
                    return(true);
                }
            }
            return(false);
        }