Beispiel #1
0
        public void Grow(Position position)
        {
            Position reversePosition = new Position(position.X * -1, position.Y * -1);
            Position oldPosition     = SnakeBody.Tail.Value;

            Node newHead = new Node(new Position(oldPosition.X, oldPosition.Y));

            newHead.Value.ChangePosition(reversePosition);
            Checker.CheckIfSnakeIsOutside(newHead.Value, reversePosition);
            SnakeBody.AddLast(newHead);
        }
        public void Grow(Position position)
        {
            var reverse     = new Position(position.X * -1, position.Y * -1);
            var oldPosition = SnakeBody.Tail.Value;

            var newHead = new Node(new Position(oldPosition.X, oldPosition.Y));

            newHead.Value.ChangePosition(reverse);
            BoundariesChecker.CheckBoundaries(newHead.Value, reverse);
            SnakeBody.AddLast(newHead);
        }