Пример #1
0
        public void RotatingWalk()
        {
            this.Clear();

            int      count    = 1;
            Position position = new Position(0, 0);
            Walk     walk     = new Walk(Directions.SE);

            while (true)
            {
                this.matrix[position.Row, position.Column] = count;

                if (!this.CanWalkToPosition(position))
                {
                    bool positionAvailable = this.FindAvailablePosition(out position);
                    if (positionAvailable)
                    {
                        count++;
                        this.matrix[position.Row, position.Column] = count;
                        walk.Direction = Directions.SE;
                    }
                    else
                    {
                        break;
                    }
                }

                while (!this.CheckIfPositionIsValid(position.Row + walk.Vertical, position.Column + walk.Horizontal))
                {
                    walk.ChangeDirection();
                }

                position.UpdatePosition(walk);
                count++;
            }
        }
Пример #2
0
        public void RotatingWalk()
        {
            this.Clear();

            int count = 1;
            Position position = new Position(0, 0);
            Walk walk = new Walk(Directions.SE);

            while (true)
            {
                this.matrix[position.Row, position.Column] = count;

                if (!this.CanWalkToPosition(position))
                {
                    bool positionAvailable = this.FindAvailablePosition(out position);
                    if (positionAvailable)
                    {
                        count++;
                        this.matrix[position.Row, position.Column] = count;
                        walk.Direction = Directions.SE;
                    }
                    else
                    {
                        break;
                    }
                }

                while (!this.CheckIfPositionIsValid(position.Row + walk.Vertical, position.Column + walk.Horizontal))
                {
                    walk.ChangeDirection();
                }

                position.UpdatePosition(walk);
                count++;
            }
        }