示例#1
0
        bool IsFiftyMovesWithoutEatAndWithoutPawnMoved()
        {
            var boardHistory = board.GetBoardHistory();

            if (boardHistory.Count < MOVESNUMALLOWED)
            {
                return(false);
            }
            var counter = 0;

            for (var i = 1; i < boardHistory.Count; i++)
            {
                var theMove   = board.GetMovesHistory()[i - 1];
                var lastBoard = boardHistory[i - 1].Item2;
                //pawn or eating
                if (lastBoard[theMove.from.x][theMove.from.y] is ChessPiece || lastBoard[theMove.to.x][theMove.to.y] != null)
                {
                    counter = 0;
                    if (boardHistory.Count - i < MOVESNUMALLOWED)
                    {
                        return(false);
                    }
                }
                else
                {
                    counter++;
                }
            }
            if (counter >= MOVESNUMALLOWED)
            {
                return(true);
            }
            return(false);
        }