Пример #1
0
        /// <summary>
        /// check whether the position is forbidden
        /// </summary>
        /// <returns>if it is forbidden ,true;otherwise ,false
        /// </returns>
        private bool IsFobidden(ref IChessBoard chessBoard, Position point, PieceTypeEnum pieceType)
        {
            Referee            platformCheck = new Referee();
            PlayStepResultEnum stepResult    = platformCheck.Check(chessBoard, new ChessBoardPoint(point.Row, point.Col), PieceTypeEnum.Black);

            //it seems the platform does not check four-three-three

            if (stepResult == PlayStepResultEnum.Four_Four ||
                stepResult == PlayStepResultEnum.Three_Three ||
                stepResult == PlayStepResultEnum.Overline)
            {
                if (pieceType == PieceTypeEnum.Black)
                {
                    return(true);
                }
                else
                {
                    stepResult = platformCheck.Check(chessBoard, new ChessBoardPoint(point.Row, point.Col), PieceTypeEnum.White);
                    if (stepResult == PlayStepResultEnum.Four_Four ||
                        stepResult == PlayStepResultEnum.Three_Three ||
                        stepResult == PlayStepResultEnum.Win)
                    {
                        return(false);
                    }
                }
            }


            return(false);
        }
Пример #2
0
        //is forbidden
        private bool IsFobidden(ref IChessBoard chessBoard, Position point, PieceTypeEnum pieceType)
        {
            Referee            platformCheck = new Referee();
            PlayStepResultEnum stepResult    = platformCheck.Check(chessBoard, new ChessBoardPoint(14 - point.Row, point.Col), PieceTypeEnum.Black);

            //it seems the platform does not check four-three-three

            if (stepResult == PlayStepResultEnum.Four_Four ||
                stepResult == PlayStepResultEnum.Three_Three ||
                stepResult == PlayStepResultEnum.Overline)
            {
                if (pieceType == PieceTypeEnum.Black)
                {
                    return(true);
                }
                else
                {
                    //white priority vs. black forbidden
                    //if this position is black-forbidden,generally white should not be put here
                    //but if is advantaged enough for white,it should
                    if (PlayStepResultEnum.Win == platformCheck.Check(chessBoard, new ChessBoardPoint(14 - point.Row, point.Col), PieceTypeEnum.White))
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #3
0
        /// <summary>
        /// check whether the position is forbidden
        /// </summary>
        /// <returns>if it is forbidden ,true;otherwise ,false
        /// </returns>
        private bool IsFobidden(ref IChessBoard chessBoard,Position point,PieceTypeEnum pieceType)
        {
            Referee platformCheck = new Referee();
            PlayStepResultEnum stepResult=platformCheck.Check(chessBoard, new ChessBoardPoint(point.Row, point.Col), PieceTypeEnum.Black);
            //it seems the platform does not check four-three-three

                if (stepResult == PlayStepResultEnum.Four_Four ||
                   stepResult == PlayStepResultEnum.Three_Three ||
                   stepResult == PlayStepResultEnum.Overline)
                {
                    if (pieceType == PieceTypeEnum.Black)
                    {
                        return true;
                    }
                    else
                    {
                        stepResult = platformCheck.Check(chessBoard, new ChessBoardPoint(point.Row, point.Col), PieceTypeEnum.White);
                        if (stepResult == PlayStepResultEnum.Four_Four ||
                            stepResult == PlayStepResultEnum.Three_Three||
                            stepResult==PlayStepResultEnum.Win)
                        {
                            return false;
                        }
                    }
                }

            return false;
        }
Пример #4
0
        //is forbidden
        private bool IsFobidden(ref IChessBoard chessBoard, Position point, PieceTypeEnum pieceType)
        {
            Referee platformCheck = new Referee();
            PlayStepResultEnum stepResult = platformCheck.Check(chessBoard, new ChessBoardPoint(14 - point.Row, point.Col), PieceTypeEnum.Black);
            //it seems the platform does not check four-three-three

            if (stepResult == PlayStepResultEnum.Four_Four ||
               stepResult == PlayStepResultEnum.Three_Three ||
               stepResult == PlayStepResultEnum.Overline)
            {
                if (pieceType == PieceTypeEnum.Black)
                {
                    return true;
                }
                else
                {
                    //white priority vs. black forbidden
                    //if this position is black-forbidden,generally white should not be put here
                    //but if is advantaged enough for white,it should
                    if (PlayStepResultEnum.Win == platformCheck.Check(chessBoard, new ChessBoardPoint(14 - point.Row, point.Col), PieceTypeEnum.White))
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
            return false;
        }