Ejemplo n.º 1
0
        public AwariBoard(
            int f                   = 0, int e = 0, int d = 0, int c = 0, int b = 0, int a = 0,
            int A                   = 0, int B = 0, int C = 0, int D = 0, int E = 0, int F = 0,
            int southAwari          = 0, int northAwari = 0,
            AwariPlayer firstToMove = AwariPlayer.South)
        {
            FirstToMove = firstToMove;
            if (firstToMove == AwariPlayer.South)
            {
                _position = new AwariPosition(new[]
                                              { A, B, C, D, E, F,
                                                a, b, c, d, e, f,
                                                southAwari,
                                                northAwari });
            }
            else
            {
                _position = new AwariPosition(new[]
                                              { a, b, c, d, e, f,
                                                A, B, C, D, E, F,
                                                northAwari,
                                                southAwari });
            }

            if (TotalStones != 48)
            {
                throw new ArgumentException($"AwariBoard should always contain 48 stones while {TotalStones} stones are passed.");
            }
        }
Ejemplo n.º 2
0
        public virtual AwariPosition Copy()
        {
            var p = new AwariPosition(Position.ToList().ToArray());

            History.ForEach(x => p.History.Add(x.ToList().ToArray()));
            return(p);
        }
Ejemplo n.º 3
0
 private void SetFullAwariPosition()
 {
     if (!(_position is AwariPositionWithRepetitionDetection) && NorthAwari + SouthAwari > 34)
     {
         _position = new AwariPositionWithRepetitionDetection(_position);
     }
 }
Ejemplo n.º 4
0
 public AwariPositionWithRepetitionDetection(AwariPosition awariPosition) : base(awariPosition)
 {
     _lastCapture = new Stack <int>();
     _lastCapture.Push(0);
 }
Ejemplo n.º 5
0
 public AwariPosition(AwariPosition position)
 {
     Position = position.Position;
     History  = position.History;
 }