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

SetPoint() public method

Sets the given slot to count from player's perspective.
public SetPoint ( int player, int point, int count ) : void
player int The player from whose perspective the slot is mapped.
point int
count int Positive count is for the player, negative for the opponent. Zero count empties the slot for both players.
return void
        public void SetPoint(int player, int point, int count)
        {
            if (player == -1)
                return;

            int opponent = 1 - player;
            int flipped = 23 - point;
            if (count > 0)
            {
                board[player][point] = count;
                board[opponent][flipped] = 0;
            }
            else if (count == 0)
            {
                board[player][point] = 0;
                board[opponent][flipped] = 0;
            }
            else
            {
                board[player][point] = 0;
                board[opponent][flipped] = -1 * count;
            }
        }