Beispiel #1
0
        public UICoordinate White()
        {
            var          s            = new WhitePossiblePlace(G);
            var          q            = new WhiteQuenPossiblePlace(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));
            }
        }
Beispiel #2
0
        internal UIPlayGame DumWhite()
        {
            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.BlackCoordinate.FindIndex(c => c.X == x1 && c.Y == y1);
                if (i > -1)
                {
                    G.Move.DumX = x1;
                    G.Move.DumY = y1;
                    G.BlackCoordinate.RemoveAt(i);
                    break;
                }
                x1 = (byte)(x1 + x2);
                y1 = (byte)(y1 + y2);
            }


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

            if (i1 > 0 || i2 > 0)
            {
                G.Move.AgainDum = true;
            }
            else
            {
                G.Queue = G.Gamer2; G.Move.AgainDum = false;
            }
            return(MoveWhite());
        }