Esempio n. 1
0
        private void FirstClick(Point firstPoint, out bool isThisFirstClick)
        {
            isThisFirstClick = false;
            List <Point> p = null;

            if (_desk.GetCheckerOnDesk(firstPoint) != null)
            {
                CheckerOnDesk checker = _desk.GetCheckerOnDesk(firstPoint);
                if (_desk.CheckersHaveToBit(Color).Count != 0)
                {
                    if (_desk.IsToBit(_desk.GetCheckerOnDesk(firstPoint)) != null)
                    {
                        isThisFirstClick = true;
                        p = _desk.IsToBit(checker);
                        _movingChecker = checker;
                    }
                }
                else
                {
                    if (_desk.IsToMove(checker).Count != 0)
                    {
                        isThisFirstClick = true;
                        p = _desk.IsToMove(checker);
                        _movingChecker = checker;
                    }
                }
            }
            this.LightPoints = p;
        }
Esempio n. 2
0
        //Зайвий return
        public void Move()
        {
            Random rnd = new Random();

            if (_desk.CheckersHaveToBit(Color).Count != 0)
            {
                do
                {
                    int           r1  = rnd.Next(0, _desk.CheckersHaveToBit(Color).Count - 1);
                    CheckerOnDesk ch1 = _desk.CheckersHaveToBit(Color)[r1];

                    int   r2 = rnd.Next(0, _desk.IsToBit(ch1).Count - 1);
                    Point p2 = _desk.IsToBit(ch1)[r2];

                    _desk.MoveCheking(ch1.Point, p2, out _isBeat, Color);

                    _movingChecker = _desk.GetCheckerOnDesk(p2);
                    FirstPoint     = ch1.Point;
                    SecondPoint    = p2;
                }while (_desk.IsToBit(_movingChecker).Count > 0);
            }
            else
            {
                if (_desk.ChekersToMove(Color).Count != 0)
                {
                    int           r1  = rnd.Next(0, _desk.ChekersToMove(Color).Count - 1);
                    CheckerOnDesk ch1 = _desk.ChekersToMove(Color)[r1];

                    int   r2 = rnd.Next(0, _desk.IsToMove(ch1).Count - 1);
                    Point p2 = _desk.IsToMove(ch1)[r2];

                    _desk.MoveCheking(ch1.Point, p2, out _isBeat, Color);

                    FirstPoint  = ch1.Point;
                    SecondPoint = p2;
                }
            }
            return;
        }