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

Clone() public method

Creates a deep-copy of this board.
public Clone ( ) : Board
return Board
        public Board Clone()
        {
            return new Board(this);
        }

Usage Example

Example #1
0
        private static Board SwapSides(Board b)
        {
            Board sb = b.Clone();

            int n;
            for (int s = 0; s < 24; s++)
            {
                n = b.PointCount(0, s);
                sb.SetPoint(0, s, b.PointCount(1, s));
                sb.SetPoint(1, s, n);
            }

            sb.SetFinished(1, b.FinishedCount(0));
            sb.SetFinished(0, b.FinishedCount(1));

            sb.SetCaptured(1, b.CapturedCount(0));
            sb.SetCaptured(0, b.CapturedCount(1));

            return sb;
        }