示例#1
0
        internal UIPlayGame DumBlack()
        {
            byte x1 = OldX;
            byte y1 = OldY;

            var x2 = Math.Sign(NewX - OldX);
            var y2 = Math.Sign(NewY - OldY);

            while (x1 != NewX && y1 != NewY)
            {
                var i = G.WhiteCoordinate.FindIndex(c => c.X == x1 && c.Y == y1);
                if (i > -1)
                {
                    G.Move.DumX = x1;
                    G.Move.DumY = y1;
                    G.WhiteCoordinate.RemoveAt(i);
                    break;
                }
                x1 = (byte)(x1 + x2);
                y1 = (byte)(y1 + y2);
            }

            var i1 = new BlackPossiblePlace(G).EveryWhereDum(NewX, NewY).DumCoordinates.Count;
            var i2 = new BlackQuenPossiblePlace(G).PossibleDum(NewX, NewY).DumCoordinates.Count;

            if (i1 > 0 || i2 > 0)
            {
                G.Move.AgainDum = true;
            }
            else
            {
                G.Queue = G.Gamer1; G.Move.AgainDum = false;
            }
            return(MoveBlack());
        }
示例#2
0
        public UICoordinate BLack()
        {
            var          s            = new BlackPossiblePlace(G);
            var          q            = new BlackQuenPossiblePlace(G);
            UICoordinate uICoordinate = new UICoordinate();

            if (G.Move.AgainDum)
            {
                if (x == G.Move.NewX && y == G.Move.NewY)
                {
                    if (z > 0)
                    {
                        uICoordinate = q.PossibleDum(x, y);
                    }
                    else
                    {
                        uICoordinate = s.EveryWhereDum(x, y);
                    }
                }
                return(uICoordinate);
            }
            if (z > 0)
            {
                uICoordinate = q.PossibleDum(x, y);
            }
            else
            {
                uICoordinate = s.SimpleDum(x, y);
            }
            if (uICoordinate.DumCoordinates.Count > 0)
            {
                return(uICoordinate);
            }
            if (s.AnyStoneDum() || q.AnyStoneDum())
            {
                return(default(UICoordinate));
            }
            if (z > 0)
            {
                return(q.PossiblePlace(x, y));
            }
            else
            {
                return(s.PossiblePlace(x, y));
            }
        }