GR.Gambling.Backgammon.Board.IsPureRace C# (CSharp) Method

IsPureRace() public method

Returns true if both player's checkers have "passed" each others so that it's impossible to hit or block anymore. Source: http://www.bkgm.com/gloss/lookup.cgi?pure+race
public IsPureRace ( ) : bool
return bool
        public bool IsPureRace()
        {
            if (CapturedCount(0) > 0 || CapturedCount(1) > 0)
                return false;

            int player = -2, opponent = -2;
            for (int i = 23; i >= 0; i--)
            {
                if (board[0][i] > 0)
                {
                    player = i;
                    break;
                }
            }

            for (int i = 23; i >= 0; i--)
            {
                if (board[1][i] > 0)
                {
                    opponent = i;
                    break;
                }
            }

            if (player == -2 || opponent == -2)
                return false;

            // Flip the index
            opponent = 23 - opponent;

            if (player > opponent)
                return false;

            return true;
        }